From b3426a6a1a1a04138666ed21551a973c2378bde3 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Sun, 28 Aug 2022 18:20:22 +0200 Subject: [PATCH] Load NMS modules via Reflections instead of defining everything manually This probably needs some additonal work but my idea is that every NMS module has only one entry point. This hopefully allows for as much freedom in version-specific implementations as possible and allows for easily loading them via Reflections. --- .../com/songoda/core/chat/ChatMessage.java | 9 +- .../java/com/songoda/core/gui/AnvilGui.java | 4 +- .../main/java/com/songoda/core/nms/Nms.java | 22 ++ .../java/com/songoda/core/nms/NmsManager.java | 200 ------------------ .../UnsupportedServerVersionException.java | 17 ++ .../com/songoda/core/world/SItemStack.java | 8 +- .../java/com/songoda/core/world/SSpawner.java | 4 +- .../java/com/songoda/core/world/SWorld.java | 4 +- .../songoda/core/nms/NmsImplementations.java | 20 ++ .../nms/v1_10_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_11_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_12_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_13_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_13_R2/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_14_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_15_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_16_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_16_R2/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_16_R3/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_17_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_18_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_18_R2/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_19_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_8_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_8_R2/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_8_R3/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_9_R1/NmsImplementationsImpl.java | 55 +++++ .../nms/v1_9_R2/NmsImplementationsImpl.java | 55 +++++ 28 files changed, 1118 insertions(+), 215 deletions(-) create mode 100644 Core/src/main/java/com/songoda/core/nms/Nms.java delete mode 100644 Core/src/main/java/com/songoda/core/nms/NmsManager.java create mode 100644 Core/src/main/java/com/songoda/core/nms/UnsupportedServerVersionException.java create mode 100644 NMS/NMS-API/src/main/java/com/songoda/core/nms/NmsImplementations.java create mode 100644 NMS/NMS-v1_10_R1/src/main/java/com/songoda/core/nms/v1_10_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_11_R1/src/main/java/com/songoda/core/nms/v1_11_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_12_R1/src/main/java/com/songoda/core/nms/v1_12_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_13_R1/src/main/java/com/songoda/core/nms/v1_13_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_13_R2/src/main/java/com/songoda/core/nms/v1_13_R2/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_14_R1/src/main/java/com/songoda/core/nms/v1_14_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_15_R1/src/main/java/com/songoda/core/nms/v1_15_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_16_R1/src/main/java/com/songoda/core/nms/v1_16_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_16_R2/src/main/java/com/songoda/core/nms/v1_16_R2/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_16_R3/src/main/java/com/songoda/core/nms/v1_16_R3/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_17_R1/src/main/java/com/songoda/core/nms/v1_17_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_18_R1/src/main/java/com/songoda/core/nms/v1_18_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_18_R2/src/main/java/com/songoda/core/nms/v1_18_R2/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_19_R1/src/main/java/com/songoda/core/nms/v1_19_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_8_R1/src/main/java/com/songoda/core/nms/v1_8_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_8_R2/src/main/java/com/songoda/core/nms/v1_8_R2/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_8_R3/src/main/java/com/songoda/core/nms/v1_8_R3/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_9_R1/src/main/java/com/songoda/core/nms/v1_9_R1/NmsImplementationsImpl.java create mode 100644 NMS/NMS-v1_9_R2/src/main/java/com/songoda/core/nms/v1_9_R2/NmsImplementationsImpl.java diff --git a/Core/src/main/java/com/songoda/core/chat/ChatMessage.java b/Core/src/main/java/com/songoda/core/chat/ChatMessage.java index 07fab7f8..2e0dc87e 100644 --- a/Core/src/main/java/com/songoda/core/chat/ChatMessage.java +++ b/Core/src/main/java/com/songoda/core/chat/ChatMessage.java @@ -5,7 +5,7 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import com.songoda.core.compatibility.ClassMapping; import com.songoda.core.compatibility.ServerVersion; -import com.songoda.core.nms.NmsManager; +import com.songoda.core.nms.Nms; import com.songoda.core.utils.TextUtils; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -13,7 +13,6 @@ import org.bukkit.entity.Player; import java.lang.reflect.Constructor; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; @@ -228,7 +227,7 @@ public class ChatMessage { Object packet; if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_19)) { packet = mc_PacketPlayOutChat_new.newInstance(mc_IChatBaseComponent_ChatSerializer_a.invoke(null, gson.toJson(textList)), mc_PacketPlayOutChat_new_1_19_0 ? 1 : true); - }else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { + } else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { packet = mc_PacketPlayOutChat_new.newInstance( mc_IChatBaseComponent_ChatSerializer_a.invoke(null, gson.toJson(textList)), mc_chatMessageType_Chat.get(null), @@ -237,8 +236,8 @@ public class ChatMessage { packet = mc_PacketPlayOutChat_new.newInstance(mc_IChatBaseComponent_ChatSerializer_a.invoke(null, gson.toJson(textList))); } - NmsManager.getPlayer().sendPacket((Player) sender, packet); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { + Nms.getImplementations().getPlayer().sendPacket((Player) sender, packet); + } catch (ReflectiveOperationException | IllegalArgumentException ex) { Bukkit.getLogger().log(Level.WARNING, "Problem preparing raw chat packets (disabling further packets)", ex); enabled = false; } diff --git a/Core/src/main/java/com/songoda/core/gui/AnvilGui.java b/Core/src/main/java/com/songoda/core/gui/AnvilGui.java index 640c3377..c5d50ace 100644 --- a/Core/src/main/java/com/songoda/core/gui/AnvilGui.java +++ b/Core/src/main/java/com/songoda/core/gui/AnvilGui.java @@ -2,7 +2,7 @@ package com.songoda.core.gui; import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.core.gui.methods.Clickable; -import com.songoda.core.nms.NmsManager; +import com.songoda.core.nms.Nms; import com.songoda.core.nms.anvil.AnvilCore; import com.songoda.core.nms.anvil.CustomAnvil; import org.bukkit.entity.Player; @@ -125,7 +125,7 @@ public class AnvilGui extends Gui { @Override protected void createInventory() { - AnvilCore nms = NmsManager.getAnvil(); + AnvilCore nms = Nms.getImplementations().getAnvil(); if (nms != null) { anvil = nms.createAnvil(player, new GuiHolder(guiManager, this)); diff --git a/Core/src/main/java/com/songoda/core/nms/Nms.java b/Core/src/main/java/com/songoda/core/nms/Nms.java new file mode 100644 index 00000000..7b01821e --- /dev/null +++ b/Core/src/main/java/com/songoda/core/nms/Nms.java @@ -0,0 +1,22 @@ +package com.songoda.core.nms; + +import com.songoda.core.compatibility.ServerVersion; + +public class Nms { + protected static NmsImplementations impl; + + /** + * @return The implementations for the current server version + */ + public static NmsImplementations getImplementations() throws UnsupportedServerVersionException { + if (impl == null) { + try { + impl = (NmsImplementations) Class.forName("com.songoda.core.nms." + ServerVersion.getServerVersionString() + ".NmsImplementationsImpl").getConstructors()[0].newInstance(); + } catch (ReflectiveOperationException ex) { + throw new UnsupportedServerVersionException(ex); + } + } + + return impl; + } +} diff --git a/Core/src/main/java/com/songoda/core/nms/NmsManager.java b/Core/src/main/java/com/songoda/core/nms/NmsManager.java deleted file mode 100644 index 1ae797b5..00000000 --- a/Core/src/main/java/com/songoda/core/nms/NmsManager.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.songoda.core.nms; - -import com.songoda.core.nms.anvil.AnvilCore; -import com.songoda.core.nms.entity.NMSPlayer; -import com.songoda.core.nms.nbt.NBTCore; -import com.songoda.core.nms.world.NmsWorldBorder; -import com.songoda.core.nms.world.WorldCore; -import org.bukkit.Bukkit; - -import java.util.logging.Level; -import java.util.logging.Logger; - -public class NmsManager { - private static final String serverPackagePath = Bukkit.getServer().getClass().getPackage().getName(); - private static final String serverPackageVersion = serverPackagePath.substring(serverPackagePath.lastIndexOf('.') + 1); - private static final NMSPlayer player; - private static final AnvilCore anvil; - private static final NBTCore nbt; - private static final WorldCore world; - private static final NmsWorldBorder worldBorder; - - static { - switch (serverPackageVersion) { - case "v1_8_R1": - player = new com.songoda.core.nms.v1_8_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_8_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_8_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_8_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_8_R1.world.NmsWorldBorderImpl(); - break; - case "v1_8_R2": - player = new com.songoda.core.nms.v1_8_R2.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_8_R2.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_8_R2.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_8_R2.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_8_R2.world.NmsWorldBorderImpl(); - break; - case "v1_8_R3": - player = new com.songoda.core.nms.v1_8_R3.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_8_R3.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_8_R3.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_8_R3.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_8_R3.world.NmsWorldBorderImpl(); - break; - case "v1_9_R1": - player = new com.songoda.core.nms.v1_9_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_9_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_9_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_9_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_9_R1.world.NmsWorldBorderImpl(); - break; - case "v1_9_R2": - player = new com.songoda.core.nms.v1_9_R2.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_9_R2.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_9_R2.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_9_R2.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_9_R2.world.NmsWorldBorderImpl(); - break; - case "v1_10_R1": - player = new com.songoda.core.nms.v1_10_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_10_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_10_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_10_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_10_R1.world.NmsWorldBorderImpl(); - break; - case "v1_11_R1": - player = new com.songoda.core.nms.v1_11_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_11_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_11_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_11_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_11_R1.world.NmsWorldBorderImpl(); - break; - case "v1_12_R1": - player = new com.songoda.core.nms.v1_12_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_12_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_12_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_12_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_12_R1.world.NmsWorldBorderImpl(); - break; - case "v1_13_R1": - player = new com.songoda.core.nms.v1_13_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_13_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_13_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_13_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_13_R1.world.NmsWorldBorderImpl(); - break; - case "v1_13_R2": - player = new com.songoda.core.nms.v1_13_R2.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_13_R2.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_13_R2.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_13_R2.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_13_R2.world.NmsWorldBorderImpl(); - break; - case "v1_14_R1": - player = new com.songoda.core.nms.v1_14_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_14_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_14_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_14_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_14_R1.world.NmsWorldBorderImpl(); - break; - case "v1_15_R1": - player = new com.songoda.core.nms.v1_15_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_15_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_15_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_15_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_15_R1.world.NmsWorldBorderImpl(); - break; - case "v1_16_R1": - player = new com.songoda.core.nms.v1_16_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_16_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_16_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_16_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_16_R1.world.NmsWorldBorderImpl(); - break; - case "v1_16_R2": - player = new com.songoda.core.nms.v1_16_R2.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_16_R2.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_16_R2.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_16_R2.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_16_R2.world.NmsWorldBorderImpl(); - break; - case "v1_16_R3": - player = new com.songoda.core.nms.v1_16_R3.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_16_R3.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_16_R3.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_16_R3.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_16_R3.world.NmsWorldBorderImpl(); - break; - case "v1_17_R1": - player = new com.songoda.core.nms.v1_17_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_17_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_17_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_17_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_17_R1.world.NmsWorldBorderImpl(); - break; - case "v1_18_R1": - player = new com.songoda.core.nms.v1_18_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_18_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_18_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_18_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_18_R1.world.NmsWorldBorderImpl(); - break; - case "v1_18_R2": - player = new com.songoda.core.nms.v1_18_R2.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_18_R2.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_18_R2.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_18_R2.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_18_R2.world.NmsWorldBorderImpl(); - break; - case "v1_19_R1": - player = new com.songoda.core.nms.v1_19_R1.entity.NMSPlayerImpl(); - anvil = new com.songoda.core.nms.v1_19_R1.anvil.AnvilCore(); - nbt = new com.songoda.core.nms.v1_19_R1.nbt.NBTCoreImpl(); - world = new com.songoda.core.nms.v1_19_R1.world.WorldCoreImpl(); - worldBorder = new com.songoda.core.nms.v1_19_R1.world.NmsWorldBorderImpl(); - break; - default: - Logger.getLogger(NmsManager.class.getName()).log(Level.SEVERE, "Failed to load NMS for this server version: version {0} not found", serverPackageVersion); - - player = null; - anvil = null; - nbt = null; - world = null; - worldBorder = null; - break; - } - } - - public static NMSPlayer getPlayer() { - return player; - } - - public static AnvilCore getAnvil() { - return anvil; - } - - public static boolean hasAnvil() { - return anvil != null; - } - - public static NBTCore getNbt() { - return nbt; - } - - public static boolean hasNbt() { - return nbt != null; - } - - public static WorldCore getWorld() { - return world; - } - - public static boolean hasWorld() { - return world != null; - } - - public static NmsWorldBorder getWorldBorder() { - return worldBorder; - } -} diff --git a/Core/src/main/java/com/songoda/core/nms/UnsupportedServerVersionException.java b/Core/src/main/java/com/songoda/core/nms/UnsupportedServerVersionException.java new file mode 100644 index 00000000..44363a59 --- /dev/null +++ b/Core/src/main/java/com/songoda/core/nms/UnsupportedServerVersionException.java @@ -0,0 +1,17 @@ +package com.songoda.core.nms; + +import com.songoda.core.compatibility.ServerVersion; + +public class UnsupportedServerVersionException extends RuntimeException { + public UnsupportedServerVersionException() { + this(null); + } + + public UnsupportedServerVersionException(Throwable cause) { + this("Your sever version (" + ServerVersion.getServerVersionString() + "; " + ServerVersion.getServerVersion().name() + ") is not fully supported", null); + } + + protected UnsupportedServerVersionException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/Core/src/main/java/com/songoda/core/world/SItemStack.java b/Core/src/main/java/com/songoda/core/world/SItemStack.java index d16d8b55..7307cad3 100644 --- a/Core/src/main/java/com/songoda/core/world/SItemStack.java +++ b/Core/src/main/java/com/songoda/core/world/SItemStack.java @@ -3,7 +3,7 @@ package com.songoda.core.world; import com.songoda.core.compatibility.CompatibleHand; import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.ServerVersion; -import com.songoda.core.nms.NmsManager; +import com.songoda.core.nms.Nms; import org.bukkit.Bukkit; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; @@ -18,12 +18,12 @@ public class SItemStack { public SItemStack(ItemStack item) { this.item = item; - this.sItem = NmsManager.getWorld().getItemStack(item); + this.sItem = Nms.getImplementations().getWorld().getItemStack(item); } public SItemStack(CompatibleHand hand, Player player) { this.item = hand.getItem(player); - this.sItem = NmsManager.getWorld().getItemStack(item); + this.sItem = Nms.getImplementations().getWorld().getItemStack(item); } public ItemStack addDamage(Player player, int damage) { @@ -49,7 +49,7 @@ public class SItemStack { int durability; if (ServerVersion.isServerVersionBelow(ServerVersion.V1_11) - ? NmsManager.getNbt().of(item).has("Unbreakable") + ? Nms.getImplementations().getNbt().of(item).has("Unbreakable") : item.getItemMeta().isUnbreakable()) { return item; } else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { diff --git a/Core/src/main/java/com/songoda/core/world/SSpawner.java b/Core/src/main/java/com/songoda/core/world/SSpawner.java index a5b652a5..bdcbee3a 100644 --- a/Core/src/main/java/com/songoda/core/world/SSpawner.java +++ b/Core/src/main/java/com/songoda/core/world/SSpawner.java @@ -2,7 +2,7 @@ package com.songoda.core.world; import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.core.hooks.EntityStackerManager; -import com.songoda.core.nms.NmsManager; +import com.songoda.core.nms.Nms; import com.songoda.core.nms.world.SpawnedEntity; import com.songoda.core.utils.EntityUtils; import org.bukkit.Location; @@ -20,7 +20,7 @@ public class SSpawner { public SSpawner(Location location) { this.location = location; - this.sSpawner = NmsManager.getWorld().getSpawner(location); + this.sSpawner = Nms.getImplementations().getWorld().getSpawner(location); } public SSpawner(CreatureSpawner spawner) { diff --git a/Core/src/main/java/com/songoda/core/world/SWorld.java b/Core/src/main/java/com/songoda/core/world/SWorld.java index 61df4a94..ac70ccff 100644 --- a/Core/src/main/java/com/songoda/core/world/SWorld.java +++ b/Core/src/main/java/com/songoda/core/world/SWorld.java @@ -1,7 +1,7 @@ package com.songoda.core.world; import com.songoda.core.compatibility.ServerVersion; -import com.songoda.core.nms.NmsManager; +import com.songoda.core.nms.Nms; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Entity; @@ -15,7 +15,7 @@ public class SWorld { public SWorld(World world) { this.world = world; - this.sWorld = NmsManager.getWorld().getWorld(world); + this.sWorld = Nms.getImplementations().getWorld().getWorld(world); } public Entity[] getEntitiesFromChunk(int x, int z) { diff --git a/NMS/NMS-API/src/main/java/com/songoda/core/nms/NmsImplementations.java b/NMS/NMS-API/src/main/java/com/songoda/core/nms/NmsImplementations.java new file mode 100644 index 00000000..e2908f5d --- /dev/null +++ b/NMS/NMS-API/src/main/java/com/songoda/core/nms/NmsImplementations.java @@ -0,0 +1,20 @@ +package com.songoda.core.nms; + +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +public interface NmsImplementations { + @NotNull NMSPlayer getPlayer(); + + @NotNull WorldCore getWorld(); + + @NotNull NmsWorldBorder getWorldBorder(); + + @NotNull AnvilCore getAnvil(); + + @NotNull NBTCore getNbt(); +} diff --git a/NMS/NMS-v1_10_R1/src/main/java/com/songoda/core/nms/v1_10_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_10_R1/src/main/java/com/songoda/core/nms/v1_10_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..aa1332e9 --- /dev/null +++ b/NMS/NMS-v1_10_R1/src/main/java/com/songoda/core/nms/v1_10_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_10_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_10_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_10_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_10_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_10_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_10_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_11_R1/src/main/java/com/songoda/core/nms/v1_11_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_11_R1/src/main/java/com/songoda/core/nms/v1_11_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..97d66bcb --- /dev/null +++ b/NMS/NMS-v1_11_R1/src/main/java/com/songoda/core/nms/v1_11_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_11_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_11_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_11_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_11_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_11_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_11_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_12_R1/src/main/java/com/songoda/core/nms/v1_12_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_12_R1/src/main/java/com/songoda/core/nms/v1_12_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..de9a3570 --- /dev/null +++ b/NMS/NMS-v1_12_R1/src/main/java/com/songoda/core/nms/v1_12_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_12_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_12_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_12_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_12_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_12_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_12_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_13_R1/src/main/java/com/songoda/core/nms/v1_13_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_13_R1/src/main/java/com/songoda/core/nms/v1_13_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..2837e434 --- /dev/null +++ b/NMS/NMS-v1_13_R1/src/main/java/com/songoda/core/nms/v1_13_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_13_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_13_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_13_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_13_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_13_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_13_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_13_R2/src/main/java/com/songoda/core/nms/v1_13_R2/NmsImplementationsImpl.java b/NMS/NMS-v1_13_R2/src/main/java/com/songoda/core/nms/v1_13_R2/NmsImplementationsImpl.java new file mode 100644 index 00000000..1e2e67b1 --- /dev/null +++ b/NMS/NMS-v1_13_R2/src/main/java/com/songoda/core/nms/v1_13_R2/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_13_R2; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_13_R2.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_13_R2.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_13_R2.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_13_R2.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_13_R2.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_14_R1/src/main/java/com/songoda/core/nms/v1_14_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_14_R1/src/main/java/com/songoda/core/nms/v1_14_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..15c5bec9 --- /dev/null +++ b/NMS/NMS-v1_14_R1/src/main/java/com/songoda/core/nms/v1_14_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_14_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_14_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_14_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_14_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_14_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_14_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_15_R1/src/main/java/com/songoda/core/nms/v1_15_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_15_R1/src/main/java/com/songoda/core/nms/v1_15_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..86d5d423 --- /dev/null +++ b/NMS/NMS-v1_15_R1/src/main/java/com/songoda/core/nms/v1_15_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_15_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_15_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_15_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_15_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_15_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_15_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_16_R1/src/main/java/com/songoda/core/nms/v1_16_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_16_R1/src/main/java/com/songoda/core/nms/v1_16_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..6af68429 --- /dev/null +++ b/NMS/NMS-v1_16_R1/src/main/java/com/songoda/core/nms/v1_16_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_16_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_16_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_16_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_16_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_16_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_16_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_16_R2/src/main/java/com/songoda/core/nms/v1_16_R2/NmsImplementationsImpl.java b/NMS/NMS-v1_16_R2/src/main/java/com/songoda/core/nms/v1_16_R2/NmsImplementationsImpl.java new file mode 100644 index 00000000..32692703 --- /dev/null +++ b/NMS/NMS-v1_16_R2/src/main/java/com/songoda/core/nms/v1_16_R2/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_16_R2; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_16_R2.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_16_R2.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_16_R2.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_16_R2.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_16_R2.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_16_R3/src/main/java/com/songoda/core/nms/v1_16_R3/NmsImplementationsImpl.java b/NMS/NMS-v1_16_R3/src/main/java/com/songoda/core/nms/v1_16_R3/NmsImplementationsImpl.java new file mode 100644 index 00000000..9d49860a --- /dev/null +++ b/NMS/NMS-v1_16_R3/src/main/java/com/songoda/core/nms/v1_16_R3/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_16_R3; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_16_R3.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_16_R3.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_16_R3.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_16_R3.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_16_R3.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_17_R1/src/main/java/com/songoda/core/nms/v1_17_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_17_R1/src/main/java/com/songoda/core/nms/v1_17_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..0d2e0179 --- /dev/null +++ b/NMS/NMS-v1_17_R1/src/main/java/com/songoda/core/nms/v1_17_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_17_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_17_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_17_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_17_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_17_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_17_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_18_R1/src/main/java/com/songoda/core/nms/v1_18_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_18_R1/src/main/java/com/songoda/core/nms/v1_18_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..48523749 --- /dev/null +++ b/NMS/NMS-v1_18_R1/src/main/java/com/songoda/core/nms/v1_18_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_18_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_18_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_18_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_18_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_18_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_18_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_18_R2/src/main/java/com/songoda/core/nms/v1_18_R2/NmsImplementationsImpl.java b/NMS/NMS-v1_18_R2/src/main/java/com/songoda/core/nms/v1_18_R2/NmsImplementationsImpl.java new file mode 100644 index 00000000..7c8748ff --- /dev/null +++ b/NMS/NMS-v1_18_R2/src/main/java/com/songoda/core/nms/v1_18_R2/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_18_R2; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_18_R2.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_18_R2.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_18_R2.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_18_R2.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_18_R2.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_19_R1/src/main/java/com/songoda/core/nms/v1_19_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_19_R1/src/main/java/com/songoda/core/nms/v1_19_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..438788e6 --- /dev/null +++ b/NMS/NMS-v1_19_R1/src/main/java/com/songoda/core/nms/v1_19_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_19_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_19_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_19_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_19_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_19_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_19_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_8_R1/src/main/java/com/songoda/core/nms/v1_8_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_8_R1/src/main/java/com/songoda/core/nms/v1_8_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..a3c4f19b --- /dev/null +++ b/NMS/NMS-v1_8_R1/src/main/java/com/songoda/core/nms/v1_8_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_8_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_8_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_8_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_8_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_8_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_8_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_8_R2/src/main/java/com/songoda/core/nms/v1_8_R2/NmsImplementationsImpl.java b/NMS/NMS-v1_8_R2/src/main/java/com/songoda/core/nms/v1_8_R2/NmsImplementationsImpl.java new file mode 100644 index 00000000..061f20ab --- /dev/null +++ b/NMS/NMS-v1_8_R2/src/main/java/com/songoda/core/nms/v1_8_R2/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_8_R2; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_8_R2.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_8_R2.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_8_R2.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_8_R2.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_8_R2.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_8_R3/src/main/java/com/songoda/core/nms/v1_8_R3/NmsImplementationsImpl.java b/NMS/NMS-v1_8_R3/src/main/java/com/songoda/core/nms/v1_8_R3/NmsImplementationsImpl.java new file mode 100644 index 00000000..853430e0 --- /dev/null +++ b/NMS/NMS-v1_8_R3/src/main/java/com/songoda/core/nms/v1_8_R3/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_8_R3; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_8_R3.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_8_R3.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_8_R3.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_8_R3.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_8_R3.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_9_R1/src/main/java/com/songoda/core/nms/v1_9_R1/NmsImplementationsImpl.java b/NMS/NMS-v1_9_R1/src/main/java/com/songoda/core/nms/v1_9_R1/NmsImplementationsImpl.java new file mode 100644 index 00000000..4b66b424 --- /dev/null +++ b/NMS/NMS-v1_9_R1/src/main/java/com/songoda/core/nms/v1_9_R1/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_9_R1; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_9_R1.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_9_R1.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_9_R1.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_9_R1.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_9_R1.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +} diff --git a/NMS/NMS-v1_9_R2/src/main/java/com/songoda/core/nms/v1_9_R2/NmsImplementationsImpl.java b/NMS/NMS-v1_9_R2/src/main/java/com/songoda/core/nms/v1_9_R2/NmsImplementationsImpl.java new file mode 100644 index 00000000..ee0b1bc0 --- /dev/null +++ b/NMS/NMS-v1_9_R2/src/main/java/com/songoda/core/nms/v1_9_R2/NmsImplementationsImpl.java @@ -0,0 +1,55 @@ +package com.songoda.core.nms.v1_9_R2; + +import com.songoda.core.nms.NmsImplementations; +import com.songoda.core.nms.anvil.AnvilCore; +import com.songoda.core.nms.entity.NMSPlayer; +import com.songoda.core.nms.nbt.NBTCore; +import com.songoda.core.nms.v1_9_R2.entity.NMSPlayerImpl; +import com.songoda.core.nms.v1_9_R2.nbt.NBTCoreImpl; +import com.songoda.core.nms.v1_9_R2.world.NmsWorldBorderImpl; +import com.songoda.core.nms.v1_9_R2.world.WorldCoreImpl; +import com.songoda.core.nms.world.NmsWorldBorder; +import com.songoda.core.nms.world.WorldCore; +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("unused") +public class NmsImplementationsImpl implements NmsImplementations { + private final NMSPlayer player; + private final WorldCore world; + private final NmsWorldBorder worldBorder; + private final AnvilCore anvil; + private final NBTCore nbt; + + public NmsImplementationsImpl() { + this.player = new NMSPlayerImpl(); + this.world = new WorldCoreImpl(); + this.worldBorder = new NmsWorldBorderImpl(); + this.anvil = new com.songoda.core.nms.v1_9_R2.anvil.AnvilCore(); + this.nbt = new NBTCoreImpl(); + } + + @Override + public @NotNull NMSPlayer getPlayer() { + return this.player; + } + + @Override + public @NotNull WorldCore getWorld() { + return this.world; + } + + @Override + public @NotNull NmsWorldBorder getWorldBorder() { + return this.worldBorder; + } + + @Override + public @NotNull AnvilCore getAnvil() { + return this.anvil; + } + + @Override + public @NotNull NBTCore getNbt() { + return this.nbt; + } +}