diff --git a/Readme.md b/Readme.md
index 45e3e2a..40a7204 100644
--- a/Readme.md
+++ b/Readme.md
@@ -9,22 +9,24 @@ that are detailed in their respective Readme file (if any).
- `pandalib-util` General purpose utility and helper classes;
- `pandalib-chat` A chat API working on top of the Adventure API;
- `pandalib-db` An ORM working with a MySQL server through JDBC;
-- `pandalib-permissions` A general purpose permission system;
-- `pandalib-reflect` A reflection wrapper to make reflective operation easier;
-- `pandalib-netapi` A poorly designed, but working TCP network library;
-- `pandalib-net` A better-designed, packet-based TCP network library (still in development);
-- `pandalib-players-standalone` A library to handle classes representing online or offline player;
-- `pandalib-players-permissible` An extension of `pandalib-players-standalone` with support for the permission system `pandalib-permissions`;
-- `pandalib-commands` A command manager working on top of [Brigadier](https://github.com/Mojang/brigadier);
-- `pandalib-core` A catch-all module for some helper classes that didn’t have their own module yet;
- `pandalib-bungee` Utility and helper classes to use in Bungeecord plugins;
-- `pandalib-bungee-permissions` Integration of the permission system `pandalib-permissions` into Bungeecord;
-- `pandalib-bungee-players` A partial extension and implementation of `pandalib-players-standalone` for Bungeecord plugin;
- `pandalib-paper` Utility and helper classes to use in Spigot/Paper plugins;
+- `pandalib-reflect` A reflection wrapper to make reflective operation easier;
- `pandalib-paper-reflect` A reflection API to ease access to NMS and OBS stuff in Paper server;
-- `pandalib-paper-permissions` Integration of the permission system `pandalib-permissions` into Bukkit/Spigot/Paper permission system;
-- `pandalib-paper-players` A partial extension and implementation of `pandalib-players-standalone` for Paper plugin;
-- `pandalib-cli` Utility and helper classes for a standalone Java application.
+- `pandalib-permissions` A general purpose permission system;
+- `pandalib-bungee-permissions` Integration of the permission system `pandalib-permissions` into Bungeecord;
+- `pandalib-paper-permissions` Integration of the permission system `pandalib-permissions` into Bukkit, Vault and WEPIF permission systems;
+- `pandalib-players` A library to handle classes representing online or offline players;
+- `pandalib-players-permissible` An extension of `pandalib-players` with support for the permission system `pandalib-permissions`;
+- `pandalib-bungee-players` A partial extension and implementation of `pandalib-players` for Bungeecord plugin;
+- `pandalib-paper-players` A partial extension and implementation of `pandalib-players` for Paper plugin;
+- `pandalib-netapi` A poorly designed, but working TCP network library;
+- `pandalib-net` A better-designed, packet-based TCP network library (_still in development_);
+- `pandalib-commands` An abstract command manager working on top of [Brigadier](https://github.com/Mojang/brigadier);
+- `pandalib-bungee-commands` Integrates Brigadier commands into Bungeecord, extending `pandalib-commands`;
+- `pandalib-paper-commands` Integrates Brigadier commands into the Paper server, extending `pandalib-commands`;
+- `pandalib-cli` Utility and helper classes for a standalone CLI Java application.
+- `pandalib-core` A catch-all module for some helper classes that didn’t have their own module yet;
### Use in your projects
@@ -45,11 +47,10 @@ Then, add any module you need in your `` section:
fr.pandacube.pandalib
pandalib-util
- master-SNAPSHOT
+ master-SNAPSHOT
```
You can use the version as provided in the code above, but if you want a stable version, check those available in the
-[tag section](https://github.com/PandacubeFr/PandaLib/tags). Don’t forget to take a look at the module’s readme file,
-for any details you may need related to that specific module.
\ No newline at end of file
+[tag section](https://github.com/PandacubeFr/PandaLib/tags).
\ No newline at end of file
diff --git a/pandalib-bungee-permissions/pom.xml b/pandalib-bungee-permissions/pom.xml
index 760ef06..025cf73 100644
--- a/pandalib-bungee-permissions/pom.xml
+++ b/pandalib-bungee-permissions/pom.xml
@@ -23,8 +23,9 @@
fr.pandacube.lib
- pandalib-players-permissible
+ pandalib-players
${project.version}
+ provided
fr.pandacube.lib
diff --git a/pandalib-bungee-permissions/src/main/java/fr/pandacube/lib/bungee/permissions/PandalibBungeePermissions.java b/pandalib-bungee-permissions/src/main/java/fr/pandacube/lib/bungee/permissions/PandalibBungeePermissions.java
index cbc2b7c..91308d7 100644
--- a/pandalib-bungee-permissions/src/main/java/fr/pandacube/lib/bungee/permissions/PandalibBungeePermissions.java
+++ b/pandalib-bungee-permissions/src/main/java/fr/pandacube/lib/bungee/permissions/PandalibBungeePermissions.java
@@ -1,5 +1,8 @@
package fr.pandacube.lib.bungee.permissions;
+import fr.pandacube.lib.permissions.Permissions;
+import fr.pandacube.lib.players.standalone.StandaloneOnlinePlayer;
+import fr.pandacube.lib.players.standalone.StandalonePlayerManager;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@@ -9,10 +12,6 @@ import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.event.EventHandler;
-import fr.pandacube.lib.permissions.Permissions;
-import fr.pandacube.lib.players.permissible.PermissibleOnlinePlayer;
-import fr.pandacube.lib.players.permissible.PermissiblePlayerManager;
-
public class PandalibBungeePermissions implements Listener {
public static void init(Plugin bungeePlugin) {
@@ -35,13 +34,14 @@ public class PandalibBungeePermissions implements Listener {
private volatile boolean tryPermPlayerManager = true;
private boolean hasPerm(ProxiedPlayer p, String permission) {
+ String world = null;
if (tryPermPlayerManager) {
try {
- PermissiblePlayerManager, ?> pm = PermissiblePlayerManager.getInstance();
+ StandalonePlayerManager, ?> pm = StandalonePlayerManager.getInstance();
if (pm != null) {
- PermissibleOnlinePlayer op = pm.get(p.getUniqueId());
+ StandaloneOnlinePlayer op = pm.get(p.getUniqueId());
if (op != null) {
- return op.hasPermission(permission);
+ world = op.getWorldName();
}
}
} catch (NoClassDefFoundError ignored) {
@@ -52,6 +52,6 @@ public class PandalibBungeePermissions implements Listener {
// if not using player manager, fallback to directly call permissions API
Server sv = p.getServer();
String server = sv == null ? null : sv.getInfo().getName();
- return Permissions.getPlayer(p.getUniqueId()).hasPermissionOr(permission, server, null, false);
+ return Permissions.getPlayer(p.getUniqueId()).hasPermissionOr(permission, server, world, false);
}
}
diff --git a/pandalib-bungee-players/pom.xml b/pandalib-bungee-players/pom.xml
index 9d7706a..6269ba6 100644
--- a/pandalib-bungee-players/pom.xml
+++ b/pandalib-bungee-players/pom.xml
@@ -28,7 +28,7 @@
fr.pandacube.lib
- pandalib-players-standalone
+ pandalib-players
${project.version}
diff --git a/pandalib-bungee-players/src/main/java/fr/pandacube/lib/bungee/players/BungeeOnlinePlayer.java b/pandalib-bungee-players/src/main/java/fr/pandacube/lib/bungee/players/BungeeOnlinePlayer.java
index 470b8a7..67e9025 100644
--- a/pandalib-bungee-players/src/main/java/fr/pandacube/lib/bungee/players/BungeeOnlinePlayer.java
+++ b/pandalib-bungee-players/src/main/java/fr/pandacube/lib/bungee/players/BungeeOnlinePlayer.java
@@ -63,6 +63,21 @@ public interface BungeeOnlinePlayer extends BungeeOffPlayer, StandaloneOnlinePla
+ /*
+ * Permissions and groups
+ */
+
+ /**
+ * Tells if this online player has the specified permission.
+ */
+ default boolean hasPermission(String permission) {
+ return getBungeeProxiedPlayer().hasPermission(permission);
+ }
+
+
+
+
+
/*
* Sending packet and stuff to player
diff --git a/pandalib-paper-players/pom.xml b/pandalib-paper-players/pom.xml
index d030209..3900bf6 100644
--- a/pandalib-paper-players/pom.xml
+++ b/pandalib-paper-players/pom.xml
@@ -23,7 +23,7 @@
fr.pandacube.lib
- pandalib-players-standalone
+ pandalib-players
${project.version}
diff --git a/pandalib-paper-players/src/main/java/fr/pandacub/lib/paper/players/PaperOnlinePlayer.java b/pandalib-paper-players/src/main/java/fr/pandacub/lib/paper/players/PaperOnlinePlayer.java
index 5ffa0d9..452e768 100644
--- a/pandalib-paper-players/src/main/java/fr/pandacub/lib/paper/players/PaperOnlinePlayer.java
+++ b/pandalib-paper-players/src/main/java/fr/pandacub/lib/paper/players/PaperOnlinePlayer.java
@@ -61,6 +61,21 @@ public interface PaperOnlinePlayer extends PaperOffPlayer, StandaloneOnlinePlaye
+ /*
+ * Permissions and groups
+ */
+
+ /**
+ * Tells if this online player has the specified permission.
+ */
+ default boolean hasPermission(String permission) {
+ return getBukkitPlayer().hasPermission(permission);
+ }
+
+
+
+
+
/*
* Sending packet and stuff to player
*/
diff --git a/pandalib-players-permissible/pom.xml b/pandalib-players-permissible/pom.xml
index 36e3283..ed7272c 100644
--- a/pandalib-players-permissible/pom.xml
+++ b/pandalib-players-permissible/pom.xml
@@ -23,7 +23,7 @@
fr.pandacube.lib
- pandalib-players-standalone
+ pandalib-players
${project.version}
diff --git a/pandalib-players-permissible/src/main/java/fr/pandacube/lib/players/permissible/PermissibleOnlinePlayer.java b/pandalib-players-permissible/src/main/java/fr/pandacube/lib/players/permissible/PermissibleOnlinePlayer.java
index 5fa0551..ac56790 100644
--- a/pandalib-players-permissible/src/main/java/fr/pandacube/lib/players/permissible/PermissibleOnlinePlayer.java
+++ b/pandalib-players-permissible/src/main/java/fr/pandacube/lib/players/permissible/PermissibleOnlinePlayer.java
@@ -3,6 +3,7 @@ package fr.pandacube.lib.players.permissible;
import java.util.OptionalLong;
import java.util.stream.LongStream;
+import fr.pandacube.lib.permissions.PermissionExpressionParser;
import fr.pandacube.lib.players.standalone.StandaloneOnlinePlayer;
public interface PermissibleOnlinePlayer extends PermissibleOffPlayer, StandaloneOnlinePlayer {
@@ -45,7 +46,9 @@ public interface PermissibleOnlinePlayer extends PermissibleOffPlayer, Standalon
* indirectly call the method {@link PermissibleOffPlayer#hasPermissionExpression(String)},
* or it may result in a {@link StackOverflowError}.
*/
- boolean hasPermissionExpression(String permission);
+ default boolean hasPermissionExpression(String permissionExpression) {
+ return PermissionExpressionParser.evaluate(permissionExpression, this::hasPermission);
+ }
/**
* Lists all the values for a set of permission indicating an integer in a range.
@@ -60,12 +63,20 @@ public interface PermissibleOnlinePlayer extends PermissibleOffPlayer, Standalon
* @param permissionPrefix the permission prefix to search for.
* @return a LongStream containing all the values found for the specified permission prefix.
*/
- LongStream getPermissionRangeValues(String permissionPrefix);
+ default LongStream getPermissionRangeValues(String permissionPrefix) {
+ String server = getServerName();
+ String world = server == null ? null : getWorldName();
+ return getPermissionUser().getPermissionRangeValues(permissionPrefix, server, world);
+ }
/**
* Returns the maximum value returned by {@link PermissibleOffPlayer#getPermissionRangeValues(String)}.
*/
- OptionalLong getPermissionRangeMax(String permissionPrefix);
+ default OptionalLong getPermissionRangeMax(String permissionPrefix) {
+ String server = getServerName();
+ String world = server == null ? null : getWorldName();
+ return getPermissionUser().getPermissionRangeMax(permissionPrefix, server, world);
+ }
diff --git a/pandalib-players-standalone/pom.xml b/pandalib-players/pom.xml
similarity index 94%
rename from pandalib-players-standalone/pom.xml
rename to pandalib-players/pom.xml
index 5b9cbdd..980b7af 100644
--- a/pandalib-players-standalone/pom.xml
+++ b/pandalib-players/pom.xml
@@ -10,7 +10,7 @@
4.0.0
- pandalib-players-standalone
+ pandalib-players
jar
diff --git a/pandalib-players-standalone/src/main/java/fr/pandacube/lib/players/standalone/StandaloneOffPlayer.java b/pandalib-players/src/main/java/fr/pandacube/lib/players/standalone/StandaloneOffPlayer.java
similarity index 100%
rename from pandalib-players-standalone/src/main/java/fr/pandacube/lib/players/standalone/StandaloneOffPlayer.java
rename to pandalib-players/src/main/java/fr/pandacube/lib/players/standalone/StandaloneOffPlayer.java
diff --git a/pandalib-players-standalone/src/main/java/fr/pandacube/lib/players/standalone/StandaloneOnlinePlayer.java b/pandalib-players/src/main/java/fr/pandacube/lib/players/standalone/StandaloneOnlinePlayer.java
similarity index 94%
rename from pandalib-players-standalone/src/main/java/fr/pandacube/lib/players/standalone/StandaloneOnlinePlayer.java
rename to pandalib-players/src/main/java/fr/pandacube/lib/players/standalone/StandaloneOnlinePlayer.java
index 51e1b39..d9b78c3 100644
--- a/pandalib-players-standalone/src/main/java/fr/pandacube/lib/players/standalone/StandaloneOnlinePlayer.java
+++ b/pandalib-players/src/main/java/fr/pandacube/lib/players/standalone/StandaloneOnlinePlayer.java
@@ -1,14 +1,13 @@
package fr.pandacube.lib.players.standalone;
-import java.util.Locale;
-import java.util.UUID;
-
+import fr.pandacube.lib.chat.ChatStatic;
import net.kyori.adventure.identity.Identified;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.ComponentLike;
-import fr.pandacube.lib.chat.ChatStatic;
+import java.util.Locale;
+import java.util.UUID;
public interface StandaloneOnlinePlayer extends StandaloneOffPlayer {
@@ -28,14 +27,27 @@ public interface StandaloneOnlinePlayer extends StandaloneOffPlayer {
String getServerName();
String getWorldName();
-
-
-
+
+
+
+
+
+ /*
+ * Permissions and groups
+ */
+
+ /**
+ * Tells if this online player has the specified permission.
+ * @implSpec Implementation of this method should call the permission system of their environment (paper/bungee),
+ * so this method will work independently of the usage of the 'pandalib-permissions' module.
+ */
+ boolean hasPermission(String permission);
+
diff --git a/pandalib-players-standalone/src/main/java/fr/pandacube/lib/players/standalone/StandalonePlayerManager.java b/pandalib-players/src/main/java/fr/pandacube/lib/players/standalone/StandalonePlayerManager.java
similarity index 100%
rename from pandalib-players-standalone/src/main/java/fr/pandacube/lib/players/standalone/StandalonePlayerManager.java
rename to pandalib-players/src/main/java/fr/pandacube/lib/players/standalone/StandalonePlayerManager.java
diff --git a/pom.xml b/pom.xml
index ea27d43..764a3a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,8 +78,8 @@
pandalib-paper-players
pandalib-paper-reflect
pandalib-permissions
+ pandalib-players
pandalib-players-permissible
- pandalib-players-standalone
pandalib-reflect
pandalib-util