diff --git a/src/main/java/com/gmail/nossr50/commands/CommandRegistrationHelper.java b/src/main/java/com/gmail/nossr50/commands/CommandRegistrationHelper.java index 19dd617ac..7664f3667 100644 --- a/src/main/java/com/gmail/nossr50/commands/CommandRegistrationHelper.java +++ b/src/main/java/com/gmail/nossr50/commands/CommandRegistrationHelper.java @@ -253,7 +253,6 @@ public final class CommandRegistrationHelper { public static void registerMcpurgeCommand() { PluginCommand command = mcMMO.p.getCommand("mcpurge"); command.setDescription(LocaleLoader.getString("Commands.Description.mcpurge", Config.getInstance().getOldUsersCutoff())); - command.setPermission("mcmmo.commands.mcpurge"); command.setPermissionMessage(permissionsMessage); command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcpurge")); command.setExecutor(new McpurgeCommand()); @@ -262,7 +261,6 @@ public final class CommandRegistrationHelper { public static void registerMcremoveCommand() { PluginCommand command = mcMMO.p.getCommand("mcremove"); command.setDescription(LocaleLoader.getString("Commands.Description.mcremove")); - command.setPermission("mcmmo.commands.mcremove"); command.setPermissionMessage(permissionsMessage); command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcremove", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">")); command.setExecutor(new McremoveCommand()); @@ -271,7 +269,6 @@ public final class CommandRegistrationHelper { public static void registerMmoupdateCommand() { PluginCommand command = mcMMO.p.getCommand("mmoupdate"); command.setDescription(LocaleLoader.getString("Commands.Description.mmoupdate")); - command.setPermission("mcmmo.commands.mmoupdate"); command.setPermissionMessage(permissionsMessage); command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mmoupdate")); command.setExecutor(new MmoupdateCommand()); diff --git a/src/main/java/com/gmail/nossr50/database/commands/McpurgeCommand.java b/src/main/java/com/gmail/nossr50/database/commands/McpurgeCommand.java index ab7a88d84..a4738d10a 100644 --- a/src/main/java/com/gmail/nossr50/database/commands/McpurgeCommand.java +++ b/src/main/java/com/gmail/nossr50/database/commands/McpurgeCommand.java @@ -8,10 +8,16 @@ import com.gmail.nossr50.config.Config; import com.gmail.nossr50.database.Database; import com.gmail.nossr50.database.Leaderboard; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.util.Permissions; public class McpurgeCommand implements CommandExecutor{ @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!Permissions.mcpurge(sender)) { + sender.sendMessage(command.getPermissionMessage()); + return true; + } + switch (args.length) { case 0: if (Config.getInstance().getUseMySQL()) { diff --git a/src/main/java/com/gmail/nossr50/database/commands/McremoveCommand.java b/src/main/java/com/gmail/nossr50/database/commands/McremoveCommand.java index 41e383208..62f7f02c4 100644 --- a/src/main/java/com/gmail/nossr50/database/commands/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/database/commands/McremoveCommand.java @@ -8,10 +8,16 @@ import com.gmail.nossr50.config.Config; import com.gmail.nossr50.database.Database; import com.gmail.nossr50.database.Leaderboard; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.util.Permissions; public class McremoveCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!Permissions.mcremove(sender)) { + sender.sendMessage(command.getPermissionMessage()); + return true; + } + switch (args.length) { case 1: /* MySQL */ diff --git a/src/main/java/com/gmail/nossr50/database/commands/MmoupdateCommand.java b/src/main/java/com/gmail/nossr50/database/commands/MmoupdateCommand.java index 5bf0be742..097c2fcaf 100644 --- a/src/main/java/com/gmail/nossr50/database/commands/MmoupdateCommand.java +++ b/src/main/java/com/gmail/nossr50/database/commands/MmoupdateCommand.java @@ -9,11 +9,17 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.database.runnables.SQLConversionTask; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Users; public class MmoupdateCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!Permissions.mmoupdate(sender)) { + sender.sendMessage(command.getPermissionMessage()); + return true; + } + switch (args.length) { case 0: sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Start")); diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index b9371a0d1..bf687c293 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -83,6 +83,10 @@ public final class Permissions { public static boolean vampirismModify(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.vampirism.modify"); } public static boolean vampirismToggle(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.vampirism.toggle"); } + public static boolean mcpurge(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mcpurge"); } + public static boolean mcremove(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mcremove"); } + public static boolean mmoupdate(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mmoupdate"); } + /* * PERKS */