Skip to content

Commit bb7511d

Browse files
committed
Ignore new ServerData packet that was throwing errors
1 parent 78666de commit bb7511d

6 files changed

Lines changed: 23 additions & 21 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ plugins {
2626
// --
2727
// Variables
2828
// --
29-
version = '2.6.0'
29+
version = '2.6.1'
3030
group = 'net.tcpshield.tcpshield'
3131
archivesBaseName = 'TCPShield'
3232

src/main/java/net/tcpshield/tcpshield/velocity/handler/VelocityHandshakeHandler.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ public class VelocityHandshakeHandler {
1616

1717
private final TCPShieldPlugin plugin;
1818

19+
20+
private static Class<?> CONNECTED_PLAYER_CONNECTION_CLASS;
21+
22+
static {
23+
try {
24+
CONNECTED_PLAYER_CONNECTION_CLASS = Class.forName("com.velocitypowered.proxy.connection.client.ConnectedPlayer");
25+
} catch (Exception e) {
26+
// ignore for old velocity versions
27+
}
28+
}
29+
1930
public VelocityHandshakeHandler(TCPShieldPlugin plugin) {
2031
this.plugin = plugin;
2132
}
@@ -42,6 +53,12 @@ public void onHandshake(ConnectionHandshakeEvent e) {
4253
@Subscribe(order = PostOrder.FIRST)
4354
public void onProxyPing(ProxyPingEvent e) {
4455
InboundConnection connection = e.getConnection();
56+
57+
if (connection.getClass() == CONNECTED_PLAYER_CONNECTION_CLASS) {
58+
// new ServerData (0x42) packet on connect, we don't care about it
59+
return;
60+
}
61+
4562
handleEvent(connection, "onProxyPing");
4663
}
4764

src/main/java/net/tcpshield/tcpshield/velocity/handler/VelocityPlayer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import net.tcpshield.tcpshield.provider.PlayerProvider;
55
import net.tcpshield.tcpshield.util.ReflectionUtil;
66
import net.tcpshield.tcpshield.util.exception.manipulate.PlayerManipulationException;
7-
import net.tcpshield.tcpshield.util.exception.phase.HandshakeException;
87
import net.tcpshield.tcpshield.util.exception.phase.InitializationException;
98
import net.tcpshield.tcpshield.util.exception.phase.ReflectionException;
109

@@ -27,6 +26,7 @@ public class VelocityPlayer implements PlayerProvider {
2726
private static final Method CLOSE_CHANNEL_METHOD;
2827

2928
// new velocity support
29+
3030
private static Class<?> LOGIN_INBOUND_CONNECTION_CLASS;
3131
private static Field LOGIN_INBOUND_CONNECTION_DELEGATE_FIELD;
3232

@@ -149,7 +149,7 @@ public ConnectionType getConnectionType() {
149149
}
150150

151151
enum ConnectionType {
152-
LOGIN_INBOUND, INITIAL_INBOUND, LEGACY;
152+
LOGIN_INBOUND, INITIAL_INBOUND, LEGACY
153153
}
154154

155155
}

src/main/resources/bungee.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: TCPShield
2-
version: 2.6.0
2+
version: 2.6.1
33
main: net.tcpshield.tcpshield.bungee.TCPShieldBungee
44
author: https://tcpshield.com
55
softdepends:

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: TCPShield
2-
version: 2.6.0
2+
version: 2.6.1
33
main: net.tcpshield.tcpshield.bukkit.TCPShieldBukkit
44
softdepend:
55
- ProtocolLib
Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1 @@
1-
{
2-
"id": "tcpshield",
3-
"name": "TCPShield",
4-
"version": "2.6.0",
5-
"description": "TCPShield IP parsing capabilities for Velocity",
6-
"authors": [
7-
"TCPShield"
8-
],
9-
"dependencies": [
10-
{
11-
"id": "floodgate",
12-
"optional": true
13-
}
14-
],
15-
"main": "net.tcpshield.tcpshield.velocity.TCPShieldVelocity"
16-
}
1+
{"id":"tcpshield","name":"TCPShield","version":"2.6.1","description":"TCPShield IP parsing capabilities for Velocity","authors":["TCPShield"],"dependencies":[{"id":"floodgate","optional":true}],"main":"net.tcpshield.tcpshield.velocity.TCPShieldVelocity"}

0 commit comments

Comments
 (0)