mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-26 02:34:42 +02:00
Slightly change how flag permissions are handled (#3201)
This commit is contained in:
@ -92,6 +92,16 @@ public class BukkitPermissionHandler implements PermissionHandler {
|
||||
return player != null && player.hasPermission(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasKeyedPermission(
|
||||
final @Nullable String world,
|
||||
final @NonNull String stub,
|
||||
final @NonNull String key
|
||||
) {
|
||||
final Player player = this.playerReference.get();
|
||||
return player != null && (player.hasPermission(stub + "." + key) || player.hasPermission(stub + ".*"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -117,6 +117,26 @@ public class VaultPermissionHandler implements PermissionHandler {
|
||||
return permissions.playerHas(world, offlinePlayer, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasKeyedPermission(
|
||||
final @Nullable String world,
|
||||
final @NonNull String stub,
|
||||
final @NonNull String key
|
||||
) {
|
||||
if (permissions == null) {
|
||||
return false;
|
||||
}
|
||||
if (world == null && offlinePlayer instanceof BukkitPlayer) {
|
||||
return permissions.playerHas(
|
||||
((BukkitPlayer) offlinePlayer).getPlatformPlayer(),
|
||||
stub + ".*"
|
||||
) || permissions.playerHas(((BukkitPlayer) offlinePlayer).getPlatformPlayer(), stub + "." + key);
|
||||
}
|
||||
return permissions.playerHas(world, offlinePlayer, stub + ".*") || permissions.playerHas(world, offlinePlayer,
|
||||
stub + "." + key
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -82,4 +82,14 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer {
|
||||
return this.permissionProfile.hasPermission(world, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasKeyedPermission(
|
||||
final @Nullable String world,
|
||||
final @NonNull String stub,
|
||||
final @NonNull String key
|
||||
) {
|
||||
return this.permissionProfile.hasPermission(world, stub + "." + key) || this.permissionProfile.hasPermission(world,
|
||||
stub + ".*");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user