From 8d190f93c03c5ef2e3c31f466c20a0bb08f2beb0 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 13 Apr 2016 21:05:21 +0200 Subject: [PATCH] Add permission to create an admin shop --- config.yml | 3 +++ plugin.yml | 5 +++++ src/de/epiceric/shopchest/Commands.java | 11 ++++++++--- src/de/epiceric/shopchest/config/Config.java | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/config.yml b/config.yml index 509c52d..90c3e9a 100644 --- a/config.yml +++ b/config.yml @@ -288,6 +288,9 @@ messages: # Set the message when a not permitted player tries to create an infinite shop. create-infinite: "&cYou don't have permission to create an infinite shop." + # Set the message when a not permitted player tries to create an admin shop. + create-admin: "&cYou don't have permission to create an admin shop." + # Set the message when a not permitted player tries to open another players' shop. open-others: "&cYou don't have permission to open this chest." diff --git a/plugin.yml b/plugin.yml index f7b89cc..20278f6 100644 --- a/plugin.yml +++ b/plugin.yml @@ -30,6 +30,11 @@ permissions: children: shopchest.create: true default: op + shopchest.create.admin: + description: Allows you to create an admin shop. + children: + shopchest.create: true + default: op shopchest.create.protected: description: Allows you to create a shop on a protected chest. children: diff --git a/src/de/epiceric/shopchest/Commands.java b/src/de/epiceric/shopchest/Commands.java index 3f1310c..4bfd337 100644 --- a/src/de/epiceric/shopchest/Commands.java +++ b/src/de/epiceric/shopchest/Commands.java @@ -89,9 +89,14 @@ public class Commands extends BukkitCommand { } else if (args[4].equalsIgnoreCase("admin")) { - create(args, ShopType.ADMIN, p); - return true; - + if (perm.has(p, "shopchest.create.admin")) { + create(args, ShopType.ADMIN, p); + return true; + } else { + p.sendMessage(Config.noPermission_createAdmin()); + return true; + } + } else { diff --git a/src/de/epiceric/shopchest/config/Config.java b/src/de/epiceric/shopchest/config/Config.java index d614823..98aca99 100644 --- a/src/de/epiceric/shopchest/config/Config.java +++ b/src/de/epiceric/shopchest/config/Config.java @@ -53,6 +53,7 @@ public class Config { public static String shopInfo_isAdmin() { return plugin.getConfig().getString("messages.shop-info.is-admin").replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");}; public static String noPermission_create() { return plugin.getConfig().getString("messages.no-permission.create").replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");} public static String noPermission_createInfinite() { return plugin.getConfig().getString("messages.no-permission.create-infinite").replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");} + public static String noPermission_createAdmin() { return plugin.getConfig().getString("messages.no-permission.create-admin").replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");} public static String noPermission_openOthers() { return plugin.getConfig().getString("messages.no-permission.open-others").replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");} public static String noPermission_removeOthers() { return plugin.getConfig().getString("messages.no-permission.remove-others").replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");} public static String noPermission_buy() { return plugin.getConfig().getString("messages.no-permission.buy").replaceAll("(&([a-f0-9k-or]))", "\u00A7$2");}