mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
Update /mmoupdate to use Bukkit CommandAPI. Addresses #628
This commit is contained in:
parent
84fb7eec36
commit
d0ca2b9d4b
@ -22,6 +22,7 @@ import com.gmail.nossr50.commands.player.MctopCommand;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.database.commands.McpurgeCommand;
|
import com.gmail.nossr50.database.commands.McpurgeCommand;
|
||||||
import com.gmail.nossr50.database.commands.McremoveCommand;
|
import com.gmail.nossr50.database.commands.McremoveCommand;
|
||||||
|
import com.gmail.nossr50.database.commands.MmoupdateCommand;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsCommand;
|
import com.gmail.nossr50.skills.acrobatics.AcrobaticsCommand;
|
||||||
import com.gmail.nossr50.skills.archery.ArcheryCommand;
|
import com.gmail.nossr50.skills.archery.ArcheryCommand;
|
||||||
@ -250,10 +251,19 @@ public final class CommandRegistrationHelper {
|
|||||||
|
|
||||||
public static void registerMcremoveCommand() {
|
public static void registerMcremoveCommand() {
|
||||||
PluginCommand command = mcMMO.p.getCommand("mcremove");
|
PluginCommand command = mcMMO.p.getCommand("mcremove");
|
||||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcremove", Config.getInstance().getOldUsersCutoff()));
|
command.setDescription(LocaleLoader.getString("Commands.Description.mcremove"));
|
||||||
command.setPermission("mcmmo.commands.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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.commands.CommandHelper;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.database.runnables.SQLConversionTask;
|
import com.gmail.nossr50.database.runnables.SQLConversionTask;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -15,21 +14,22 @@ import com.gmail.nossr50.util.Users;
|
|||||||
public class MmoupdateCommand implements CommandExecutor {
|
public class MmoupdateCommand implements CommandExecutor {
|
||||||
@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 (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mmoupdate")) {
|
switch (args.length) {
|
||||||
|
case 0:
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Start"));
|
||||||
|
Users.clearAll();
|
||||||
|
convertToMySQL();
|
||||||
|
|
||||||
|
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||||
|
Users.addUser(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Finish"));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Start"));
|
|
||||||
Users.clearAll();
|
|
||||||
convertToMySQL();
|
|
||||||
|
|
||||||
for (Player x : mcMMO.p.getServer().getOnlinePlayers()) {
|
|
||||||
Users.addUser(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Finish"));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,6 @@ import com.gmail.nossr50.config.HiddenConfig;
|
|||||||
import com.gmail.nossr50.config.TreasuresConfig;
|
import com.gmail.nossr50.config.TreasuresConfig;
|
||||||
import com.gmail.nossr50.database.Database;
|
import com.gmail.nossr50.database.Database;
|
||||||
import com.gmail.nossr50.database.Leaderboard;
|
import com.gmail.nossr50.database.Leaderboard;
|
||||||
import com.gmail.nossr50.database.commands.MmoupdateCommand;
|
|
||||||
import com.gmail.nossr50.database.runnables.UserPurgeTask;
|
import com.gmail.nossr50.database.runnables.UserPurgeTask;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.listeners.BlockListener;
|
import com.gmail.nossr50.listeners.BlockListener;
|
||||||
@ -305,7 +304,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
CommandRegistrationHelper.registerMmoeditCommand();
|
CommandRegistrationHelper.registerMmoeditCommand();
|
||||||
CommandRegistrationHelper.registerInspectCommand();
|
CommandRegistrationHelper.registerInspectCommand();
|
||||||
CommandRegistrationHelper.registerXprateCommand();
|
CommandRegistrationHelper.registerXprateCommand();
|
||||||
getCommand("mmoupdate").setExecutor(new MmoupdateCommand());
|
CommandRegistrationHelper.registerMmoupdateCommand();
|
||||||
CommandRegistrationHelper.registerSkillresetCommand();
|
CommandRegistrationHelper.registerSkillresetCommand();
|
||||||
|
|
||||||
// Spout commands
|
// Spout commands
|
||||||
|
@ -702,6 +702,7 @@ Commands.Description.mcremove=Remove a user from the mcMMO database
|
|||||||
Commands.Description.mcstats=Show your mcMMO levels and XP
|
Commands.Description.mcstats=Show your mcMMO levels and XP
|
||||||
Commands.Description.mctop=Show mcMMO leader boards
|
Commands.Description.mctop=Show mcMMO leader boards
|
||||||
Commands.Description.mmoedit=Edit mcMMO levels for a user
|
Commands.Description.mmoedit=Edit mcMMO levels for a user
|
||||||
|
Commands.Description.mmoupdate=Convert mcMMO database from Flatfile to MySQL
|
||||||
Commands.Description.Skill=Display detailed mcMMO skill info for {0}
|
Commands.Description.Skill=Display detailed mcMMO skill info for {0}
|
||||||
Commands.Description.skillreset=Reset mcMMO levels for a user
|
Commands.Description.skillreset=Reset mcMMO levels for a user
|
||||||
Commands.Description.xprate=Modify the mcMMO XP rate or start an mcMMO XP event
|
Commands.Description.xprate=Modify the mcMMO XP rate or start an mcMMO XP event
|
||||||
|
@ -63,7 +63,6 @@ commands:
|
|||||||
inspect:
|
inspect:
|
||||||
description: View detailed mcMMO info on another player
|
description: View detailed mcMMO info on another player
|
||||||
mmoupdate:
|
mmoupdate:
|
||||||
aliases: []
|
|
||||||
description: Convert from Flat File to MySQL
|
description: Convert from Flat File to MySQL
|
||||||
p:
|
p:
|
||||||
aliases: [pc]
|
aliases: [pc]
|
||||||
|
Loading…
Reference in New Issue
Block a user