diff --git a/SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java b/SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java index e13db9a..1742df4 100644 --- a/SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java +++ b/SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java @@ -344,9 +344,9 @@ public final class Reflection { // Expand all detected variables if (variable.startsWith("nms")) { if(Core.getVersion() >= 17) - replacement = NMS_PREFIX; - else replacement = "net.minecraft" + variable.substring(3); + else + replacement = NMS_PREFIX; } else if ("obc".equals(variable)) replacement = OBC_PREFIX; else if ("version".equals(variable)) diff --git a/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java b/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java index 1718efc..c526594 100644 --- a/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java +++ b/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java @@ -34,7 +34,7 @@ public class TinyProtocol { // Used in order to lookup a channel private static final MethodInvoker getPlayerHandle = Reflection.getMethod("{obc}.entity.CraftPlayer", "getHandle"); - private static final Class playerConnection = Reflection.getUntypedClass("{nms.network}.PlayerConnection"); + private static final Class playerConnection = Reflection.getUntypedClass("{nms.server.network}.PlayerConnection"); private static final FieldAccessor getConnection = Reflection.getField("{nms.server.level}.EntityPlayer", playerConnection, 0); private static final Class networkManager = Reflection.getUntypedClass("{nms.network}.NetworkManager"); private static final FieldAccessor getManager = Reflection.getField(playerConnection, networkManager, 0); @@ -45,16 +45,7 @@ public class TinyProtocol { private static final Class serverConnectionClass = Reflection.getUntypedClass("{nms.server.network}.ServerConnection"); private static final FieldAccessor getMinecraftServer = Reflection.getField("{obc}.CraftServer", minecraftServerClass, 0); private static final FieldAccessor getServerConnection = Reflection.getField(minecraftServerClass, serverConnectionClass, 0); - private static final MethodInvoker getNetworkMarkers; - static { - MethodInvoker networkMarkers; - try { - networkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, List.class, serverConnectionClass); - } catch (IllegalStateException e) { // Paper, wtf why. - networkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, Queue.class, serverConnectionClass); - } - getNetworkMarkers = networkMarkers; - } + private static final FieldAccessor getNetworkMarkers = Reflection.getField(serverConnectionClass, Collection.class, 1); // Packets we have to intercept private static final Class PACKET_LOGIN_IN_START = Reflection.getClass("{nms.network.protocol.login}.PacketLoginInStart"); @@ -86,6 +77,10 @@ public class TinyProtocol { public static final TinyProtocol instance = new TinyProtocol(Core.getInstance()); + public static void init() { + //enforce init + } + public TinyProtocol(final Plugin plugin) { this.plugin = plugin; @@ -187,7 +182,7 @@ public class TinyProtocol { boolean looking = true; // We need to synchronize against this list - networkManagers = (Collection) getNetworkMarkers.invoke(null, serverConnection); + networkManagers = getNetworkMarkers.get(serverConnection); createServerChannelHandler(); // Find the correct list, or implicitly throw an exception diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index 2bc3194..5cb4e64 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -82,6 +82,7 @@ public class Core extends JavaPlugin{ getServer().getMessenger().registerIncomingPluginChannel(this, "sw:bridge", new BungeeReceiver()); getServer().getMessenger().registerOutgoingPluginChannel(this, "sw:bridge"); AuthlibInjector.inject(); + TinyProtocol.init(); try { Bukkit.getLogger().log(Level.INFO, "Running on: " + new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("hostname").getInputStream())).readLine()); } catch (IOException e) { diff --git a/SpigotCore_Main/src/plugin.yml b/SpigotCore_Main/src/plugin.yml index 8eee87b..115baf6 100644 --- a/SpigotCore_Main/src/plugin.yml +++ b/SpigotCore_Main/src/plugin.yml @@ -7,4 +7,5 @@ softdepend: - WorldEdit main: de.steamwar.core.Core -commands: \ No newline at end of file +libraries: + - mysql:mysql-connector-java:5.1.49 \ No newline at end of file