New command system improvements, broadcast toggles, config fixes #62

Merged
NorbiPeti merged 23 commits from dev into master 2019-03-17 01:27:43 +00:00
2 changed files with 4 additions and 1 deletions
Showing only changes of commit c62424389f - Show all commits

View file

@ -93,6 +93,7 @@ public class MainPlugin extends ButtonPlugin {
Component.registerComponent(this, new VotifierComponent(economy));
ComponentManager.enableComponents();
getCommand2MC().registerCommand(new ComponentCommand());
getCommand2MC().registerCommand(new ThorpeCommand());
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
ChromaGamerBase.addConverter(commandSender -> Optional.ofNullable(commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender
? 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;
@Getter(AccessLevel.PROTECTED)
private IHaveConfig data; //TODO
private boolean loaded = false;
/**
* 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() {
if (ConfigData.saveNow(getConfig())) {
if (loaded && ConfigData.saveNow(getConfig())) {
getLogger().warning("Saved pending configuration changes to the file, didn't reload (try again).");
return;
}
super.reloadConfig();
loaded = true; //Needed because for the first time it uses reloadConfig() to load it
}
}