Improved reload command

This commit is contained in:
Tim Visée 2015-11-01 17:19:50 +01:00
parent 0781bc16d1
commit d583a3f339

View File

@ -8,16 +8,11 @@ import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.util.Profiler; import fr.xephi.authme.util.Profiler;
import org.bukkit.ChatColor; //import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class ReloadCommand extends ExecutableCommand { public class ReloadCommand extends ExecutableCommand {
/** AuthMe plugin instance. */
private AuthMe plugin = AuthMe.getInstance();
/** Messages instance. */
private Messages m = Messages.getInstance();
/** /**
* Execute the command. * Execute the command.
* *
@ -32,13 +27,18 @@ public class ReloadCommand extends ExecutableCommand {
// Profile the reload process // Profile the reload process
Profiler p = new Profiler(true); Profiler p = new Profiler(true);
// AuthMe plugin instance
AuthMe plugin = AuthMe.getInstance();
// Messages instance
Messages m = Messages.getInstance();
// Show a status message // Show a status message
sender.sendMessage(ChatColor.YELLOW + "Reloading Dungeon Maze..."); //sender.sendMessage(ChatColor.YELLOW + "Reloading AuthMeReloaded...");
try { try {
Settings.reload(); Settings.reload();
plugin.getModuleManager().reloadModules(); plugin.getModuleManager().reloadModules();
m.reloadMessages(); Messages.getInstance().reloadMessages();
plugin.setupDatabase(); plugin.setupDatabase();
} catch (Exception e) { } catch (Exception e) {
ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!");
@ -46,10 +46,12 @@ public class ReloadCommand extends ExecutableCommand {
plugin.stopOrUnload(); plugin.stopOrUnload();
return false; return false;
} }
// Show a status message
m.send(sender, "reload"); m.send(sender, "reload");
// Dungeon Maze reloaded, show a status message // AuthMeReloaded reloaded, show a status message
sender.sendMessage(ChatColor.GREEN + "Dungeon Maze has been reloaded successfully, took " + p.getTimeFormatted() + "!"); //sender.sendMessage(ChatColor.GREEN + "AuthMeReloaded has been reloaded successfully, took " + p.getTimeFormatted() + "!");
return true; return true;
} }
} }