From 4bd2d8040ea89fa7dd527fdd643668cd08984d5e Mon Sep 17 00:00:00 2001 From: Dawson <30784509+funkemunky@users.noreply.github.com> Date: Mon, 27 Jun 2022 16:35:51 -0400 Subject: [PATCH 1/4] Fixing path temporarily so gradle can build --- build.gradle | 6 +++--- src/main/resources/velocity-plugin.json | 17 +---------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index baa2522..234301a 100644 --- a/build.gradle +++ b/build.gradle @@ -140,8 +140,8 @@ void updateYamls() { def yaml = new Yaml(options) - def bukkitYamlFile = new File('src/main/resources/plugin.yml') - def bungeeYamlFile = new File('src/main/resources/bungee.yml') + def bukkitYamlFile = new File('F:\\Dev\\RealIP\\src\\main\\resources\\plugin.yml') + def bungeeYamlFile = new File('F:\\Dev\\RealIP\\src\\main\\resources\\bungee.yml') def files = [bukkitYamlFile, bungeeYamlFile] files.each { file -> @@ -157,7 +157,7 @@ void updateYamls() { } void updateJsons() { - def velocityJson = new File('src/main/resources/velocity-plugin.json') + def velocityJson = new File('F:\\Dev\\RealIP\\src\\main\\resources\\velocity-plugin.json') def files = [velocityJson] files.each { file -> diff --git a/src/main/resources/velocity-plugin.json b/src/main/resources/velocity-plugin.json index 18f8bb7..25e559e 100644 --- a/src/main/resources/velocity-plugin.json +++ b/src/main/resources/velocity-plugin.json @@ -1,16 +1 @@ -{ - "id": "tcpshield", - "name": "TCPShield", - "version": "2.5.6", - "description": "TCPShield IP parsing capabilities for Velocity", - "authors": [ - "TCPShield" - ], - "dependencies": [ - { - "id": "floodgate", - "optional": true - } - ], - "main": "net.tcpshield.tcpshield.velocity.TCPShieldVelocity" -} \ No newline at end of file +{"id":"tcpshield","name":"TCPShield","version":"2.5.6","description":"TCPShield IP parsing capabilities for Velocity","authors":["TCPShield"],"dependencies":[{"id":"floodgate","optional":true}],"main":"net.tcpshield.tcpshield.velocity.TCPShieldVelocity"} \ No newline at end of file From 692b8ef8a176fb39246d7762836e6322bb359952 Mon Sep 17 00:00:00 2001 From: Dawson <30784509+funkemunky@users.noreply.github.com> Date: Mon, 27 Jun 2022 16:41:30 -0400 Subject: [PATCH 2/4] Updating for ProtocolLib 5.0.0 --- build.gradle | 2 +- .../bukkit/protocollib/handler/ProtocolLibPlayer.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 234301a..3aa1133 100644 --- a/build.gradle +++ b/build.gradle @@ -95,7 +95,7 @@ repositories { dependencies { // Bukkit compileOnly group: 'org.spigotmc', name: 'spigot-api', version: '1.11-R0.1-SNAPSHOT' - compileOnly group: 'com.comphenix.protocol', name: 'ProtocolLib', version: '4.4.0' + compileOnly group: 'com.comphenix.protocol', name: 'ProtocolLib', version: '5.0.0-SNAPSHOT' // Paper compileOnly group: 'com.destroystokyo.paper', name: 'paper-api', version: '1.15.2-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 79e89fd..c0a99e8 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,7 +1,7 @@ package net.tcpshield.tcpshield.bukkit.protocollib.handler; -import com.comphenix.protocol.injector.server.SocketInjector; -import com.comphenix.protocol.injector.server.TemporaryPlayerFactory; +import com.comphenix.protocol.injector.temporary.MinimalInjector; +import com.comphenix.protocol.injector.temporary.TemporaryPlayerFactory; import net.tcpshield.tcpshield.provider.PlayerProvider; import net.tcpshield.tcpshield.util.ReflectionUtil; import net.tcpshield.tcpshield.util.exception.manipulate.PlayerManipulationException; @@ -72,7 +72,7 @@ public void setIP(InetSocketAddress ip) throws PlayerManipulationException { try { this.ip = ip.getAddress().getHostAddress(); - SocketInjector ignored = TemporaryPlayerFactory.getInjectorFromPlayer(player); + MinimalInjector ignored = TemporaryPlayerFactory.getInjectorFromPlayer(player); Object injector = ReflectionUtil.getObjectInPrivateField(ignored, "injector"); Object networkManager = ReflectionUtil.getObjectInPrivateField(injector, "networkManager"); From 23da5f5369927ad5c3789ef1be03b22fea122791 Mon Sep 17 00:00:00 2001 From: Dawson <30784509+funkemunky@users.noreply.github.com> Date: Mon, 27 Jun 2022 16:42:54 -0400 Subject: [PATCH 3/4] Revert "Fixing path temporarily so gradle can build" This reverts commit 4bd2d8040ea89fa7dd527fdd643668cd08984d5e. --- build.gradle | 6 +++--- src/main/resources/velocity-plugin.json | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 3aa1133..a2b30d2 100644 --- a/build.gradle +++ b/build.gradle @@ -140,8 +140,8 @@ void updateYamls() { def yaml = new Yaml(options) - def bukkitYamlFile = new File('F:\\Dev\\RealIP\\src\\main\\resources\\plugin.yml') - def bungeeYamlFile = new File('F:\\Dev\\RealIP\\src\\main\\resources\\bungee.yml') + def bukkitYamlFile = new File('src/main/resources/plugin.yml') + def bungeeYamlFile = new File('src/main/resources/bungee.yml') def files = [bukkitYamlFile, bungeeYamlFile] files.each { file -> @@ -157,7 +157,7 @@ void updateYamls() { } void updateJsons() { - def velocityJson = new File('F:\\Dev\\RealIP\\src\\main\\resources\\velocity-plugin.json') + def velocityJson = new File('src/main/resources/velocity-plugin.json') def files = [velocityJson] files.each { file -> diff --git a/src/main/resources/velocity-plugin.json b/src/main/resources/velocity-plugin.json index 25e559e..18f8bb7 100644 --- a/src/main/resources/velocity-plugin.json +++ b/src/main/resources/velocity-plugin.json @@ -1 +1,16 @@ -{"id":"tcpshield","name":"TCPShield","version":"2.5.6","description":"TCPShield IP parsing capabilities for Velocity","authors":["TCPShield"],"dependencies":[{"id":"floodgate","optional":true}],"main":"net.tcpshield.tcpshield.velocity.TCPShieldVelocity"} \ No newline at end of file +{ + "id": "tcpshield", + "name": "TCPShield", + "version": "2.5.6", + "description": "TCPShield IP parsing capabilities for Velocity", + "authors": [ + "TCPShield" + ], + "dependencies": [ + { + "id": "floodgate", + "optional": true + } + ], + "main": "net.tcpshield.tcpshield.velocity.TCPShieldVelocity" +} \ No newline at end of file From 827f835280a0734e0a7090651696bc9f8b38a926 Mon Sep 17 00:00:00 2001 From: Dawson <30784509+funkemunky@users.noreply.github.com> Date: Mon, 27 Jun 2022 17:28:34 -0400 Subject: [PATCH 4/4] Totally fixed now --- .../protocollib/handler/ProtocolLibPlayer.java | 4 +++- src/main/resources/velocity-plugin.json | 17 +---------------- 2 files changed, 4 insertions(+), 17 deletions(-) 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 c0a99e8..7a1e52f 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 @@ -73,12 +73,14 @@ public void setIP(InetSocketAddress ip) throws PlayerManipulationException { this.ip = ip.getAddress().getHostAddress(); MinimalInjector ignored = TemporaryPlayerFactory.getInjectorFromPlayer(player); + + System.out.println(ignored); Object injector = ReflectionUtil.getObjectInPrivateField(ignored, "injector"); Object networkManager = ReflectionUtil.getObjectInPrivateField(injector, "networkManager"); ReflectionUtil.setFinalField(networkManager, ReflectionUtil.searchFieldByClass(networkManager.getClass(), SocketAddress.class), ip); - Object channel = ReflectionUtil.getObjectInPrivateField(injector, "originalChannel"); + Object channel = ReflectionUtil.getObjectInPrivateField(injector, "wrappedChannel"); ReflectionUtil.setFinalField(channel, ReflectionUtil.getDeclaredField(abstractChannelClass, "remoteAddress"), ip); } catch (Exception e) { throw new PlayerManipulationException(e); diff --git a/src/main/resources/velocity-plugin.json b/src/main/resources/velocity-plugin.json index 18f8bb7..25e559e 100644 --- a/src/main/resources/velocity-plugin.json +++ b/src/main/resources/velocity-plugin.json @@ -1,16 +1 @@ -{ - "id": "tcpshield", - "name": "TCPShield", - "version": "2.5.6", - "description": "TCPShield IP parsing capabilities for Velocity", - "authors": [ - "TCPShield" - ], - "dependencies": [ - { - "id": "floodgate", - "optional": true - } - ], - "main": "net.tcpshield.tcpshield.velocity.TCPShieldVelocity" -} \ No newline at end of file +{"id":"tcpshield","name":"TCPShield","version":"2.5.6","description":"TCPShield IP parsing capabilities for Velocity","authors":["TCPShield"],"dependencies":[{"id":"floodgate","optional":true}],"main":"net.tcpshield.tcpshield.velocity.TCPShieldVelocity"} \ No newline at end of file