mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-02 01:46:45 +01:00
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:
parent
a77a916fcc
commit
d34a0cca30
@ -9,18 +9,12 @@ import org.bukkit.command.TabExecutor;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
public class McpurgeCommand implements TabExecutor {
|
public class McpurgeCommand implements TabExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (!Permissions.mcpurge(sender)) {
|
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
mcMMO.getDatabaseManager().purgePowerlessUsers();
|
mcMMO.getDatabaseManager().purgePowerlessUsers();
|
||||||
|
@ -12,7 +12,6 @@ import org.bukkit.util.StringUtil;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
@ -21,11 +20,6 @@ import com.google.common.collect.ImmutableList;
|
|||||||
public class McremoveCommand implements TabExecutor {
|
public class McremoveCommand implements TabExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (!Permissions.mcremove(sender)) {
|
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
if (UserManager.getPlayer(args[0]) == null && CommandUtils.unloadedProfile(sender, new PlayerProfile(args[0], false))) {
|
if (UserManager.getPlayer(args[0]) == null && CommandUtils.unloadedProfile(sender, new PlayerProfile(args[0], false))) {
|
||||||
|
@ -11,7 +11,6 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.runnables.database.SQLConversionTask;
|
import com.gmail.nossr50.runnables.database.SQLConversionTask;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@ -19,11 +18,6 @@ import com.google.common.collect.ImmutableList;
|
|||||||
public class MmoupdateCommand implements TabExecutor {
|
public class MmoupdateCommand implements TabExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
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()) {
|
if (!Config.getInstance().getUseMySQL()) {
|
||||||
sender.sendMessage("SQL Mode is not enabled."); // TODO: Localize
|
sender.sendMessage("SQL Mode is not enabled."); // TODO: Localize
|
||||||
return true;
|
return true;
|
||||||
|
@ -140,5 +140,4 @@ public final class MobHealthbarUtils {
|
|||||||
|
|
||||||
return healthbar;
|
return healthbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -256,6 +256,7 @@ public final class CommandRegistrationManager {
|
|||||||
private static void registerMcpurgeCommand() {
|
private static void registerMcpurgeCommand() {
|
||||||
PluginCommand command = mcMMO.p.getCommand("mcpurge");
|
PluginCommand command = mcMMO.p.getCommand("mcpurge");
|
||||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcpurge", Config.getInstance().getOldUsersCutoff()));
|
command.setDescription(LocaleLoader.getString("Commands.Description.mcpurge", Config.getInstance().getOldUsersCutoff()));
|
||||||
|
command.setPermission("mcmmo.commands.mcpurge");
|
||||||
command.setPermissionMessage(permissionsMessage);
|
command.setPermissionMessage(permissionsMessage);
|
||||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcpurge"));
|
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcpurge"));
|
||||||
command.setExecutor(new McpurgeCommand());
|
command.setExecutor(new McpurgeCommand());
|
||||||
@ -264,6 +265,7 @@ public final class CommandRegistrationManager {
|
|||||||
private static void registerMcremoveCommand() {
|
private static void registerMcremoveCommand() {
|
||||||
PluginCommand command = mcMMO.p.getCommand("mcremove");
|
PluginCommand command = mcMMO.p.getCommand("mcremove");
|
||||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcremove"));
|
command.setDescription(LocaleLoader.getString("Commands.Description.mcremove"));
|
||||||
|
command.setPermission("mcmmo.commands.mcremove");
|
||||||
command.setPermissionMessage(permissionsMessage);
|
command.setPermissionMessage(permissionsMessage);
|
||||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcremove", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcremove", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||||
command.setExecutor(new McremoveCommand());
|
command.setExecutor(new McremoveCommand());
|
||||||
@ -272,6 +274,7 @@ public final class CommandRegistrationManager {
|
|||||||
private static void registerMmoupdateCommand() {
|
private static void registerMmoupdateCommand() {
|
||||||
PluginCommand command = mcMMO.p.getCommand("mmoupdate");
|
PluginCommand command = mcMMO.p.getCommand("mmoupdate");
|
||||||
command.setDescription(LocaleLoader.getString("Commands.Description.mmoupdate"));
|
command.setDescription(LocaleLoader.getString("Commands.Description.mmoupdate"));
|
||||||
|
command.setPermission("mcmmo.commands.mmoupdate");
|
||||||
command.setPermissionMessage(permissionsMessage);
|
command.setPermissionMessage(permissionsMessage);
|
||||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mmoupdate"));
|
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mmoupdate"));
|
||||||
command.setExecutor(new MmoupdateCommand());
|
command.setExecutor(new MmoupdateCommand());
|
||||||
|
@ -695,11 +695,14 @@ permissions:
|
|||||||
mcmmo.commands.mcability.others: true
|
mcmmo.commands.mcability.others: true
|
||||||
mcmmo.commands.mcgod: true
|
mcmmo.commands.mcgod: true
|
||||||
mcmmo.commands.mcgod.others: true
|
mcmmo.commands.mcgod.others: true
|
||||||
|
mcmmo.commands.mcpurge: true
|
||||||
mcmmo.commands.mcrank.others.all: true
|
mcmmo.commands.mcrank.others.all: true
|
||||||
mcmmo.commands.mcrefresh: true
|
mcmmo.commands.mcrefresh: true
|
||||||
mcmmo.commands.mcrefresh.others: true
|
mcmmo.commands.mcrefresh.others: true
|
||||||
|
mcmmo.commands.mcremove: true
|
||||||
mcmmo.commands.mmoedit: true
|
mcmmo.commands.mmoedit: true
|
||||||
mcmmo.commands.mmoedit.others: true
|
mcmmo.commands.mmoedit.others: true
|
||||||
|
mcmmo.commands.mmoupdate: true
|
||||||
mcmmo.commands.ptp.world.all: true
|
mcmmo.commands.ptp.world.all: true
|
||||||
mcmmo.commands.skillreset.all: true
|
mcmmo.commands.skillreset.all: true
|
||||||
mcmmo.commands.vampirism.all: true
|
mcmmo.commands.vampirism.all: true
|
||||||
@ -796,7 +799,6 @@ permissions:
|
|||||||
mcmmo.commands.mcnotify:
|
mcmmo.commands.mcnotify:
|
||||||
description: Allows access to the mcnotify command
|
description: Allows access to the mcnotify command
|
||||||
mcmmo.commands.mcpurge:
|
mcmmo.commands.mcpurge:
|
||||||
default: false
|
|
||||||
description: Allows access to the mcpurge command
|
description: Allows access to the mcpurge command
|
||||||
mcmmo.commands.mcrank:
|
mcmmo.commands.mcrank:
|
||||||
description: Allows access to the mcrank command
|
description: Allows access to the mcrank command
|
||||||
@ -822,7 +824,6 @@ permissions:
|
|||||||
mcmmo.commands.mcrefresh.others:
|
mcmmo.commands.mcrefresh.others:
|
||||||
description: Allows access to the mcrefresh command for other players
|
description: Allows access to the mcrefresh command for other players
|
||||||
mcmmo.commands.mcremove:
|
mcmmo.commands.mcremove:
|
||||||
default: false
|
|
||||||
description: Allows access to the mcremove command
|
description: Allows access to the mcremove command
|
||||||
mcmmo.commands.mcscoreboard:
|
mcmmo.commands.mcscoreboard:
|
||||||
description: Allows access to the mcscoreboard command
|
description: Allows access to the mcscoreboard command
|
||||||
@ -885,7 +886,6 @@ permissions:
|
|||||||
mcmmo.commands.mmoedit.others:
|
mcmmo.commands.mmoedit.others:
|
||||||
description: Allows access to the mmoedit command for other players
|
description: Allows access to the mmoedit command for other players
|
||||||
mcmmo.commands.mmoupdate:
|
mcmmo.commands.mmoupdate:
|
||||||
default: false
|
|
||||||
description: Allows access to the mmoupdate command
|
description: Allows access to the mmoupdate command
|
||||||
mcmmo.commands.mobhealth:
|
mcmmo.commands.mobhealth:
|
||||||
default: true
|
default: true
|
||||||
|
Loading…
Reference in New Issue
Block a user