Skip to content

Commit

Permalink
Updated Upstream (BungeeCord)
Browse files Browse the repository at this point in the history
  • Loading branch information
linsaftw committed Jun 27, 2024
1 parent 8c0c227 commit 19f4a1b
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 72e674dd91fa98eb9bdca61cd5becd7c689b88ad Mon Sep 17 00:00:00 2001
From 9b09a73558eac56a5efc84426364c0955b3ae91f Mon Sep 17 00:00:00 2001
From: Techcable <[email protected]>
Date: Tue, 3 May 2016 20:31:52 -0700
Subject: [PATCH] Don't access a ByteBuf's underlying array
Expand Down Expand Up @@ -43,7 +43,7 @@ index 70b292f0..91f71c09 100644
* Allow this packet to be sent as an "extended" packet.
*/
diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
index abdbfd1d..04bd6778 100644
index d7359891..d8788eac 100644
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
@@ -277,7 +277,7 @@ public class ServerConnector extends PacketHandler
Expand All @@ -56,10 +56,10 @@ index abdbfd1d..04bd6778 100644
}

diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index 4684bfd8..63be43eb 100644
index d518d05f..21019091 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -313,7 +313,7 @@ public class DownstreamBridge extends PacketHandler
@@ -325,7 +325,7 @@ public class DownstreamBridge extends PacketHandler

brand = ByteBufAllocator.DEFAULT.heapBuffer();
DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand, brand );
Expand All @@ -82,5 +82,5 @@ index 25f045be..544d34ed 100644
{
@Override
--
2.44.0.windows.1
2.45.1.windows.1

8 changes: 4 additions & 4 deletions BungeeCord-Patches/0014-Micro-optimizations.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From bb34cf5b0af983268bb5dadb3a654c2e5fc1118a Mon Sep 17 00:00:00 2001
From 8225b4e2ded6253f3693d5f2e4e97c81156c3745 Mon Sep 17 00:00:00 2001
From: Tux <[email protected]>
Date: Tue, 19 Jan 2016 15:13:29 -0700
Subject: [PATCH] Micro-optimizations
Expand All @@ -8,18 +8,18 @@ Subject: [PATCH] Micro-optimizations
- Don't create a data input stream for every plugin message we get from servers

diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index 63be43eb..d408840d 100644
index 21019091..b501f7bd 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -295,7 +295,6 @@ public class DownstreamBridge extends PacketHandler
@@ -307,7 +307,6 @@ public class DownstreamBridge extends PacketHandler
@SuppressWarnings("checkstyle:avoidnestedblocks")
public void handle(PluginMessage pluginMessage) throws Exception
{
- DataInput in = pluginMessage.getStream();
PluginMessageEvent event = new PluginMessageEvent( server, con, pluginMessage.getTag(), pluginMessage.getData().clone() );

if ( bungee.getPluginManager().callEvent( event ).isCancelled() )
@@ -322,6 +321,7 @@ public class DownstreamBridge extends PacketHandler
@@ -334,6 +333,7 @@ public class DownstreamBridge extends PacketHandler

if ( pluginMessage.getTag().equals( "BungeeCord" ) )
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 87f07bb36b0f0f65c0538ba4ca147ffda6d08515 Mon Sep 17 00:00:00 2001
From f57f4aae90269c9136e34ddbe8df9be0f2087580 Mon Sep 17 00:00:00 2001
From: Janmm14 <[email protected]>
Date: Sat, 12 Dec 2015 23:43:30 +0100
Subject: [PATCH] Improve server list ping logging
Expand All @@ -19,10 +19,10 @@ index a25a493e..63920e7e 100644
}
}
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index d408840d..cd3ed518 100644
index b501f7bd..1c075a9f 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -790,6 +790,6 @@ public class DownstreamBridge extends PacketHandler
@@ -802,6 +802,6 @@ public class DownstreamBridge extends PacketHandler
@Override
public String toString()
{
Expand Down
17 changes: 9 additions & 8 deletions BungeeCord-Patches/0024-Improve-ServerKickEvent.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From ca8d1499412759331247d9b4ce9497090bd9f749 Mon Sep 17 00:00:00 2001
From 884fc88771e4181832238676b4e89becebc0e86d Mon Sep 17 00:00:00 2001
From: Nathan Poirier <[email protected]>
Date: Tue, 28 Jun 2016 23:00:49 -0500
Subject: [PATCH] Improve ServerKickEvent
Expand Down Expand Up @@ -81,7 +81,7 @@ index 63920e7e..e10f33ad 100644
{
// Pre cancel the event if we are going to try another server
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index cd3ed518..d4036c5d 100644
index 1c075a9f..0a42327d 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -98,16 +98,19 @@ public class DownstreamBridge extends PacketHandler
Expand All @@ -96,7 +96,7 @@ index cd3ed518..d4036c5d 100644
{
server.setObsolete( true );
- con.connectNow( def, ServerConnectEvent.Reason.SERVER_DOWN_REDIRECT );
- con.sendMessage( bungee.getTranslation( "server_went_down" ) );
- con.sendMessage( bungee.getTranslation( "server_went_down", def.getName() ) );
- } else
+ con.connectNow( event.getCancelServer(), ServerConnectEvent.Reason.SERVER_DOWN_REDIRECT );
+ }
Expand All @@ -109,11 +109,12 @@ index cd3ed518..d4036c5d 100644
}

