diff --git a/src/main/java/org/shanerx/tradeshop/commands/CommandRunner.java b/src/main/java/org/shanerx/tradeshop/commands/CommandRunner.java index 3d0fa48f..b95980bf 100644 --- a/src/main/java/org/shanerx/tradeshop/commands/CommandRunner.java +++ b/src/main/java/org/shanerx/tradeshop/commands/CommandRunner.java @@ -566,7 +566,7 @@ public void open() { if (!(shop.getOwner().getUUID().equals(pSender.getUniqueId()) || shop.getManagersUUID().contains(pSender.getUniqueId()) || Permissions.hasPermission(pSender, Permissions.ADMIN))) { - sendMessage(Message.NO_EDIT.getPrefixed()); + sendMessage(Message.NO_SHOP_PERMISSION.getPrefixed()); return; } @@ -603,7 +603,7 @@ public void close() { if (!(shop.getOwner().getUUID().equals(pSender.getUniqueId()) || shop.getManagersUUID().contains(pSender.getUniqueId()) || Permissions.hasPermission(pSender, Permissions.ADMIN))) { - sendMessage(Message.NO_EDIT.getPrefixed()); + sendMessage(Message.NO_SHOP_PERMISSION.getPrefixed()); return; } @@ -626,8 +626,26 @@ public void switchShop() { if (shop == null) return; + if (!Permissions.hasPermission(pSender, Permissions.EDIT)) { + sendMessage(Message.NO_COMMAND_PERMISSION.getPrefixed()); + return; + } + + switch (shop.getShopType()) { + case TRADE: + if (!Permissions.hasPermission(pSender, Permissions.CREATEBI)) { + sendMessage(Message.NO_COMMAND_PERMISSION.getPrefixed()); + return; + } + case BITRADE: + if (!Permissions.hasPermission(pSender, Permissions.CREATE)) { + sendMessage(Message.NO_COMMAND_PERMISSION.getPrefixed()); + return; + } + } + if (!(shop.getOwner().getUUID().equals(pSender.getUniqueId()) || shop.getManagersUUID().contains(pSender.getUniqueId()))) { - sendMessage(Message.NO_EDIT.getPrefixed()); + sendMessage(Message.NO_SHOP_PERMISSION.getPrefixed()); return; } diff --git a/src/main/java/org/shanerx/tradeshop/commands/EditCommand.java b/src/main/java/org/shanerx/tradeshop/commands/EditCommand.java index ffe68060..238751b6 100644 --- a/src/main/java/org/shanerx/tradeshop/commands/EditCommand.java +++ b/src/main/java/org/shanerx/tradeshop/commands/EditCommand.java @@ -78,10 +78,15 @@ public void edit() { if (shop == null) return; + if (!Permissions.hasPermission(pSender, Permissions.EDIT)) { + sendMessage(Message.NO_COMMAND_PERMISSION.getPrefixed()); + return; + } + if (!(shop.getOwner().getUUID().equals(pSender.getUniqueId()) || shop.getManagersUUID().contains(pSender.getUniqueId()) || Permissions.hasPermission(pSender, Permissions.ADMIN))) { - sendMessage(Message.NO_EDIT.getPrefixed()); + sendMessage(Message.NO_SHOP_PERMISSION.getPrefixed()); return; } diff --git a/src/main/java/org/shanerx/tradeshop/commands/WhatCommand.java b/src/main/java/org/shanerx/tradeshop/commands/WhatCommand.java index e3f8ced7..8c38bab1 100644 --- a/src/main/java/org/shanerx/tradeshop/commands/WhatCommand.java +++ b/src/main/java/org/shanerx/tradeshop/commands/WhatCommand.java @@ -34,9 +34,7 @@ import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.Damageable; import org.shanerx.tradeshop.TradeShop; -import org.shanerx.tradeshop.enumys.Setting; -import org.shanerx.tradeshop.enumys.ShopItemStackSettingKeys; -import org.shanerx.tradeshop.enumys.ShopType; +import org.shanerx.tradeshop.enumys.*; import org.shanerx.tradeshop.objects.Shop; import org.shanerx.tradeshop.objects.ShopItemStack; @@ -55,6 +53,11 @@ public void what() { if (shop == null) return; + if (!Permissions.hasPermission(pSender, Permissions.INFO)) { + sendMessage(Message.NO_COMMAND_PERMISSION.getPrefixed()); + return; + } + InventoryGui gui = new InventoryGui(plugin, colorize(shop.getShopType() == ShopType.ITRADE ? Setting.ITRADESHOP_OWNER.getString() : Bukkit.getOfflinePlayer(shop.getOwner().getUUID()).getName() + "'s Shop"), diff --git a/src/main/java/org/shanerx/tradeshop/enumys/Message.java b/src/main/java/org/shanerx/tradeshop/enumys/Message.java index c1471127..56a0ebd7 100644 --- a/src/main/java/org/shanerx/tradeshop/enumys/Message.java +++ b/src/main/java/org/shanerx/tradeshop/enumys/Message.java @@ -72,7 +72,6 @@ public enum Message { MULTI_UPDATE(MessageSectionKeys.NONE, "&aTrade multiplier has been updated to %amount%."), NO_CHEST(MessageSectionKeys.NONE, "&cYou need to put a chest under the sign!", "Text to display when a player attempts to place a sign without placing the chest first:"), NO_COMMAND_PERMISSION(MessageSectionKeys.NONE, "&aYou do not have permission to execute this command", "Text to display when a player attempts to run administrator commands:"), - NO_EDIT(MessageSectionKeys.NONE, "&cYou do not have permission to edit this shop."), NO_SHOP_PERMISSION(MessageSectionKeys.NONE, "&cYou do not have permission to edit that shop."), NO_SIGHTED_SHOP(MessageSectionKeys.NONE, "&cNo shop in range!", "Text to display when a player is too far from a shop"), NO_TS_CREATE_PERMISSION(MessageSectionKeys.NONE, "&cYou don't have permission to create TradeShops!", "Text to display when a player attempts to setup a shoptype they are not allowed to create:"),