mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-02-26 06:11:40 +01:00
Cleaned up main class
This commit is contained in:
parent
949eee846a
commit
7c72d388e6
@ -1,5 +1,6 @@
|
||||
package com.willfp.ecoenchants;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import com.willfp.ecoenchants.extensions.loader.EcoExtensionLoader;
|
||||
import com.willfp.ecoenchants.extensions.loader.ExtensionLoader;
|
||||
@ -21,16 +22,16 @@ public class EcoEnchantsPlugin extends JavaPlugin {
|
||||
*/
|
||||
private final ExtensionLoader loader = new EcoExtensionLoader();
|
||||
|
||||
/**
|
||||
* ProtocolLib
|
||||
*/
|
||||
private final ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
|
||||
|
||||
/**
|
||||
* NMS version
|
||||
*/
|
||||
public static final String NMS_VERSION = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||
|
||||
/**
|
||||
* ProtocolLib
|
||||
*/
|
||||
public ProtocolManager protocolManager;
|
||||
|
||||
/**
|
||||
* Calls {@link Loader#load()}
|
||||
*/
|
||||
@ -60,6 +61,14 @@ public class EcoEnchantsPlugin extends JavaPlugin {
|
||||
return loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ProtocolLib protocol manager
|
||||
* @return The {@link ProtocolManager} that EcoEnchants interacts with
|
||||
*/
|
||||
public ProtocolManager getProtocolManager() {
|
||||
return protocolManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plugin instance
|
||||
* @return Plugin instance
|
||||
|
@ -49,8 +49,8 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
|
||||
}
|
||||
|
||||
public final void register() {
|
||||
if(!EcoEnchantsPlugin.getInstance().protocolManager.getPacketListeners().contains(this)) {
|
||||
EcoEnchantsPlugin.getInstance().protocolManager.addPacketListener(this);
|
||||
if(!EcoEnchantsPlugin.getInstance().getProtocolManager().getPacketListeners().contains(this)) {
|
||||
EcoEnchantsPlugin.getInstance().getProtocolManager().addPacketListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.util.internal;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.command.commands.CommandEcodebug;
|
||||
import com.willfp.ecoenchants.command.commands.CommandEcoreload;
|
||||
@ -102,7 +101,6 @@ public class Loader {
|
||||
*/
|
||||
|
||||
Logger.info("Loading ProtocolLib...");
|
||||
EcoEnchantsPlugin.getInstance().protocolManager = ProtocolLibrary.getProtocolManager();
|
||||
if (ConfigManager.getConfig().getBool("villager.enabled")) {
|
||||
new PacketOpenWindowMerchant().register();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user