diff options
author | Luck <git@lucko.me> | 2022-12-10 10:01:58 +0000 |
---|---|---|
committer | Luck <git@lucko.me> | 2022-12-10 10:01:58 +0000 |
commit | 521cf8889ea4938b93691233178640fea06db69e (patch) | |
tree | 5b52a478dbabb9e8d4b46d1109bcffd7f8985acf /spark-fabric/src | |
parent | 1536537473aa5dead4c7353444e217df30d2ad96 (diff) | |
download | spark-521cf8889ea4938b93691233178640fea06db69e.tar.gz spark-521cf8889ea4938b93691233178640fea06db69e.tar.bz2 spark-521cf8889ea4938b93691233178640fea06db69e.zip |
Give integrated server host all permissions
Diffstat (limited to 'spark-fabric/src')
-rw-r--r-- | spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java index c528e5b..1606d57 100644 --- a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java +++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java @@ -119,8 +119,15 @@ public class FabricServerSparkPlugin extends FabricSparkPlugin implements Comman @Override public boolean hasPermission(CommandOutput sender, String permission) { - if (sender instanceof PlayerEntity) { - return Permissions.check(((PlayerEntity) sender), permission, 4); + if (sender instanceof PlayerEntity player) { + return Permissions.getPermissionValue(player, permission).orElseGet(() -> { + MinecraftServer server = player.getServer(); + if (server != null && server.isHost(player.getGameProfile())) { + return true; + } + + return player.hasPermissionLevel(4); + }); } else { return true; } |