Add permission check to a shop create func (#194)

This commit is contained in:
ken_kentan 2018-07-21 21:04:26 +09:00 committed by EpicEric
parent 57d204dda6
commit 47b23f126e

View File

@ -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) { 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..."); 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; 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); Shop shop = new Shop(plugin, executor, product, location, buyPrice, sellPrice, shopType);