Implemented reload command
This commit is contained in:
parent
40c7ef95e5
commit
0781bc16d1
@ -121,7 +121,7 @@ public class CommandManager {
|
|||||||
"List Dungeon Mazes",
|
"List Dungeon Mazes",
|
||||||
"Lists the available Dungeon Maze worlds and shows some additional information.",
|
"Lists the available Dungeon Maze worlds and shows some additional information.",
|
||||||
dungeonMazeCommand);
|
dungeonMazeCommand);
|
||||||
listWorldCommand.setCommandPermissions("dungeonmaze.command.listworlds", CommandPermissions.DefaultPermission.OP_ONLY);
|
listWorldCommand.setCommandPermissions("dungeonmaze.command.listworlds", CommandPermissions.DefaultPermission.OP_ONLY);*/
|
||||||
|
|
||||||
// Register the reload command
|
// Register the reload command
|
||||||
CommandDescription reloadCommand = new CommandDescription(
|
CommandDescription reloadCommand = new CommandDescription(
|
||||||
@ -131,13 +131,12 @@ public class CommandManager {
|
|||||||
add("rld");
|
add("rld");
|
||||||
add("r");
|
add("r");
|
||||||
}},
|
}},
|
||||||
"Reload Dungeon Maze",
|
"Reload AuthMeReloaded",
|
||||||
"Reload the Dungeon Maze plugin.",
|
"Reload the AuthMeReloaded plugin.",
|
||||||
dungeonMazeCommand);
|
authMeCommand);
|
||||||
reloadCommand.setCommandPermissions("dungeonmaze.command.reload", CommandPermissions.DefaultPermission.OP_ONLY);
|
reloadCommand.setCommandPermissions("authme.admin.reload", CommandPermissions.DefaultPermission.OP_ONLY);
|
||||||
reloadCommand.addArgument(new CommandArgumentDescription("force", "True or False to force reload.", true));
|
|
||||||
|
|
||||||
// Register the reload permissions command
|
/* // Register the reload permissions command
|
||||||
CommandDescription reloadPermissionsCommand = new CommandDescription(
|
CommandDescription reloadPermissionsCommand = new CommandDescription(
|
||||||
new ReloadPermissionsCommand(),
|
new ReloadPermissionsCommand(),
|
||||||
new ArrayList<String>() {{
|
new ArrayList<String>() {{
|
||||||
|
|||||||
@ -0,0 +1,55 @@
|
|||||||
|
package fr.xephi.authme.command.executable;
|
||||||
|
|
||||||
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
|
import fr.xephi.authme.command.CommandParts;
|
||||||
|
import fr.xephi.authme.command.ExecutableCommand;
|
||||||
|
|
||||||
|
import fr.xephi.authme.settings.Messages;
|
||||||
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
import fr.xephi.authme.util.Profiler;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
public class ReloadCommand extends ExecutableCommand {
|
||||||
|
|
||||||
|
/** AuthMe plugin instance. */
|
||||||
|
private AuthMe plugin = AuthMe.getInstance();
|
||||||
|
/** Messages instance. */
|
||||||
|
private Messages m = Messages.getInstance();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the command.
|
||||||
|
*
|
||||||
|
* @param sender The command sender.
|
||||||
|
* @param commandReference The command reference.
|
||||||
|
* @param commandArguments The command arguments.
|
||||||
|
*
|
||||||
|
* @return True if the command was executed successfully, false otherwise.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||||
|
// Profile the reload process
|
||||||
|
Profiler p = new Profiler(true);
|
||||||
|
|
||||||
|
// Show a status message
|
||||||
|
sender.sendMessage(ChatColor.YELLOW + "Reloading Dungeon Maze...");
|
||||||
|
|
||||||
|
try {
|
||||||
|
Settings.reload();
|
||||||
|
plugin.getModuleManager().reloadModules();
|
||||||
|
m.reloadMessages();
|
||||||
|
plugin.setupDatabase();
|
||||||
|
} catch (Exception e) {
|
||||||
|
ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!");
|
||||||
|
ConsoleLogger.writeStackTrace(e);
|
||||||
|
plugin.stopOrUnload();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m.send(sender, "reload");
|
||||||
|
|
||||||
|
// Dungeon Maze reloaded, show a status message
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "Dungeon Maze has been reloaded successfully, took " + p.getTimeFormatted() + "!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user