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.
This commit is contained in:
GJ 2013-05-01 08:40:01 -04:00
parent a77a916fcc
commit d34a0cca30
6 changed files with 6 additions and 22 deletions

View File

@ -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();

View File

@ -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))) {

View File

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

View File

@ -140,5 +140,4 @@ public final class MobHealthbarUtils {
return healthbar;
}
}

View File

@ -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());

View File

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