Added permissions to the /xprate command.

This commit is contained in:
U-YUE\Sean 2013-01-30 11:10:19 -08:00
parent 4a24ade442
commit 1cb9f93f0e
2 changed files with 27 additions and 1 deletions

View File

@ -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]));
}

View File

@ -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: