From fc98f931e20cd18c4d55b78248d9bfb202b872c1 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Thu, 21 Apr 2022 02:19:27 +0200 Subject: [PATCH] Bugfix Bugfix: If you did not have the permission to see a function and still clicked on the slot, then an error occurred --- .../commandguiv2/Spigot/Listener/GUIListener.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUIListener.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUIListener.java index 67fb9ae..18ab254 100644 --- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUIListener.java +++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUIListener.java @@ -50,14 +50,14 @@ public class GUIListener implements Listener { for (Slot slot : gui.slots) { Function function = Main.functionHashMap.get(slot.function); if (e.getSlot() != slot.slot) continue; + if (slot.permission && !player.hasPermission(slot.permissionToUse)) { + player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, function.name)) + .replace("[perm]", slot.permissionToUse)); + continue; + } if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == ItemVersion.getGreenWool().getType() || e.getCurrentItem().getType() == ItemVersion.getRedWool().getType() || e.getCurrentItem().getType() == Material.valueOf(function.item.toUpperCase().replace(".", "_"))) { - if (slot.permission && !player.hasPermission(slot.permissionToUse)) { - player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, function.name)) - .replace("[perm]", slot.permissionToUse)); - continue; - } if (!slot.enable) continue; if (function.cost_Enable) { if (function.command_Enable || function.message_Enable || function.openGUI_Enable || function.serverChange) {