Some more little changes here and there with lombok

This commit is contained in:
Jaime Martinez Rincon 2017-04-21 21:12:30 +02:00
parent a6c2470df7
commit 1f3c2b5094
4 changed files with 13 additions and 27 deletions

View File

@ -1,5 +1,6 @@
package me.jaimemartz.lobbybalancer;
import lombok.Getter;
import me.jaimemartz.faucet.ConfigFactory;
import me.jaimemartz.lobbybalancer.commands.FallbackCommand;
import me.jaimemartz.lobbybalancer.commands.MainCommand;
@ -27,11 +28,12 @@ public class LobbyBalancer extends Plugin {
public static final String NONCE_ID = "%%__NONCE__%%";
private static final int LAST_VER_CONFIG_UPDATE = 20950;
private boolean failed = false;
@Getter private ConfigFactory factory;
@Getter private boolean failed = false;
@Getter private StatusManager statusManager;
@Getter private SectionManager sectionManager;
@Getter private static LobbyBalancer instance;
private ConfigFactory factory;
private StatusManager statusManager;
private SectionManager sectionManager;
private Command fallbackCommand, mainCommand, manageCommand;
private Listener connectListener, kickListener, messageListener, reloadListener;
@ -139,7 +141,7 @@ public class LobbyBalancer extends Plugin {
if (ConfigEntries.PLUGIN_ENABLED.get()) {
//Do not try to do anything if the plugin has not loaded correctly
if (hasFailed()) return;
if (isFailed()) return;
if (ConfigEntries.AUTO_RELOAD_ENABLED.get()) {
getProxy().getPluginManager().unregisterListener(reloadListener);
@ -190,24 +192,7 @@ public class LobbyBalancer extends Plugin {
getLogger().info(String.format("The plugin has been reloaded, took %sms", ending));
}
public StatusManager getStatusManager() {
return statusManager;
}
public SectionManager getSectionManager() {
return sectionManager;
}
public boolean hasFailed() {
return failed;
}
public Configuration getConfig() {
return factory.get(0).getHandle();
}
private static LobbyBalancer instance;
public static LobbyBalancer getInstance() {
return instance;
public Configuration getConfigHandle() {
return factory.get("config.yml").getHandle();
}
}

View File

@ -37,7 +37,7 @@ public class FallbackCommand extends Command {
return null;
}
Configuration rules = plugin.getConfig().getSection("settings.fallback-command.rules");
Configuration rules = plugin.getConfigHandle().getSection("settings.fallback-command.rules");
String bind = rules.getString(section.getName());
ServerSection target = plugin.getSectionManager().getByName(bind);

View File

@ -76,7 +76,7 @@ public class ServerKickListener implements Listener {
if (matches.get()) {
if (section != null) {
Configuration rules = plugin.getConfig().getSection("settings.reconnect-kick.rules");
Configuration rules = plugin.getConfigHandle().getSection("settings.reconnect-kick.rules");
String name = rules.getString(section.getName());
ServerSection target = plugin.getSectionManager().getByName(name);

View File

@ -29,7 +29,8 @@ public class SectionManager {
plugin.getLogger().info("Loading sections from the config, this may take a while...");
long starting = System.currentTimeMillis();
Configuration sections = plugin.getConfig().getSection("sections");
Configuration sections = plugin.getConfigHandle().getSection("sections");
sections.getKeys().forEach(name -> {
plugin.getLogger().info(String.format("Construction of section with name \"%s\"", name));
Configuration section = sections.getSection(name);