From 1a9193a5dcfd9aa785f73e73ab86ca8690301a4f Mon Sep 17 00:00:00 2001 From: Tomut0 Date: Sun, 23 Jul 2023 19:32:51 +0300 Subject: [PATCH] feat: hide reset kdr in main frame if perm denied --- .../phaed/simpleclans/ui/frames/MainFrame.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/sacredlabyrinth/phaed/simpleclans/ui/frames/MainFrame.java b/src/main/java/net/sacredlabyrinth/phaed/simpleclans/ui/frames/MainFrame.java index a9a9b1269..fac059856 100644 --- a/src/main/java/net/sacredlabyrinth/phaed/simpleclans/ui/frames/MainFrame.java +++ b/src/main/java/net/sacredlabyrinth/phaed/simpleclans/ui/frames/MainFrame.java @@ -87,19 +87,24 @@ private void addLanguageSelector() { } public void addResetKdr() { - List resetKrLore; + if (!plugin.getPermissionsManager().has(getViewer(), "simpleclans.vip.resetkdr")) { + return; + } + + List resetKdrLore; if (plugin.getSettingsManager().is(ECONOMY_PURCHASE_RESET_KDR)) { - resetKrLore = Arrays.asList( + resetKdrLore = Arrays.asList( lang("gui.main.reset.kdr.lore.price", getViewer(), plugin.getSettingsManager().getString(ECONOMY_RESET_KDR_PRICE)), lang("gui.main.reset.kdr.lore", getViewer())); } else { - resetKrLore = Collections.singletonList(lang("gui.main.reset.kdr.lore", getViewer())); + resetKdrLore = Collections.singletonList(lang("gui.main.reset.kdr.lore", getViewer())); } SCComponent resetKdr = new SCComponentImpl(lang("gui.main.reset.kdr.title", getViewer()), - resetKrLore, XMaterial.ANVIL, 5); + resetKdrLore, XMaterial.ANVIL, 5); resetKdr.setListener(ClickType.LEFT, () -> InventoryController.runSubcommand(getViewer(), "resetkdr", false)); resetKdr.setConfirmationRequired(ClickType.LEFT); resetKdr.setPermission(ClickType.LEFT, "simpleclans.vip.resetkdr"); + add(resetKdr); }