#450 Make reload & messages functionality use NewSetting

- Change ReloadCommand to use the new setting functionality
- Check and construct the messages file in NewSetting
- Unrelated: change MessagesManager not to extend CustomConfiguration anymore
This commit is contained in:
ljacqu
2016-01-31 09:55:02 +01:00
parent 059175f14e
commit e747dfeb7f
11 changed files with 185 additions and 123 deletions
@@ -1,36 +1,32 @@
package fr.xephi.authme.command.executable.authme;
import java.util.List;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages;
import fr.xephi.authme.settings.Settings;
import org.bukkit.command.CommandSender;
import java.util.List;
/**
* The reload command.
*/
public class ReloadCommand implements ExecutableCommand {
@Override
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
// AuthMe plugin instance
AuthMe plugin = AuthMe.getInstance();
AuthMe plugin = commandService.getAuthMe();
try {
Settings.reload();
Messages.getInstance().reloadManager();
plugin.getModuleManager().reloadModules();
commandService.getSettings().reload();
commandService.reloadMessages(commandService.getSettings().getMessagesFile());
plugin.setupDatabase();
commandService.send(sender, MessageKey.CONFIG_RELOAD_SUCCESS);
} catch (Exception e) {
sender.sendMessage("Error occurred during reload of AuthMe: aborting");
ConsoleLogger.showError("Fatal error occurred! AuthMe instance ABORTED!");
ConsoleLogger.writeStackTrace(e);
plugin.stopOrUnload();
}
commandService.send(sender, MessageKey.CONFIG_RELOAD_SUCCESS);
}
}