mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-01-05 23:48:06 +01:00
Add Protocol version to the packet not found messages
Also, remove our own magic marker for not registering further proto versions in favour of upstreams recent addition to handle this
This commit is contained in:
parent
e4f1e3ff8d
commit
4e0049a6b1
@ -1,4 +1,4 @@
|
||||
From 406c4652df1c052e7b0219f8a4e400a34aee01ef Mon Sep 17 00:00:00 2001
|
||||
From f905ea8b649f836d74d32de87355c73670d0f419 Mon Sep 17 00:00:00 2001
|
||||
From: Aaron Hill <aa1ronham@gmail.com>
|
||||
Date: Thu, 15 Sep 2016 22:38:37 +0200
|
||||
Subject: [PATCH] Fix potion race condition on Forge 1.8.9
|
||||
@ -33,7 +33,7 @@ index 35236382..558d0dbb 100644
|
||||
+ // Waterfall end
|
||||
}
|
||||
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 ad0c66a5..014383b3 100644
|
||||
index ad0c66a5..1b5189c1 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
|
||||
@@ -20,6 +20,8 @@ import net.md_5.bungee.protocol.packet.EncryptionRequest;
|
||||
@ -54,30 +54,18 @@ index ad0c66a5..014383b3 100644
|
||||
+ EntityEffect.class,
|
||||
+ EntityEffect::new,
|
||||
+ map(ProtocolConstants.MINECRAFT_1_8, 0x1D),
|
||||
+ map(ProtocolConstants.MINECRAFT_1_9, Integer.MIN_VALUE)
|
||||
+ map(ProtocolConstants.MINECRAFT_1_9, -1)
|
||||
+ );
|
||||
+ TO_CLIENT.registerPacket(
|
||||
+ EntityRemoveEffect.class,
|
||||
+ EntityRemoveEffect::new,
|
||||
+ map(ProtocolConstants.MINECRAFT_1_8, 0x1E),
|
||||
+ map(ProtocolConstants.MINECRAFT_1_9, Integer.MIN_VALUE)
|
||||
+ map(ProtocolConstants.MINECRAFT_1_9, -1)
|
||||
+ );
|
||||
+ // Waterfall end
|
||||
TO_CLIENT.registerPacket(
|
||||
PlayerListItem.class, // PlayerInfo
|
||||
PlayerListItem::new,
|
||||
@@ -620,9 +636,11 @@ public enum Protocol
|
||||
break;
|
||||
}
|
||||
|
||||
+ if (mapping.packetID != Integer.MIN_VALUE) { // Waterfall
|
||||
ProtocolData data = protocols.get( protocol );
|
||||
data.packetMap.put( packetClass, mapping.packetID );
|
||||
data.packetConstructors[mapping.packetID] = constructor;
|
||||
+ } // Waterfall
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/EntityEffect.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EntityEffect.java
|
||||
new file mode 100644
|
||||
index 00000000..d11a9ea9
|
||||
@ -172,7 +160,7 @@ index 00000000..7ed2dc3a
|
||||
+ }
|
||||
+}
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
|
||||
index ccb9efdc..c96117c6 100644
|
||||
index 846f8338..7fe08ecd 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
|
||||
@@ -1,7 +1,9 @@
|
||||
@ -280,5 +268,5 @@ index d15044f4..bea2bbff 100644
|
||||
* Sends the server mod list to the client, or stores it for sending later.
|
||||
*
|
||||
--
|
||||
2.36.1.windows.1
|
||||
2.36.1
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
From d8378f9b9ca04929d9a4fb98959cca3506f0a6b4 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
|
||||
|
||||
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
|
||||
--- 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;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Iterables;
|
||||
+
|
||||
+import gnu.trove.impl.Constants;
|
||||
import gnu.trove.map.TIntObjectMap;
|
||||
import gnu.trove.map.TObjectIntMap;
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
@@ -650,9 +652,12 @@ public enum Protocol
|
||||
{
|
||||
throw new BadPacketException( "Unsupported protocol version" );
|
||||
}
|
||||
- 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
|
||||
|
||||
- return protocolData.packetMap.get( packet );
|
||||
+ return packetId;
|
||||
+ // Waterfall end
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.36.1
|
||||
|
Loading…
Reference in New Issue
Block a user