style: better code naming/conventions
This commit is contained in:
parent
3497dd3adf
commit
42439019b7
2 changed files with 9 additions and 9 deletions
|
@ -17,7 +17,7 @@ import net.artelnatif.nicko.mojang.MojangAPI;
|
||||||
import net.artelnatif.nicko.placeholder.PlaceHolderHook;
|
import net.artelnatif.nicko.placeholder.PlaceHolderHook;
|
||||||
import net.artelnatif.nicko.pluginchannel.PluginMessageHandler;
|
import net.artelnatif.nicko.pluginchannel.PluginMessageHandler;
|
||||||
import net.artelnatif.nicko.storage.PlayerDataStore;
|
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.Material;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
@ -135,10 +135,10 @@ public class NickoBukkit extends JavaPlugin {
|
||||||
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
|
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
|
||||||
getServer().getPluginManager().registerEvents(new PlayerQuitListener(), this);
|
getServer().getPluginManager().registerEvents(new PlayerQuitListener(), this);
|
||||||
|
|
||||||
final ServerUtils serverUtils = new ServerUtils(this);
|
final BungeeCordSupport support = new BungeeCordSupport(this);
|
||||||
serverUtils.checkSpigotBungeeCordHook();
|
support.warnNickoNotHookedToBungeeCord();
|
||||||
if (config.isBungeecordSupport()) {
|
if (config.isBungeecordSupport()) {
|
||||||
if (serverUtils.checkBungeeCordHook()) {
|
if (support.stopIfBungeeCordIsNotEnabled()) {
|
||||||
getLogger().info("Enabling BungeeCord support...");
|
getLogger().info("Enabling BungeeCord support...");
|
||||||
getServer().getMessenger().registerIncomingPluginChannel(this, NickoBungee.NICKO_PLUGIN_CHANNEL_UPDATE, new PluginMessageHandler());
|
getServer().getMessenger().registerIncomingPluginChannel(this, NickoBungee.NICKO_PLUGIN_CHANNEL_UPDATE, new PluginMessageHandler());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package net.artelnatif.nicko.utils;
|
package net.artelnatif.nicko.bungee;
|
||||||
|
|
||||||
import net.artelnatif.nicko.NickoBukkit;
|
import net.artelnatif.nicko.NickoBukkit;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
public class ServerUtils {
|
public class BungeeCordSupport {
|
||||||
private final NickoBukkit instance;
|
private final NickoBukkit instance;
|
||||||
|
|
||||||
public ServerUtils(NickoBukkit instance) {
|
public BungeeCordSupport(NickoBukkit instance) {
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkSpigotBungeeCordHook() {
|
public void warnNickoNotHookedToBungeeCord() {
|
||||||
final Server server = instance.getServer();
|
final Server server = instance.getServer();
|
||||||
final YamlConfiguration config = server.spigot().getConfig();
|
final YamlConfiguration config = server.spigot().getConfig();
|
||||||
if (config.getConfigurationSection("settings").getBoolean("bungeecord") && instance.getNickoConfig().isBungeecordSupport()) {
|
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 Server server = instance.getServer();
|
||||||
final YamlConfiguration config = server.spigot().getConfig();
|
final YamlConfiguration config = server.spigot().getConfig();
|
||||||
if (!config.getConfigurationSection("settings").getBoolean("bungeecord")) {
|
if (!config.getConfigurationSection("settings").getBoolean("bungeecord")) {
|
Loading…
Reference in a new issue