1
0
mirror of https://github.com/PaperMC/Waterfall.git synced 2025-03-25 12:59:16 +01:00

Fix packet IDs being bork due to optimisation attempt

"static final" is generally inlined, so, while this value shouldn't
be 0 looking at the code, the fact that it was at compile time seems
to have taken a revenge course
This commit is contained in:
Shane Freeder 2022-06-12 13:28:25 +01:00
parent 4e0049a6b1
commit ef0fc26e9d
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C

View File

@ -1,4 +1,4 @@
From d8378f9b9ca04929d9a4fb98959cca3506f0a6b4 Mon Sep 17 00:00:00 2001
From 762364cf2a5d421d0cee0879b1ec4220e5d0198d Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 12 Jun 2022 06:45:54 +0100
Subject: [PATCH] Add protocol version to packet not found message
@ -6,7 +6,7 @@ Subject: [PATCH] Add protocol version to packet not found message
Also avoids a double get, but, this is probably trivial
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
index 1b5189c1..084f7add 100644
index 1b5189c1..f5a675a9 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
@@ -2,6 +2,8 @@ package net.md_5.bungee.protocol;
@ -25,7 +25,7 @@ index 1b5189c1..084f7add 100644
- Preconditions.checkArgument( protocolData.packetMap.containsKey( packet ), "Cannot get ID for packet %s in phase %s with direction %s", packet, protocolPhase, direction );
+ // Waterfall start
+ final int packetId = protocolData.packetMap.get(packet);
+ Preconditions.checkArgument( packetId != gnu.trove.impl.Constants.DEFAULT_INT_NO_ENTRY_VALUE, "Cannot get ID for packet %s in phase %s with direction %s for protocol version %d", packet, protocolPhase, direction, version ); // Waterfall - add version
+ Preconditions.checkArgument( packetId >= 0, "Cannot get ID for packet %s in phase %s with direction %s for protocol version %s", packet, protocolPhase, direction, version ); // Waterfall - add version
- return protocolData.packetMap.get( packet );
+ return packetId;