Skip to content

Commit 1f3c2b5

Browse files
committed
Some more little changes here and there with lombok
1 parent a6c2470 commit 1f3c2b5

File tree

4 files changed

+13
-27
lines changed

4 files changed

+13
-27
lines changed

src/main/java/me/jaimemartz/lobbybalancer/LobbyBalancer.java

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package me.jaimemartz.lobbybalancer;
22

3+
import lombok.Getter;
34
import me.jaimemartz.faucet.ConfigFactory;
45
import me.jaimemartz.lobbybalancer.commands.FallbackCommand;
56
import me.jaimemartz.lobbybalancer.commands.MainCommand;
@@ -27,11 +28,12 @@ public class LobbyBalancer extends Plugin {
2728
public static final String NONCE_ID = "%%__NONCE__%%";
2829
private static final int LAST_VER_CONFIG_UPDATE = 20950;
2930

30-
private boolean failed = false;
31+
@Getter private ConfigFactory factory;
32+
@Getter private boolean failed = false;
33+
@Getter private StatusManager statusManager;
34+
@Getter private SectionManager sectionManager;
35+
@Getter private static LobbyBalancer instance;
3136

32-
private ConfigFactory factory;
33-
private StatusManager statusManager;
34-
private SectionManager sectionManager;
3537
private Command fallbackCommand, mainCommand, manageCommand;
3638
private Listener connectListener, kickListener, messageListener, reloadListener;
3739

@@ -139,7 +141,7 @@ private void disable() {
139141

140142
if (ConfigEntries.PLUGIN_ENABLED.get()) {
141143
//Do not try to do anything if the plugin has not loaded correctly
142-
if (hasFailed()) return;
144+
if (isFailed()) return;
143145

144146
if (ConfigEntries.AUTO_RELOAD_ENABLED.get()) {
145147
getProxy().getPluginManager().unregisterListener(reloadListener);
@@ -190,24 +192,7 @@ public void reloadPlugin() {
190192
getLogger().info(String.format("The plugin has been reloaded, took %sms", ending));
191193
}
192194

193-
public StatusManager getStatusManager() {
194-
return statusManager;
195-
}
196-
197-
public SectionManager getSectionManager() {
198-
return sectionManager;
199-
}
200-
201-
public boolean hasFailed() {
202-
return failed;
203-
}
204-
205-
public Configuration getConfig() {
206-
return factory.get(0).getHandle();
207-
}
208-
209-
private static LobbyBalancer instance;
210-
public static LobbyBalancer getInstance() {
211-
return instance;
195+
public Configuration getConfigHandle() {
196+
return factory.get("config.yml").getHandle();
212197
}
213198
}

src/main/java/me/jaimemartz/lobbybalancer/commands/FallbackCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void execute(CommandSender sender, String[] args) {
3737
return null;
3838
}
3939

40-
Configuration rules = plugin.getConfig().getSection("settings.fallback-command.rules");
40+
Configuration rules = plugin.getConfigHandle().getSection("settings.fallback-command.rules");
4141
String bind = rules.getString(section.getName());
4242
ServerSection target = plugin.getSectionManager().getByName(bind);
4343

src/main/java/me/jaimemartz/lobbybalancer/listener/ServerKickListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void onKick(ServerKickEvent event) {
7676

7777
if (matches.get()) {
7878
if (section != null) {
79-
Configuration rules = plugin.getConfig().getSection("settings.reconnect-kick.rules");
79+
Configuration rules = plugin.getConfigHandle().getSection("settings.reconnect-kick.rules");
8080
String name = rules.getString(section.getName());
8181
ServerSection target = plugin.getSectionManager().getByName(name);
8282

src/main/java/me/jaimemartz/lobbybalancer/section/SectionManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public void load() throws RuntimeException {
2929
plugin.getLogger().info("Loading sections from the config, this may take a while...");
3030
long starting = System.currentTimeMillis();
3131

32-
Configuration sections = plugin.getConfig().getSection("sections");
32+
Configuration sections = plugin.getConfigHandle().getSection("sections");
33+
3334
sections.getKeys().forEach(name -> {
3435
plugin.getLogger().info(String.format("Construction of section with name \"%s\"", name));
3536
Configuration section = sections.getSection(name);

0 commit comments

Comments
 (0)