@Override
@@ -122,7 +125,19 @@ public class DownstreamBridge extends PacketHandler
@@ -125,8 +128,19 @@ public class DownstreamBridge extends PacketHandler

if ( !server.isObsolete() )
if ( server.isObsolete() )
{
- con.disconnect( bungee.getTranslation( "lost_connection" ) );
- // do not perform any actions if the user has already moved
- return;
+ // Waterfall start
+ ServerInfo def = con.updateAndGetNextServer( server.getInfo() );
+ ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( con, server.getInfo(), TextComponent.fromLegacyText( bungee.getTranslation( "lost_connection" ) ), def, ServerKickEvent.State.CONNECTED, ServerKickEvent.Cause.LOST_CONNECTION ) );
Expand All @@ -129,8 +130,8 @@ index cd3ed518..d4036c5d 100644
+ // Waterfall end
}

ServerDisconnectEvent serverDisconnectEvent = new ServerDisconnectEvent( con, server.getInfo() );
@@ -633,10 +648,14 @@ public class DownstreamBridge extends PacketHandler
ServerInfo def = con.updateAndGetNextServer( server.getInfo() );
@@ -645,10 +659,14 @@ public class DownstreamBridge extends PacketHandler
public void handle(Kick kick) throws Exception
{
ServerInfo def = con.updateAndGetNextServer( server.getInfo() );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 07d5ed3fed134435890f4d730fbe10eaf7e20b9f Mon Sep 17 00:00:00 2001
From 603879024844f4b7f537290b6f887b98056b7858 Mon Sep 17 00:00:00 2001
From: Aaron Hill <[email protected]>
Date: Thu, 15 Sep 2016 22:38:37 +0200
Subject: [PATCH] Fix potion race condition on Forge 1.8.9
Expand Down Expand Up @@ -142,10 +142,10 @@ index d8f7bc95..d15f2bcc 100644
@Setter
private String lastCommandTabbed;
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index d4036c5d..ad9fc042 100644
index 0a42327d..b106f9e7 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -753,6 +753,32 @@ public class DownstreamBridge extends PacketHandler
@@ -764,6 +764,32 @@ public class DownstreamBridge extends PacketHandler
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 5cb75d2de7802dc3033b4f3c5c87e238b94539a4 Mon Sep 17 00:00:00 2001
From efba89c1574333a8c234e53f55590cc9b319042c Mon Sep 17 00:00:00 2001
From: Shane Freeder <[email protected]>
Date: Mon, 14 Jan 2019 03:35:21 +0000
Subject: [PATCH] Provide an option to disable entity metadata rewriting
Expand Down Expand Up @@ -137,18 +137,18 @@ index d15f2bcc..b8762fc0 100644
+ // Waterfall end
}
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index ad9fc042..6ed25f82 100644
index b106f9e7..1333749a 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -757,6 +757,7 @@ public class DownstreamBridge extends PacketHandler
@@ -768,6 +768,7 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(net.md_5.bungee.protocol.packet.EntityEffect entityEffect) throws Exception
{
+ if (con.isDisableEntityMetadataRewrite()) return; // Waterfall
// Don't send any potions when switching between servers (which involves a handshake), which can trigger a race
// condition on the client.
if (this.con.getForgeClientHandler().isForgeUser() && !this.con.getForgeClientHandler().isHandshakeComplete()) {
@@ -768,6 +769,7 @@ public class DownstreamBridge extends PacketHandler
@@ -779,6 +780,7 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(net.md_5.bungee.protocol.packet.EntityRemoveEffect removeEffect) throws Exception
{
Expand Down
6 changes: 3 additions & 3 deletions BungeeCord-Patches/0044-Add-ProxyDefineCommandsEvent.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 5a165d466eee9edbc9cfc0b81d3e0e18f79d2b1f Mon Sep 17 00:00:00 2001
From b191f26529512f7c7da176d0f10a62df5120bde1 Mon Sep 17 00:00:00 2001
From: Shane Freeder <[email protected]>
Date: Thu, 14 Mar 2019 07:44:06 +0000
Subject: [PATCH] Add ProxyDefineCommandsEvent
Expand Down Expand Up @@ -54,10 +54,10 @@ index 00000000..1fd4fc90
+
+}
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index 6ed25f82..1a863dc0 100644
index 1333749a..3a326669 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -792,9 +792,25 @@ public class DownstreamBridge extends PacketHandler
@@ -803,9 +803,25 @@ public class DownstreamBridge extends PacketHandler
{
boolean modified = false;

Expand Down
68 changes: 44 additions & 24 deletions BungeeCord-Patches/0046-OSX-native-zlib-and-crypto.patch
Original file line number Diff line number Diff line change
@@ -1,38 +1,58 @@
From 1953a977d054cf14c3cea5dc5641f49274b51b12 Mon Sep 17 00:00:00 2001
From 4821ec357a780ce34ad0b65798fd8564b5ba8a89 Mon Sep 17 00:00:00 2001
From: Colin Godsey <[email protected]>
Date: Tue, 16 Apr 2019 07:25:52 -0600
Subject: [PATCH] OSX native zlib and crypto


diff --git a/native/compile-native.sh b/native/compile-native.sh
index c342e782..0af5f481 100755
index 5b6e54c4..90633d80 100755
--- a/native/compile-native.sh
+++ b/native/compile-native.sh
@@ -9,6 +9,16 @@ echo "Compiling zlib"
@@ -8,20 +8,34 @@ echo "Compiling mbedtls"
echo "Compiling zlib"
(cd zlib && CFLAGS=-fPIC ./configure --static && make)

CXX="g++ -shared -fPIC -O3 -Wall -Werror -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/"
+# Waterfall - rewrite below to extend platform support
+echo "Compiling zlib"
+(cd zlib && CFLAGS=-fPIC ./configure --static && make)
+
CC="gcc"
CFLAGS="-c -fPIC -O3 -Wall -Werror -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/"
LDFLAGS="-shared"

echo "Compiling bungee"
$CC $CFLAGS -o shared.o src/main/c/shared.c
-$CC $CFLAGS -Imbedtls/include -o NativeCipherImpl.o src/main/c/NativeCipherImpl.c
-$CC $CFLAGS -Izlib -o NativeCompressImpl.o src/main/c/NativeCompressImpl.c

-$CXX -Imbedtls/include src/main/c/NativeCipherImpl.cpp -o src/main/resources/native-cipher.so mbedtls/library/libmbedcrypto.a
-$CXX -Izlib src/main/c/NativeCompressImpl.cpp -o src/main/resources/native-compress.so zlib/libz.a
+# Determine platform-specific flags
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ PREFIX="osx-"
+ CXX_ARGS="-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin/"
+else
+ CXX_ARGS="-I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/ -Wl,--wrap=memcpy"
+fi
+
+CXX="g++ -shared -fPIC -O3 -Wall -Werror"
+# Compile and link NativeCipherImpl
+$CC $CFLAGS -Imbedtls/include -o NativeCipherImpl.o src/main/c/NativeCipherImpl.c
echo "Linking native-cipher.so"
-$CC $LDFLAGS -o src/main/resources/native-cipher.so shared.o NativeCipherImpl.o mbedtls/library/libmbedcrypto.a
+$CC $LDFLAGS -o src/main/resources/${PREFIX:-}native-cipher.so shared.o NativeCipherImpl.o mbedtls/library/libmbedcrypto.a $CXX_ARGS

+# Compile and link NativeCompressImpl
+$CC $CFLAGS -Izlib -o NativeCompressImpl.o src/main/c/NativeCompressImpl.c
echo "Linking native-compress.so"
-$CC $LDFLAGS -o src/main/resources/native-compress.so shared.o NativeCompressImpl.o zlib/libz.a
+$CC $LDFLAGS -o src/main/resources/${PREFIX:-}native-compress.so shared.o NativeCompressImpl.o zlib/libz.a $CXX_ARGS

echo "Cleaning up"
rm shared.o NativeCipherImpl.o NativeCompressImpl.o
+
+$CXX -Imbedtls/include src/main/c/NativeCipherImpl.cpp -o src/main/resources/${PREFIX:-}native-cipher.so mbedtls/library/libmbedcrypto.a $CXX_ARGS
+$CXX -Izlib src/main/c/NativeCompressImpl.cpp -o src/main/resources/${PREFIX:-}native-compress.so zlib/libz.a $CXX_ARGS
diff --git a/native/src/main/c/NativeCipherImpl.cpp b/native/src/main/c/NativeCipherImpl.cpp
index cfe5f089..42fdb540 100644
--- a/native/src/main/c/NativeCipherImpl.cpp
+++ b/native/src/main/c/NativeCipherImpl.cpp
@@ -4,6 +4,14 @@
#include <mbedtls/aes.h>
diff --git a/native/src/main/c/NativeCipherImpl.c b/native/src/main/c/NativeCipherImpl.c
index 727a2f1f..a0b9319b 100644
--- a/native/src/main/c/NativeCipherImpl.c
+++ b/native/src/main/c/NativeCipherImpl.c
@@ -5,6 +5,14 @@
#include "shared.h"
#include "net_md_5_bungee_jni_cipher_NativeCipherImpl.h"

+// Support for CentOS 6
Expand All @@ -45,13 +65,13 @@ index cfe5f089..42fdb540 100644
+
typedef unsigned char byte;

struct crypto_context {
diff --git a/native/src/main/c/NativeCompressImpl.cpp b/native/src/main/c/NativeCompressImpl.cpp
index 4b93a56a..8fa0bd61 100644
--- a/native/src/main/c/NativeCompressImpl.cpp
+++ b/native/src/main/c/NativeCompressImpl.cpp
@@ -4,6 +4,14 @@
#include <zlib.h>
typedef struct crypto_context {
diff --git a/native/src/main/c/NativeCompressImpl.c b/native/src/main/c/NativeCompressImpl.c
index 7fb8e6b9..64402246 100644
--- a/native/src/main/c/NativeCompressImpl.c
+++ b/native/src/main/c/NativeCompressImpl.c
@@ -5,6 +5,14 @@
#include "shared.h"
#include "net_md_5_bungee_jni_zlib_NativeCompressImpl.h"

+// Support for CentOS 6
Expand All @@ -64,7 +84,7 @@ index 4b93a56a..8fa0bd61 100644
+
typedef unsigned char byte;

static jfieldID consumedID;
static jclass classID;
diff --git a/native/src/main/java/net/md_5/bungee/jni/NativeCode.java b/native/src/main/java/net/md_5/bungee/jni/NativeCode.java
index 62bdaa0e..f4f6e6ab 100644
--- a/native/src/main/java/net/md_5/bungee/jni/NativeCode.java
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From de16a46893f820c4f38abbba4ad02f6234820ab2 Mon Sep 17 00:00:00 2001
From bffc58f4927bc2d3c3c01f7a73753ed10e4772e0 Mon Sep 17 00:00:00 2001
From: xDark <[email protected]>
Date: Fri, 31 May 2019 08:11:31 +0300
Subject: [PATCH] Allow to disable tablist rewrite
Expand Down Expand Up @@ -50,10 +50,10 @@ index e860214f..b88e3c8a 100644
+ }
}
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index 1a863dc0..d5405b90 100644
index 3a326669..bc64d2f1 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -174,8 +174,14 @@ public class DownstreamBridge extends PacketHandler
@@ -185,8 +185,14 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(PlayerListItem playerList) throws Exception
{
Expand Down
6 changes: 3 additions & 3 deletions BungeeCord-Patches/0051-Remove-version-from-brand-info.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From 0da75822f0a8e66d2dc60b4dbe53ccb0de60cf62 Mon Sep 17 00:00:00 2001
From 0de7674bb6d760ed4053d318a0bd1d6d26b3eaa7 Mon Sep 17 00:00:00 2001
From: Shane Freeder <[email protected]>
Date: Sat, 20 Jun 2020 18:21:17 +0100
Subject: [PATCH] Remove version from brand info


diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index d5405b90..3bca89be 100644
index bc64d2f1..f2c82e96 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -332,7 +332,7 @@ public class DownstreamBridge extends PacketHandler
@@ -343,7 +343,7 @@ public class DownstreamBridge extends PacketHandler
Preconditions.checkState( !serverBrand.contains( bungee.getName() ), "Cannot connect proxy to itself!" );

brand = ByteBufAllocator.DEFAULT.heapBuffer();
Expand Down

0 comments on commit 19f4a1b

Please sign in to comment.