From 88857e015d3be6f894592204d76d8580eae0ac9b Mon Sep 17 00:00:00 2001 From: Luck Date: Wed, 17 Apr 2019 10:06:47 +0100 Subject: Fix permission checking --- .../src/main/java/me/lucko/spark/forge/ForgeClientSparkPlugin.java | 2 +- .../src/main/java/me/lucko/spark/forge/ForgeServerSparkPlugin.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'spark-forge/src/main') diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClientSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClientSparkPlugin.java index 2c6c2fb..b214308 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClientSparkPlugin.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClientSparkPlugin.java @@ -43,7 +43,7 @@ public class ForgeClientSparkPlugin extends ForgeSparkPlugin { } @Override - public Set getSenders() { + public Set getSendersWithPermission(String permission) { return new HashSet<>(Collections.singleton(Minecraft.getMinecraft().player)); } diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerSparkPlugin.java index 98740c0..167aa94 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerSparkPlugin.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerSparkPlugin.java @@ -37,9 +37,10 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin { } @Override - public Set getSenders() { + public Set getSendersWithPermission(String permission) { MinecraftServer mcServer = FMLCommonHandler.instance().getMinecraftServerInstance(); Set senders = new HashSet<>(mcServer.getPlayerList().getPlayers()); + senders.removeIf(sender -> !sender.canUseCommand(4, permission)); senders.add(mcServer); return senders; } -- cgit