Added getServerPermissionName() for OnlinePlayer

This commit is contained in:
Marc Baloup 2023-05-13 13:35:14 +02:00
parent f0a9fca952
commit 61fb7b3142
2 changed files with 11 additions and 3 deletions

View File

@ -67,7 +67,7 @@ public interface PermissibleOnlinePlayer extends PermissibleOffPlayer, AbstractO
* @return a LongStream containing all the values found for the specified permission prefix. * @return a LongStream containing all the values found for the specified permission prefix.
*/ */
default LongStream getPermissionRangeValues(String permissionPrefix) { default LongStream getPermissionRangeValues(String permissionPrefix) {
String server = getServerName(); String server = getServerPermissionName();
String world = server == null ? null : getWorldName(); String world = server == null ? null : getWorldName();
return getPermissionUser().getPermissionRangeValues(permissionPrefix, server, world); return getPermissionUser().getPermissionRangeValues(permissionPrefix, server, world);
} }
@ -76,7 +76,7 @@ public interface PermissibleOnlinePlayer extends PermissibleOffPlayer, AbstractO
* Returns the maximum value returned by {@link PermissibleOffPlayer#getPermissionRangeValues(String)}. * Returns the maximum value returned by {@link PermissibleOffPlayer#getPermissionRangeValues(String)}.
*/ */
default OptionalLong getPermissionRangeMax(String permissionPrefix) { default OptionalLong getPermissionRangeMax(String permissionPrefix) {
String server = getServerName(); String server = getServerPermissionName();
String world = server == null ? null : getWorldName(); String world = server == null ? null : getWorldName();
return getPermissionUser().getPermissionRangeMax(permissionPrefix, server, world); return getPermissionUser().getPermissionRangeMax(permissionPrefix, server, world);
} }

View File

@ -23,11 +23,19 @@ public interface AbstractOnlinePlayer extends AbstractOffPlayer {
/** /**
* Returns the name of the current server the player is in. * Returns the name of the current server the player is in.
* The returned value is used by the 'pandalib-permissions' system.
* @return the name of the current server the player is in. * @return the name of the current server the player is in.
*/ */
String getServerName(); String getServerName();
/**
* Returns the name of the current server as used by the permission system.
* The returned value is used by the 'pandalib-permissions' system.
* @return the permission name of the current server.
*/
default String getServerPermissionName() {
return getServerName();
}
/** /**
* Returns the name of the current world the player is in. * Returns the name of the current world the player is in.
* The returned value is used by the 'pandalib-permissions' system. * The returned value is used by the 'pandalib-permissions' system.