mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-02-14 02:41:38 +01:00
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Do note that OSX natives are now compiled for Apple Silicon, Long Live ARM BungeeCord Changes: 6f70b15e Minecraft 1.20.5 support b30499e2 #3667: Bump org.apache.maven.plugins:maven-jar-plugin from 3.4.0 to 3.4.1 5079181c Minecraft 1.20.5-rc3 support ee02d98c Minecraft 1.20.5-rc2 support c7ff3b8a #3654: Update year in README.md de60af0d #3659: Cleanup command packets for 1.20.5 a9218a7a #3660: Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.3 to 3.2.4 67c65e04 #3658: Minecraft 1.20.5-rc1 support 1be25b6c #3656: Improve online mode support where IP forwarding is disabled 8525b449 Minecraft 1.20.5-pre3 support 1fca510a #3655: Fix 1.20.5-pre1 view distance packet ID 33841852 #3652: Bump org.apache.maven.plugins:maven-jar-plugin from 3.3.0 to 3.4.0 3075d2c1 #3651: Bump io.netty:netty-bom from 4.1.108.Final to 4.1.109.Final bc528d5d Update native libraries 25cf8d68 #3617: Don't go further if connection is disconnected during handshake event 17e23d5c #3628: Convert PostLoginEvent to AsyncEvent and expose target server d6c5197c #3599: Bump com.mysql:mysql-connector-j from 8.2.0 to 8.3.0 dd96f0f8 #3647: Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.2 to 3.2.3 8a9501ff Minecraft 1.20.5-pre1 support
138 lines
5.9 KiB
Diff
138 lines
5.9 KiB
Diff
From a1cd3244c064607b5bc98a9ea9fb5b6ed244c852 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Sun, 15 Oct 2023 00:36:38 +0100
|
|
Subject: [PATCH] Prevent proxy commands from breaking the chat chain system
|
|
|
|
|
|
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java b/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
|
|
index 33b246bc..7f5935c3 100644
|
|
--- a/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
|
|
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
|
|
@@ -277,5 +277,9 @@ public abstract class AbstractPacketHandler
|
|
public void handle(net.md_5.bungee.protocol.packet.EntityRemoveEffect removeEffect) throws Exception
|
|
{
|
|
}
|
|
+
|
|
+ public void handle(net.md_5.bungee.protocol.packet.ClientChatAcknowledgement clientChatAcknowledgement)
|
|
+ {
|
|
+ }
|
|
// 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 7a29eb0d..67e0f085 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
|
|
@@ -546,6 +546,13 @@ public enum Protocol
|
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x05 ),
|
|
map( ProtocolConstants.MINECRAFT_1_20_5, 0x06 )
|
|
);
|
|
+ // Waterfall start
|
|
+ TO_SERVER.registerPacket(
|
|
+ net.md_5.bungee.protocol.packet.ClientChatAcknowledgement.class,
|
|
+ net.md_5.bungee.protocol.packet.ClientChatAcknowledgement::new,
|
|
+ map (ProtocolConstants.MINECRAFT_1_19_3, 0x3)
|
|
+ );
|
|
+ // Waterfall end
|
|
TO_SERVER.registerPacket(
|
|
TabCompleteRequest.class,
|
|
TabCompleteRequest::new,
|
|
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientChatAcknowledgement.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientChatAcknowledgement.java
|
|
new file mode 100644
|
|
index 00000000..08ecf2a3
|
|
--- /dev/null
|
|
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientChatAcknowledgement.java
|
|
@@ -0,0 +1,33 @@
|
|
+package net.md_5.bungee.protocol.packet;
|
|
+
|
|
+import io.netty.buffer.ByteBuf;
|
|
+import lombok.AllArgsConstructor;
|
|
+import lombok.Data;
|
|
+import lombok.EqualsAndHashCode;
|
|
+import lombok.NoArgsConstructor;
|
|
+import net.md_5.bungee.protocol.AbstractPacketHandler;
|
|
+import net.md_5.bungee.protocol.DefinedPacket;
|
|
+import net.md_5.bungee.protocol.ProtocolConstants;
|
|
+
|
|
+@Data
|
|
+@NoArgsConstructor
|
|
+@AllArgsConstructor
|
|
+@EqualsAndHashCode(callSuper = false)
|
|
+public class ClientChatAcknowledgement extends DefinedPacket {
|
|
+ private int offset;
|
|
+
|
|
+ @Override
|
|
+ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
|
|
+ this.offset = DefinedPacket.readVarInt(buf);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
|
|
+ DefinedPacket.writeVarInt(this.offset, buf);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void handle(AbstractPacketHandler handler) throws Exception {
|
|
+ handler.handle(this);
|
|
+ }
|
|
+}
|
|
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientCommand.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientCommand.java
|
|
index 887ff29f..d4700090 100644
|
|
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientCommand.java
|
|
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientCommand.java
|
|
@@ -108,4 +108,9 @@ public class ClientCommand extends DefinedPacket
|
|
{
|
|
handler.handle( this );
|
|
}
|
|
+
|
|
+ public boolean isSigned() {
|
|
+ if (salt == 0) return false;
|
|
+ return this.seenMessages != null && !this.seenMessages.getAcknowledged().isEmpty();
|
|
+ }
|
|
}
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
|
|
index 2dafa4d9..b482fe2e 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
|
|
@@ -196,16 +196,22 @@ public class UpstreamBridge extends PacketHandler
|
|
@Override
|
|
public void handle(ClientCommand command) throws Exception
|
|
{
|
|
- handleChat( "/" + command.getCommand() );
|
|
+ handleChat( "/" + command.getCommand(), command );
|
|
}
|
|
|
|
@Override
|
|
public void handle(UnsignedClientCommand command) throws Exception
|
|
{
|
|
- handleChat( "/" + command.getCommand() );
|
|
+ handleChat( "/" + command.getCommand(), null); // Waterfall
|
|
}
|
|
|
|
private String handleChat(String message)
|
|
+ {
|
|
+ // Waterfall start
|
|
+ return handleChat(message, null);
|
|
+ }
|
|
+ private String handleChat(String message, @javax.annotation.Nullable ClientCommand clientCommand)
|
|
+ // Waterfall end
|
|
{
|
|
for ( int index = 0, length = message.length(); index < length; index++ )
|
|
{
|
|
@@ -224,7 +230,13 @@ public class UpstreamBridge extends PacketHandler
|
|
if ( !chatEvent.isCommand() || !bungee.getPluginManager().dispatchCommand( con, message.substring( 1 ) ) )
|
|
{
|
|
return message;
|
|
+ // Waterfall start - We're going to cancel this packet, so, no matter what, we might as well try to send this
|
|
+ } else if (clientCommand != null && clientCommand.isSigned() && clientCommand.getSeenMessages() != null) {
|
|
+ if (con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_19_3) {
|
|
+ con.getServer().unsafe().sendPacket(new net.md_5.bungee.protocol.packet.ClientChatAcknowledgement(clientCommand.getSeenMessages().getOffset()));
|
|
+ }
|
|
}
|
|
+ // Waterfall end
|
|
}
|
|
throw CancelSendSignal.INSTANCE;
|
|
}
|
|
--
|
|
2.44.0
|
|
|