From 47b23f126e593fb0c60a4636cdb5e9e13c324b4c Mon Sep 17 00:00:00 2001 From: ken_kentan Date: Sat, 21 Jul 2018 21:04:26 +0900 Subject: [PATCH] Add permission check to a shop create func (#194) --- .../epiceric/shopchest/listeners/ShopInteractListener.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java index 482a570..054c2d5 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java @@ -725,6 +725,12 @@ public class ShopInteractListener implements Listener { private void create(final Player executor, final Location location, final ItemStack product, final double buyPrice, final double sellPrice, final ShopType shopType) { plugin.debug(executor.getName() + " is creating new shop..."); + if (!executor.hasPermission(Permissions.CREATE)) { + executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE)); + plugin.debug(executor.getName() + " is not permitted to create the shop"); + return; + } + double creationPrice = (shopType == ShopType.NORMAL) ? config.shop_creation_price_normal : config.shop_creation_price_admin; Shop shop = new Shop(plugin, executor, product, location, buyPrice, sellPrice, shopType);