A fix and another

This commit is contained in:
Norbi Peti 2019-03-14 00:40:40 +01:00
parent 25b9caa903
commit c62424389f
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
2 changed files with 4 additions and 1 deletions

View file

@ -93,6 +93,7 @@ public class MainPlugin extends ButtonPlugin {
Component.registerComponent(this, new VotifierComponent(economy)); Component.registerComponent(this, new VotifierComponent(economy));
ComponentManager.enableComponents(); ComponentManager.enableComponents();
getCommand2MC().registerCommand(new ComponentCommand()); getCommand2MC().registerCommand(new ComponentCommand());
getCommand2MC().registerCommand(new ThorpeCommand());
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this); TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
ChromaGamerBase.addConverter(commandSender -> Optional.ofNullable(commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender ChromaGamerBase.addConverter(commandSender -> Optional.ofNullable(commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender
? TBMCPlayer.getPlayer(new UUID(0, 0), TBMCPlayer.class) : null)); //Console & cmdblocks ? TBMCPlayer.getPlayer(new UUID(0, 0), TBMCPlayer.class) : null)); //Console & cmdblocks

View file

@ -19,6 +19,7 @@ public abstract class ButtonPlugin extends JavaPlugin {
private IHaveConfig iConfig; private IHaveConfig iConfig;
@Getter(AccessLevel.PROTECTED) @Getter(AccessLevel.PROTECTED)
private IHaveConfig data; //TODO private IHaveConfig data; //TODO
private boolean loaded = false;
/** /**
* Used to unregister components in the right order - and to reload configs * Used to unregister components in the right order - and to reload configs
*/ */
@ -76,10 +77,11 @@ public abstract class ButtonPlugin extends JavaPlugin {
} }
public void justReload() { public void justReload() {
if (ConfigData.saveNow(getConfig())) { if (loaded && ConfigData.saveNow(getConfig())) {
getLogger().warning("Saved pending configuration changes to the file, didn't reload (try again)."); getLogger().warning("Saved pending configuration changes to the file, didn't reload (try again).");
return; return;
} }
super.reloadConfig(); super.reloadConfig();
loaded = true; //Needed because for the first time it uses reloadConfig() to load it
} }
} }