Added the other permissions nodes. Addresses #628

This commit is contained in:
GJ 2013-02-04 15:10:07 -05:00
parent bb945a765c
commit 717a258430
7 changed files with 44 additions and 8 deletions

View File

@ -119,7 +119,7 @@ public final class CommandRegistrationHelper {
public static void registerAddlevelsCommand() { public static void registerAddlevelsCommand() {
PluginCommand command = mcMMO.p.getCommand("addlevels"); PluginCommand command = mcMMO.p.getCommand("addlevels");
command.setDescription(LocaleLoader.getString("Commands.Description.addlevels")); command.setDescription(LocaleLoader.getString("Commands.Description.addlevels"));
command.setPermission("mcmmo.commands.addlevels"); command.setPermission("mcmmo.commands.addlevels;mcmmo.commands.addlevels.others");
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addlevels", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">")); command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addlevels", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">"));
command.setExecutor(new AddlevelsCommand()); command.setExecutor(new AddlevelsCommand());
@ -128,7 +128,7 @@ public final class CommandRegistrationHelper {
public static void registerAddxpCommand() { public static void registerAddxpCommand() {
PluginCommand command = mcMMO.p.getCommand("addxp"); PluginCommand command = mcMMO.p.getCommand("addxp");
command.setDescription(LocaleLoader.getString("Commands.Description.addxp")); command.setDescription(LocaleLoader.getString("Commands.Description.addxp"));
command.setPermission("mcmmo.commands.addxp"); command.setPermission("mcmmo.commands.addxp;mcmmo.commands.addxp.others");
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addxp", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.XP") + ">")); command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addxp", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.XP") + ">"));
command.setExecutor(new AddxpCommand()); command.setExecutor(new AddxpCommand());
@ -137,7 +137,7 @@ public final class CommandRegistrationHelper {
public static void registerMcgodCommand() { public static void registerMcgodCommand() {
PluginCommand command = mcMMO.p.getCommand("mcgod"); PluginCommand command = mcMMO.p.getCommand("mcgod");
command.setDescription(LocaleLoader.getString("Commands.Description.mcgod")); command.setDescription(LocaleLoader.getString("Commands.Description.mcgod"));
command.setPermission("mcmmo.commands.mcgod"); command.setPermission("mcmmo.commands.mcgod;mcmmo.commands.mcgod.others");
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcgod", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]")); command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcgod", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McgodCommand()); command.setExecutor(new McgodCommand());
@ -146,7 +146,7 @@ public final class CommandRegistrationHelper {
public static void registerMcrefreshCommand() { public static void registerMcrefreshCommand() {
PluginCommand command = mcMMO.p.getCommand("mcrefresh"); PluginCommand command = mcMMO.p.getCommand("mcrefresh");
command.setDescription(LocaleLoader.getString("Commands.Description.mcrefresh")); command.setDescription(LocaleLoader.getString("Commands.Description.mcrefresh"));
command.setPermission("mcmmo.commands.mcrefresh"); command.setPermission("mcmmo.commands.mcrefresh;mcmmo.commands.mcrefresh.others");
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcrefresh", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]")); command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcrefresh", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McrefreshCommand()); command.setExecutor(new McrefreshCommand());
@ -155,7 +155,7 @@ public final class CommandRegistrationHelper {
public static void registerMmoeditCommand() { public static void registerMmoeditCommand() {
PluginCommand command = mcMMO.p.getCommand("mmoedit"); PluginCommand command = mcMMO.p.getCommand("mmoedit");
command.setDescription(LocaleLoader.getString("Commands.Description.mmoedit")); command.setDescription(LocaleLoader.getString("Commands.Description.mmoedit"));
command.setPermission("mcmmo.commands.mmoedit"); command.setPermission("mcmmo.commands.mmoedit;mcmmo.commands.mmoedit.others");
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "mmoedit", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">")); command.setUsage(LocaleLoader.getString("Commands.Usage.3", "mmoedit", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">"));
command.setExecutor(new MmoeditCommand()); command.setExecutor(new MmoeditCommand());
@ -164,7 +164,7 @@ public final class CommandRegistrationHelper {
public static void registerSkillresetCommand() { public static void registerSkillresetCommand() {
PluginCommand command = mcMMO.p.getCommand("skillreset"); PluginCommand command = mcMMO.p.getCommand("skillreset");
command.setDescription(LocaleLoader.getString("Commands.Description.skillreset")); command.setDescription(LocaleLoader.getString("Commands.Description.skillreset"));
command.setPermission("mcmmo.commands.skillreset"); command.setPermission("mcmmo.commands.skillreset;mcmmo.commands.skillreset.others"); // Only need the main ones, not the individual skill ones
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "skillreset", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">")); command.setUsage(LocaleLoader.getString("Commands.Usage.2", "skillreset", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">"));
command.setExecutor(new SkillresetCommand()); command.setExecutor(new SkillresetCommand());

View File

@ -23,6 +23,11 @@ public class AddlevelsCommand implements CommandExecutor{
switch (args.length) { switch (args.length) {
case 2: case 2:
if (!Permissions.hasPermission(sender, "mcmmo.commands.addlevels")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
return false; return false;
} }

View File

@ -24,6 +24,11 @@ public class AddxpCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 2: case 2:
if (!Permissions.hasPermission(sender, "mcmmo.commands.addxp")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
return false; return false;
} }

View File

@ -18,6 +18,11 @@ public class McgodCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 0: case 0:
if (!Permissions.hasPermission(sender, "mcmmo.commands.mcgod")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
return false; return false;
} }

View File

@ -18,6 +18,11 @@ public class McrefreshCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 0: case 0:
if (!Permissions.hasPermission(sender, "mcmmo.commands.mcrefresh")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
return false; return false;
} }
@ -29,6 +34,7 @@ public class McrefreshCommand implements CommandExecutor {
case 1: case 1:
if (!Permissions.hasPermission(sender, "mcmmo.commands.mcrefresh.others")) { if (!Permissions.hasPermission(sender, "mcmmo.commands.mcrefresh.others")) {
sender.sendMessage(command.getPermissionMessage()); sender.sendMessage(command.getPermissionMessage());
return true;
} }
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]); McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);

View File

@ -23,6 +23,11 @@ public class MmoeditCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 2: case 2:
if (!Permissions.hasPermission(sender, "mcmmo.commands.mmoedit")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
return false; return false;
} }

