From d34a0cca30fe1bc9a41b9bcbde24ef2500f5e9f2 Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 1 May 2013 08:40:01 -0400 Subject: [PATCH] Fix issue with using /mcpurge, /mcremove, and /mmoupdate from the console. These commands now default to OP, because frankly there are much worse things someone can do with OP status than mess with the mcMMO database. --- .../com/gmail/nossr50/commands/database/McpurgeCommand.java | 6 ------ .../gmail/nossr50/commands/database/McremoveCommand.java | 6 ------ .../gmail/nossr50/commands/database/MmoupdateCommand.java | 6 ------ src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java | 1 - .../nossr50/util/commands/CommandRegistrationManager.java | 3 +++ src/main/resources/plugin.yml | 6 +++--- 6 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java b/src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java index 13f49169f..6b9ed05d1 100644 --- a/src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java @@ -9,18 +9,12 @@ import org.bukkit.command.TabExecutor; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.util.Permissions; import com.google.common.collect.ImmutableList; public class McpurgeCommand implements TabExecutor { @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: mcMMO.getDatabaseManager().purgePowerlessUsers(); diff --git a/src/main/java/com/gmail/nossr50/commands/database/McremoveCommand.java b/src/main/java/com/gmail/nossr50/commands/database/McremoveCommand.java index dbf648270..fab2166a6 100644 --- a/src/main/java/com/gmail/nossr50/commands/database/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/database/McremoveCommand.java @@ -12,7 +12,6 @@ import org.bukkit.util.StringUtil; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.player.UserManager; @@ -21,11 +20,6 @@ import com.google.common.collect.ImmutableList; public class McremoveCommand implements TabExecutor { @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: if (UserManager.getPlayer(args[0]) == null && CommandUtils.unloadedProfile(sender, new PlayerProfile(args[0], false))) { diff --git a/src/main/java/com/gmail/nossr50/commands/database/MmoupdateCommand.java b/src/main/java/com/gmail/nossr50/commands/database/MmoupdateCommand.java index 03bc6665e..cf76ee675 100644 --- a/src/main/java/com/gmail/nossr50/commands/database/MmoupdateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/database/MmoupdateCommand.java @@ -11,7 +11,6 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.runnables.database.SQLConversionTask; -import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.player.UserManager; import com.google.common.collect.ImmutableList; @@ -19,11 +18,6 @@ import com.google.common.collect.ImmutableList; public class MmoupdateCommand implements TabExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (!Permissions.mmoupdate(sender)) { - sender.sendMessage(command.getPermissionMessage()); - return true; - } - if (!Config.getInstance().getUseMySQL()) { sender.sendMessage("SQL Mode is not enabled."); // TODO: Localize return true; diff --git a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java index f014e2c40..5845af8d8 100644 --- a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java +++ b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java @@ -140,5 +140,4 @@ public final class MobHealthbarUtils { return healthbar; } - } diff --git a/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java b/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java index e76def853..611163aed 100644 --- a/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java +++ b/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java @@ -256,6 +256,7 @@ public final class CommandRegistrationManager { private 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()); @@ -264,6 +265,7 @@ public final class CommandRegistrationManager { private 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()); @@ -272,6 +274,7 @@ public final class CommandRegistrationManager { private 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/resources/plugin.yml b/src/main/resources/plugin.yml index abed68b9d..c04a134fc 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -695,11 +695,14 @@ permissions: mcmmo.commands.mcability.others: true mcmmo.commands.mcgod: true mcmmo.commands.mcgod.others: true + mcmmo.commands.mcpurge: true mcmmo.commands.mcrank.others.all: true mcmmo.commands.mcrefresh: true mcmmo.commands.mcrefresh.others: true + mcmmo.commands.mcremove: true mcmmo.commands.mmoedit: true mcmmo.commands.mmoedit.others: true + mcmmo.commands.mmoupdate: true mcmmo.commands.ptp.world.all: true mcmmo.commands.skillreset.all: true mcmmo.commands.vampirism.all: true @@ -796,7 +799,6 @@ permissions: mcmmo.commands.mcnotify: description: Allows access to the mcnotify command mcmmo.commands.mcpurge: - default: false description: Allows access to the mcpurge command mcmmo.commands.mcrank: description: Allows access to the mcrank command @@ -822,7 +824,6 @@ permissions: mcmmo.commands.mcrefresh.others: description: Allows access to the mcrefresh command for other players mcmmo.commands.mcremove: - default: false description: Allows access to the mcremove command mcmmo.commands.mcscoreboard: description: Allows access to the mcscoreboard command @@ -885,7 +886,6 @@ permissions: mcmmo.commands.mmoedit.others: description: Allows access to the mmoedit command for other players mcmmo.commands.mmoupdate: - default: false description: Allows access to the mmoupdate command mcmmo.commands.mobhealth: default: true