#575 Hotfix for reload support
- Create temporary method for reloading any stateful entities -> a lot of duplicated code, to be fixed soon within #432 - Remove unused methods
This commit is contained in:
@@ -12,7 +12,6 @@ import fr.xephi.authme.settings.NewSetting;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -163,15 +162,6 @@ public class CommandService {
|
||||
return messages.retrieve(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the messages instance to retrieve messages from the given file.
|
||||
*
|
||||
* @param file The new file to read messages from
|
||||
*/
|
||||
public void reloadMessages(File file) {
|
||||
messages.reload(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the given property's value.
|
||||
*
|
||||
|
||||
@@ -5,7 +5,6 @@ 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.settings.Spawn;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.List;
|
||||
@@ -19,13 +18,7 @@ public class ReloadCommand implements ExecutableCommand {
|
||||
public void executeCommand(CommandSender sender, List<String> arguments, CommandService commandService) {
|
||||
AuthMe plugin = commandService.getAuthMe();
|
||||
try {
|
||||
commandService.getSettings().reload();
|
||||
commandService.reloadMessages(commandService.getSettings().getMessagesFile());
|
||||
Spawn.reload();
|
||||
// TODO #432: We should not reload only certain plugin entities but actually reinitialize all elements,
|
||||
// i.e. here in the future we might not have setupDatabase() but Authme.onEnable(), maybe after
|
||||
// a call to some destructor method
|
||||
plugin.setupDatabase(commandService.getSettings());
|
||||
plugin.reloadEntities();
|
||||
commandService.send(sender, MessageKey.CONFIG_RELOAD_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage("Error occurred during reload of AuthMe: aborting");
|
||||
|
||||
Reference in New Issue
Block a user