From 1cb9f93f0e30fb5efd64a7f505f9b2004ed16928 Mon Sep 17 00:00:00 2001 From: "U-YUE\\Sean" Date: Wed, 30 Jan 2013 11:10:19 -0800 Subject: [PATCH] Added permissions to the /xprate command. --- .../nossr50/commands/general/XprateCommand.java | 11 ++++++++++- src/main/resources/plugin.yml | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java index 167a7ac77..d533d5c7b 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java @@ -20,7 +20,9 @@ public class XprateCommand implements CommandExecutor { String usage2 = LocaleLoader.getString("Commands.xprate.proper.1"); String usage3 = LocaleLoader.getString("Commands.xprate.proper.2"); - if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) { + // DEPRECATED PERMISSION + boolean oldPermission = !CommandHelper.noCommandPermissions(sender, "mcmmo.admin"); + if (!oldPermission && CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate")) { return true; } @@ -29,6 +31,10 @@ public class XprateCommand implements CommandExecutor { switch (args.length) { case 1: if (args[0].equalsIgnoreCase("reset")) { + if (!oldPermission && CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate.reset")) { + return true; + } + if (xpEventEnabled) { for (Player x : mcMMO.p.getServer().getOnlinePlayers()) { x.sendMessage(LocaleLoader.getString("Commands.xprate.over")); @@ -52,6 +58,9 @@ public class XprateCommand implements CommandExecutor { case 2: if (Misc.isInt(args[0])) { + if (!oldPermission && CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate.set")) { + return true; + } if (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) { mcMMO.p.setXPEventEnabled(Boolean.valueOf(args[1])); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5665a957b..e7803b738 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -712,6 +712,7 @@ permissions: mcmmo.commands.mmoedit.others: true mcmmo.commands.mmoupdate: true mcmmo.commands.skillreset.all: true + mcmmo.commands.xprate: true mcmmo.commands.defaults: description: Implies all default mcmmo.commands permissions. children: @@ -907,6 +908,22 @@ permissions: description: Allows access to the skillreset command for unarmed mcmmo.commands.skillreset.woodcutting: description: Allows access to the skillreset command for woodcutting + mcmmo.commands.xprate.*: + description: Implies access to all mcmmo.commands.inspect permissions + children: + mcmmo.commands.xprate.all: true + mcmmo.commands.xprate.all: + description: Implies access to all mcmmo.commands.inspect permissions + children: + mcmmo.commands.xprate: true + mcmmo.commands.xprate.reset: true + mcmmo.commands.xprate.set: true + mcmmo.commands.xprate: + description: Allows access to the xprate command + mcmmo.commands.xprate.reset: + description: Allows access to the xprate reset command + mcmmo.commands.xprate.set: + description: Allows access to the xprate command to control xp events mcmmo.chat.*: description: Implies all mcmmo.chat permissions. (Warning, contains adminchat) children: