From b316629e047535cd227bf750f4a9d729137922e7 Mon Sep 17 00:00:00 2001 From: Dylan Keir Date: Sun, 4 Aug 2024 13:06:24 +0100 Subject: [PATCH] Bump version to 2.8.1 & fix issues with ProtocolLib on 1.21 --- build.gradle | 6 ++++-- .../bukkit/protocollib/handler/ProtocolLibPlayer.java | 9 ++++----- src/main/resources/bungee.yml | 2 +- src/main/resources/plugin.yml | 2 +- src/main/resources/velocity-plugin.json | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 0003bad..1389967 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ plugins { // -- // Variables // -- -version = '2.8.0' +version = '2.8.1' group = 'net.tcpshield.tcpshield' archivesBaseName = 'TCPShield' @@ -91,7 +91,9 @@ repositories { dependencies { // Bukkit - compileOnly group: 'com.comphenix.protocol', name: 'ProtocolLib', version: '5.1.0' +// compileOnly group: 'com.comphenix.protocol', name: 'ProtocolLib', version: '5.3.0-SNAPSHOT' + + compileOnly(files("libs/ProtocolLib.jar")) // Temporary, currently using build #726 from the CI server since the maven repository is out of date. // Paper - 1.19.4 so we can bump from JDK 8 -> JDK 17, using 1.20.x as a dependency would require bumping from JDK 8 -> JDK 21 compileOnly group: 'io.papermc.paper', name: 'paper-api', version: '1.19.4-R0.1-SNAPSHOT' diff --git a/src/main/java/net/tcpshield/tcpshield/bukkit/protocollib/handler/ProtocolLibPlayer.java b/src/main/java/net/tcpshield/tcpshield/bukkit/protocollib/handler/ProtocolLibPlayer.java index 4bdc59f..5a5e7ba 100644 --- a/src/main/java/net/tcpshield/tcpshield/bukkit/protocollib/handler/ProtocolLibPlayer.java +++ b/src/main/java/net/tcpshield/tcpshield/bukkit/protocollib/handler/ProtocolLibPlayer.java @@ -1,6 +1,6 @@ package net.tcpshield.tcpshield.bukkit.protocollib.handler; -import com.comphenix.protocol.injector.temporary.MinimalInjector; +import com.comphenix.protocol.injector.netty.Injector; import com.comphenix.protocol.injector.temporary.TemporaryPlayerFactory; import net.tcpshield.tcpshield.provider.PlayerProvider; import net.tcpshield.tcpshield.util.ReflectionUtil; @@ -71,13 +71,12 @@ public void setIP(InetSocketAddress ip) throws PlayerManipulationException { try { this.ip = ip.getAddress().getHostAddress(); - MinimalInjector ignored = TemporaryPlayerFactory.getInjectorFromPlayer(player); - Object injector = ReflectionUtil.getObjectInPrivateField(ignored, "injector"); - Object networkManager = ReflectionUtil.getObjectInPrivateField(injector, "networkManager"); + Injector ignored = TemporaryPlayerFactory.getInjectorFromPlayer(player); + Object networkManager = ReflectionUtil.getObjectInPrivateField(ignored, "networkManager"); ReflectionUtil.setFinalField(networkManager, ReflectionUtil.searchFieldByClass(networkManager.getClass(), SocketAddress.class), ip); - Object channel = ReflectionUtil.getObjectInPrivateField(injector, "wrappedChannel"); + Object channel = ReflectionUtil.getObjectInPrivateField(ignored, "channel"); ReflectionUtil.setFinalField(channel, ReflectionUtil.getDeclaredField(abstractChannelClass, "remoteAddress"), ip); } catch (Exception e) { throw new PlayerManipulationException(e); diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml index a84c412..1216e12 100644 --- a/src/main/resources/bungee.yml +++ b/src/main/resources/bungee.yml @@ -1,5 +1,5 @@ name: TCPShield -version: 2.8.0 +version: 2.8.1 main: net.tcpshield.tcpshield.bungee.TCPShieldBungee author: https://tcpshield.com softdepends: diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5509524..a7cc202 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: TCPShield -version: 2.8.0 +version: 2.8.1 main: net.tcpshield.tcpshield.bukkit.TCPShieldBukkit softdepend: - ProtocolLib diff --git a/src/main/resources/velocity-plugin.json b/src/main/resources/velocity-plugin.json index 0b7069b..67837b4 100644 --- a/src/main/resources/velocity-plugin.json +++ b/src/main/resources/velocity-plugin.json @@ -1,7 +1,7 @@ { "id": "tcpshield", "name": "TCPShield", - "version": "2.8.0", + "version": "2.8.1", "description": "TCPShield IP parsing capabilities for Velocity", "authors": [ "TCPShield"