diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/display/AbstractPacketAdapter.java b/Plugin/src/main/java/com/willfp/ecoenchants/display/AbstractPacketAdapter.java index 9c3b65e8..ae2e7e97 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/display/AbstractPacketAdapter.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/display/AbstractPacketAdapter.java @@ -9,15 +9,11 @@ import com.willfp.ecoenchants.EcoEnchantsPlugin; import java.util.Collections; public abstract class AbstractPacketAdapter extends PacketAdapter { - protected static AbstractPacketAdapter instance; - private final PacketType type; protected AbstractPacketAdapter(PacketType type) { super(EcoEnchantsPlugin.getInstance(), Collections.singletonList(type)); this.type = type; - - instance = this; } public void onReceive(PacketContainer packet) {} diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketOpenWindowMerchant.java b/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketOpenWindowMerchant.java index cc0004e7..c11e3eb7 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketOpenWindowMerchant.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketOpenWindowMerchant.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.stream.Collectors; public final class PacketOpenWindowMerchant extends AbstractPacketAdapter { - private PacketOpenWindowMerchant() { + public PacketOpenWindowMerchant() { super(PacketType.Play.Server.OPEN_WINDOW_MERCHANT); } @@ -38,11 +38,4 @@ public final class PacketOpenWindowMerchant extends AbstractPacketAdapter { packet.getMerchantRecipeLists().writeSafely(0, newList); } - - public static AbstractPacketAdapter getInstance() { - if(instance == null) { - instance = new PacketOpenWindowMerchant(); - } - return instance; - } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketSetCreativeSlot.java b/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketSetCreativeSlot.java index 33d3e48f..0f8fd5f7 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketSetCreativeSlot.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketSetCreativeSlot.java @@ -6,7 +6,7 @@ import com.willfp.ecoenchants.display.AbstractPacketAdapter; import com.willfp.ecoenchants.display.EnchantDisplay; public final class PacketSetCreativeSlot extends AbstractPacketAdapter { - private PacketSetCreativeSlot() { + public PacketSetCreativeSlot() { super(PacketType.Play.Client.SET_CREATIVE_SLOT); } @@ -17,11 +17,4 @@ public final class PacketSetCreativeSlot extends AbstractPacketAdapter { return item; }); } - - public static AbstractPacketAdapter getInstance() { - if(instance == null) { - instance = new PacketSetCreativeSlot(); - } - return instance; - } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketSetSlot.java b/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketSetSlot.java index 93a420b3..91199c3d 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketSetSlot.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketSetSlot.java @@ -6,7 +6,7 @@ import com.willfp.ecoenchants.display.AbstractPacketAdapter; import com.willfp.ecoenchants.display.EnchantDisplay; public final class PacketSetSlot extends AbstractPacketAdapter { - private PacketSetSlot() { + public PacketSetSlot() { super(PacketType.Play.Server.SET_SLOT); } @@ -17,11 +17,4 @@ public final class PacketSetSlot extends AbstractPacketAdapter { return item; }); } - - public static AbstractPacketAdapter getInstance() { - if(instance == null) { - instance = new PacketSetSlot(); - } - return instance; - } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketWindowItems.java b/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketWindowItems.java index e615845e..609f1ee6 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketWindowItems.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/display/packets/PacketWindowItems.java @@ -6,7 +6,7 @@ import com.willfp.ecoenchants.display.AbstractPacketAdapter; import com.willfp.ecoenchants.display.EnchantDisplay; public final class PacketWindowItems extends AbstractPacketAdapter { - private PacketWindowItems() { + public PacketWindowItems() { super(PacketType.Play.Server.WINDOW_ITEMS); } @@ -17,11 +17,4 @@ public final class PacketWindowItems extends AbstractPacketAdapter { return itemStacks; }); } - - public static AbstractPacketAdapter getInstance() { - if(instance == null) { - instance = new PacketWindowItems(); - } - return instance; - } } diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java b/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java index f14d8d60..9eea7029 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/loader/Loader.java @@ -99,10 +99,10 @@ public class Loader { Bukkit.getLogger().info("Loading ProtocolLib..."); EcoEnchantsPlugin.getInstance().protocolManager = ProtocolLibrary.getProtocolManager(); - PacketOpenWindowMerchant.getInstance().register(); - PacketSetCreativeSlot.getInstance().register(); - PacketSetSlot.getInstance().register(); - PacketWindowItems.getInstance().register(); + new PacketOpenWindowMerchant().register(); + new PacketSetCreativeSlot().register(); + new PacketSetSlot().register(); + new PacketWindowItems().register(); /* Load land management support