Waterfall/BungeeCord-Patches/0058-ServerConnectRequest-sendFeedback.patch
Shane Freeder 25ecd402f3
Updated Upstream (BungeeCord)
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

BungeeCord Changes:
1a807731 #3567: Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.2 to 3.6.3
772ad995 #3566: Bump actions/setup-java from 3 to 4
2431c40a #3562: Bump io.netty:netty-bom from 4.1.100.Final to 4.1.101.Final
8144ae8d #3555: Bump com.mysql:mysql-connector-j from 8.1.0 to 8.2.0
0757c39a Attempt upgrade of resolver libraries
2023-12-13 15:18:04 +00:00

95 lines
4.9 KiB
Diff

From 04ddae3da84541c43f749b212babe1304c24a35f Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Fri, 16 Apr 2021 06:29:28 +0100
Subject: [PATCH] ServerConnectRequest#sendFeedback
diff --git a/api/src/main/java/net/md_5/bungee/api/ServerConnectRequest.java b/api/src/main/java/net/md_5/bungee/api/ServerConnectRequest.java
index c81b0a4e..d21370be 100644
--- a/api/src/main/java/net/md_5/bungee/api/ServerConnectRequest.java
+++ b/api/src/main/java/net/md_5/bungee/api/ServerConnectRequest.java
@@ -68,6 +68,14 @@ public class ServerConnectRequest
*/
@Setter
private boolean retry;
+ // Waterfall start
+ /**
+ * Should feedback from the request be sent to players, allows plugins
+ * to silently deal with the outcome on their own
+ */
+ @Setter
+ private boolean sendFeedback;
+ // Waterfall end
/**
* Class that sets default properties/adds methods to the lombok builder
@@ -77,5 +85,6 @@ public class ServerConnectRequest
{
private int connectTimeout = ProxyServer.getInstance().getConfig().getServerConnectTimeout();
+ private boolean isSendFeedback = true; // Waterfall # God. f##king. lombok.
}
}
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 1d3b7a9d..6c83039d 100644
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
@@ -295,12 +295,16 @@ public final class UserConnection implements ProxiedPlayer
connect(info, callback, retry, ServerConnectEvent.Reason.PLUGIN, timeout);
}
- public void connect(ServerInfo info, final Callback<Boolean> callback, final boolean retry, ServerConnectEvent.Reason reason, final int timeout)
+ public void connect(ServerInfo info, final Callback<Boolean> callback, final boolean retry, ServerConnectEvent.Reason reason, final int timeout) {
+ this.connect(info, callback, retry, reason, timeout, true);
+ }
+
+ public void connect(ServerInfo info, final Callback<Boolean> callback, final boolean retry, ServerConnectEvent.Reason reason, final int timeout, boolean sendFeedback)
{
// Waterfall end
Preconditions.checkNotNull( info, "info" );
- ServerConnectRequest.Builder builder = ServerConnectRequest.builder().retry( retry ).reason( reason ).target( info );
+ ServerConnectRequest.Builder builder = ServerConnectRequest.builder().retry( retry ).reason( reason ).target( info ).sendFeedback(sendFeedback); // Waterfall - feedback param
builder.connectTimeout(timeout); // Waterfall
if ( callback != null )
{
@@ -348,7 +352,7 @@ public final class UserConnection implements ProxiedPlayer
callback.done( ServerConnectRequest.Result.ALREADY_CONNECTED, null );
}
- sendMessage( bungee.getTranslation( "already_connected" ) );
+ if (request.isSendFeedback()) sendMessage( bungee.getTranslation( "already_connected" ) ); // Waterfall
return;
}
if ( pendingConnects.contains( target ) )
@@ -358,7 +362,7 @@ public final class UserConnection implements ProxiedPlayer
callback.done( ServerConnectRequest.Result.ALREADY_CONNECTING, null );
}
- sendMessage( bungee.getTranslation( "already_connecting" ) );
+ if (request.isSendFeedback()) sendMessage( bungee.getTranslation( "already_connecting" ) ); // Waterfall
return;
}
@@ -394,14 +398,14 @@ public final class UserConnection implements ProxiedPlayer
ServerInfo def = updateAndGetNextServer( target );
if ( request.isRetry() && def != null && ( getServer() == null || def != getServer().getInfo() ) )
{
- sendMessage( bungee.getTranslation( "fallback_lobby" ) );
- connect( def, null, true, ServerConnectEvent.Reason.LOBBY_FALLBACK, request.getConnectTimeout() ); // Waterfall
+ if (request.isSendFeedback()) sendMessage( bungee.getTranslation( "fallback_lobby" ) ); // Waterfall
+ connect( def, null, true, ServerConnectEvent.Reason.LOBBY_FALLBACK, request.getConnectTimeout(), request.isSendFeedback() ); // Waterfall
} else if ( dimensionChange )
{
disconnect( bungee.getTranslation( "fallback_kick", connectionFailMessage( future.cause() ) ) );
} else
{
- sendMessage( bungee.getTranslation( "fallback_kick", connectionFailMessage( future.cause() ) ) );
+ if (request.isSendFeedback()) sendMessage( bungee.getTranslation( "fallback_kick", connectionFailMessage( future.cause() ) ) );
}
}
}
--
2.43.0