Skip to content

Commit 1629334

Browse files
committed
fix issue with signature verification due to erroneous event, 2.5.4 release
1 parent 8cb66fc commit 1629334

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,28 @@ public VelocityHandshakeHandler(TCPShieldPlugin plugin) {
2020
this.plugin = plugin;
2121
}
2222

23-
@Subscribe(order = PostOrder.FIRST)
24-
public void onPreLogin(PreLoginEvent e) {
25-
InboundConnection connection = e.getConnection();
26-
handleEvent(connection);
27-
}
23+
// Turns out this event sometimes passes erroneous hostnames
24+
// which have the null bytes terminated as FML data which causes
25+
// issues with the verification process.
26+
// @Subscribe(order = PostOrder.FIRST)
27+
// public void onPreLogin(PreLoginEvent e) {
28+
// InboundConnection connection = e.getConnection();
29+
// handleEvent(connection, "onPreLogin");
30+
// }
2831

2932
@Subscribe(order = PostOrder.FIRST)
3033
public void onHandshake(ConnectionHandshakeEvent e) {
3134
InboundConnection connection = e.getConnection();
32-
handleEvent(connection);
35+
handleEvent(connection, "onHandshake");
3336
}
3437

3538
@Subscribe(order = PostOrder.FIRST)
3639
public void onProxyPing(ProxyPingEvent e) {
3740
InboundConnection connection = e.getConnection();
38-
handleEvent(connection);
41+
handleEvent(connection, "onProxyPing");
3942
}
4043

41-
42-
private void handleEvent(InboundConnection connection) {
44+
private void handleEvent(InboundConnection connection, String debugSource) {
4345
VelocityPlayer player = new VelocityPlayer(connection);
4446
if (player.isLegacy()) {
4547
player.disconnect();
@@ -48,7 +50,7 @@ private void handleEvent(InboundConnection connection) {
4850

4951
VelocityPacket packet = new VelocityPacket(connection);
5052

51-
this.plugin.getDebugger().warn("Velocity: Raw player hostname: " + packet.getPayloadString());
53+
this.plugin.getDebugger().warn("Velocity: " + debugSource + " Raw player hostname: " + packet.getPayloadString());
5254

5355
try {
5456
plugin.getPacketHandler().handleHandshake(packet, player);

0 commit comments

Comments
 (0)