View File

@ -22,6 +22,11 @@ public class SkillresetCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 1: case 1:
if (!Permissions.hasPermission(sender, "mcmmo.commands.skillreset")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
return false; return false;
} }
@ -74,6 +79,11 @@ public class SkillresetCommand implements CommandExecutor {
return true; return true;
case 2: case 2:
if (!Permissions.hasPermission(sender, "mcmmo.commands.skillreset.others")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
allSkills = true; allSkills = true;
} }
@ -88,14 +98,14 @@ public class SkillresetCommand implements CommandExecutor {
continue; continue;
} }
if (!Permissions.hasPermission(sender, "mcmmo.commands.skillreset." + args[1].toLowerCase())) { if (!Permissions.hasPermission(sender, "mcmmo.commands.skillreset.others." + args[1].toLowerCase())) {
sender.sendMessage(command.getPermissionMessage()); sender.sendMessage(command.getPermissionMessage());
return true; return true;
} }
} }
} }
else { else {
if (!Permissions.hasPermission(sender, "mcmmo.commands.skillreset." + args[1].toLowerCase())) { if (!Permissions.hasPermission(sender, "mcmmo.commands.skillreset.others." + args[1].toLowerCase())) {
sender.sendMessage(command.getPermissionMessage()); sender.sendMessage(command.getPermissionMessage());
return true; return true;
} }