diff --git a/src/main/java/io/github/punishmentsx/listeners/ChatListener.java b/src/main/java/io/github/punishmentsx/listeners/ChatListener.java index f61b1db..647a289 100644 --- a/src/main/java/io/github/punishmentsx/listeners/ChatListener.java +++ b/src/main/java/io/github/punishmentsx/listeners/ChatListener.java @@ -49,7 +49,7 @@ public void onPlayerChat(AsyncPlayerChatEvent event) { return; } - if (plugin.getConfig().getBoolean("FILTER.ENABLED")) { + if (plugin.getConfig().getBoolean("FILTER.ENABLED") && !player.hasPermission(plugin.getConfig().getString("PERMISSIONS.BYPASS_FILTER"))) { if (plugin.getConfig().getBoolean("FILTER.BLOCK_UNICODE")) { if (Arrays.stream(event.getMessage().split("")).map(isInvalid::matcher).anyMatch(Matcher::matches)) { event.setCancelled(true); diff --git a/src/main/java/io/github/punishmentsx/menus/PunishMenu.java b/src/main/java/io/github/punishmentsx/menus/PunishMenu.java index 0d28b18..9a289b1 100644 --- a/src/main/java/io/github/punishmentsx/menus/PunishMenu.java +++ b/src/main/java/io/github/punishmentsx/menus/PunishMenu.java @@ -88,6 +88,9 @@ public void onUpdate(GUI gui) { for (String key : config.getConfigurationSection("MENUS.PUNISH.SLOTS").getKeys(false)) { ConfigurationSection section = config.getConfigurationSection("MENUS.PUNISH.SLOTS." + key); + + if (section.getString("PERMISSION") != null && !staff.hasPermission(section.getString("PERMISSION"))) continue; + gui.addButton(createButton(plugin, targetProfile, staff, notes, section)); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index f0c2582..7dbf159 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -165,6 +165,7 @@ MESSAGES: PERMISSIONS: SILENT_VIEW: "punishments.view.silent" #See silent punishments in chat & see hover of public punishments + BYPASS_FILTER: "punishments.filter.bypass" HISTORY: "punishments.history" #/history PUNISH: "punishments.punish" #/punish, /cmdpunish UNPUNISH: "punishments.unpunish" #/unban, /unmute @@ -178,6 +179,7 @@ MENUS: NAME: "&c&lCheats" # Name in GUI MATERIAL: "DIAMOND_SWORD" # Material in GUI DEFAULT_REASON: "Cheating" # Reason if none is specified in punish command + PERMISSION: "punishments.general" PUNISHMENTS: - "ban:30d" # 1st offense - "ban:90d" # 2nd offense @@ -195,6 +197,7 @@ MENUS: NAME: "&c&lSpamming" MATERIAL: "PAPER" DEFAULT_REASON: "Spamming" + PERMISSION: "punishments.general" PUNISHMENTS: - "mute:30m" - "mute:1d" @@ -215,6 +218,7 @@ MENUS: NAME: "&c&lFoul Language" MATERIAL: "BOOK" DEFAULT_REASON: "Foul Language" + PERMISSION: "punishments.general" PUNISHMENTS: - "mute:1d" - "mute:7d" @@ -235,6 +239,7 @@ MENUS: NAME: "&c&lAdvertising" MATERIAL: "GOLD_SWORD" DEFAULT_REASON: "Advertising" + PERMISSION: "punishments.general" PUNISHMENTS: - "mute:30d" - "mute:90d"