style: better code naming/conventions

This commit is contained in:
aro 2023-01-16 18:27:07 +01:00
parent 3497dd3adf
commit 42439019b7
2 changed files with 9 additions and 9 deletions

View file

@ -17,7 +17,7 @@ import net.artelnatif.nicko.mojang.MojangAPI;
import net.artelnatif.nicko.placeholder.PlaceHolderHook;
import net.artelnatif.nicko.pluginchannel.PluginMessageHandler;
import net.artelnatif.nicko.storage.PlayerDataStore;
import net.artelnatif.nicko.utils.ServerUtils;
import net.artelnatif.nicko.bungee.BungeeCordSupport;
import org.bukkit.Material;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.PluginDescriptionFile;
@ -135,10 +135,10 @@ public class NickoBukkit extends JavaPlugin {
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
getServer().getPluginManager().registerEvents(new PlayerQuitListener(), this);
final ServerUtils serverUtils = new ServerUtils(this);
serverUtils.checkSpigotBungeeCordHook();
final BungeeCordSupport support = new BungeeCordSupport(this);
support.warnNickoNotHookedToBungeeCord();
if (config.isBungeecordSupport()) {
if (serverUtils.checkBungeeCordHook()) {
if (support.stopIfBungeeCordIsNotEnabled()) {
getLogger().info("Enabling BungeeCord support...");
getServer().getMessenger().registerIncomingPluginChannel(this, NickoBungee.NICKO_PLUGIN_CHANNEL_UPDATE, new PluginMessageHandler());
}

View file

@ -1,17 +1,17 @@
package net.artelnatif.nicko.utils;
package net.artelnatif.nicko.bungee;
import net.artelnatif.nicko.NickoBukkit;
import org.bukkit.Server;
import org.bukkit.configuration.file.YamlConfiguration;
public class ServerUtils {
public class BungeeCordSupport {
private final NickoBukkit instance;
public ServerUtils(NickoBukkit instance) {
public BungeeCordSupport(NickoBukkit instance) {
this.instance = instance;
}
public void checkSpigotBungeeCordHook() {
public void warnNickoNotHookedToBungeeCord() {
final Server server = instance.getServer();
final YamlConfiguration config = server.spigot().getConfig();
if (config.getConfigurationSection("settings").getBoolean("bungeecord") && instance.getNickoConfig().isBungeecordSupport()) {
@ -22,7 +22,7 @@ public class ServerUtils {
}
}
public boolean checkBungeeCordHook() {
public boolean stopIfBungeeCordIsNotEnabled() {
final Server server = instance.getServer();
final YamlConfiguration config = server.spigot().getConfig();
if (!config.getConfigurationSection("settings").getBoolean("bungeecord")) {