Merge pull request #9 from foss-mc/patch-split-patches

Split Patches
This commit is contained in:
LinsaFTW 2021-02-23 15:06:16 -03:00 committed by GitHub
commit f8473a9ab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 1171 additions and 899 deletions

View File

@ -0,0 +1,56 @@
From 9a7e67bef272c161ca784e54492e95e50140f384 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 17:57:23 +0800
Subject: [PATCH] Make PlayerHandshakeEvent cancellable
diff --git a/api/src/main/java/net/md_5/bungee/api/event/PlayerHandshakeEvent.java b/api/src/main/java/net/md_5/bungee/api/event/PlayerHandshakeEvent.java
index 2f7b38d9..e29b0ed3 100644
--- a/api/src/main/java/net/md_5/bungee/api/event/PlayerHandshakeEvent.java
+++ b/api/src/main/java/net/md_5/bungee/api/event/PlayerHandshakeEvent.java
@@ -2,8 +2,11 @@ package net.md_5.bungee.api.event;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
import lombok.ToString;
import net.md_5.bungee.api.connection.PendingConnection;
+import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;
import net.md_5.bungee.protocol.packet.Handshake;
@@ -14,8 +17,11 @@ import net.md_5.bungee.protocol.packet.Handshake;
@Data
@ToString(callSuper = false)
@EqualsAndHashCode(callSuper = false)
-public class PlayerHandshakeEvent extends Event
-{
+// FlameCord - Implement cancellable
+public class PlayerHandshakeEvent extends Event implements Cancellable {
+ @Getter
+ @Setter
+ private boolean cancelled = false;
/**
* Connection attempting to login.
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index fe6ff143..c2ec12b4 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -341,7 +341,11 @@ public class InitialHandler extends PacketHandler implements PendingConnection
this.virtualHost = InetSocketAddress.createUnresolved( handshake.getHost(), handshake.getPort() );
- bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) );
+ // FlameCord - Make PlayerHandshakeEvent cancellable
+ if (bungee.getPluginManager().callEvent(new PlayerHandshakeEvent(InitialHandler.this, handshake)).isCancelled()) {
+ ch.close();
+ return;
+ }
switch ( handshake.getRequestedProtocol() )
{
--
2.20.1

View File

@ -0,0 +1,23 @@
From dc79f49dd3b926c3f156f66dd6996fcfd00a47b3 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 17:58:18 +0800
Subject: [PATCH] Make a getter for the callback
diff --git a/api/src/main/java/net/md_5/bungee/api/event/AsyncEvent.java b/api/src/main/java/net/md_5/bungee/api/event/AsyncEvent.java
index cf85ca06..8a945a99 100644
--- a/api/src/main/java/net/md_5/bungee/api/event/AsyncEvent.java
+++ b/api/src/main/java/net/md_5/bungee/api/event/AsyncEvent.java
@@ -25,7 +25,8 @@ import net.md_5.bungee.api.plugin.Plugin;
@EqualsAndHashCode(callSuper = true)
public class AsyncEvent<T> extends Event
{
-
+ // FlameCord - Make a getter for the callback
+ @Getter
private final Callback<T> done;
private final Map<Plugin, AtomicInteger> intents = new ConcurrentHashMap<>();
private final AtomicBoolean fired = new AtomicBoolean();
--
2.20.1

View File

@ -0,0 +1,148 @@
From 01363a40e321d368c0b686792a491cf892c1bf47 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 17:59:15 +0800
Subject: [PATCH] FlameCord POM Changes
diff --git a/flamecord/pom.xml b/flamecord/pom.xml
new file mode 100644
index 00000000..dd511dac
--- /dev/null
+++ b/flamecord/pom.xml
@@ -0,0 +1,44 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>io.github.waterfallmc</groupId>
+ <artifactId>travertine-parent</artifactId>
+ <version>1.16-R0.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>dev._2lstudios</groupId>
+ <artifactId>travertine-flamecord</artifactId>
+ <version>1.16-R0.4-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>Travertine-FlameCord</name>
+ <description>FlameCord adds security essentials and new configuration options</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.github.waterfallmc</groupId>
+ <artifactId>travertine-config</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.github.waterfallmc</groupId>
+ <artifactId>travertine-chat</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${project.name}</finalName>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>${basedir}/src/main/resources</directory>
+ </resource>
+ </resources>
+ </build>
+</project>
diff --git a/pom.xml b/pom.xml
index 1b773cc5..099e78d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,6 +62,9 @@
<module>proxy</module>
<module>query</module>
<module>native</module>
+ <!-- FlameCord start - Add modules -->
+ <module>flamecord</module>
+ <!-- FlameCord end -->
</modules>
<scm>
diff --git a/protocol/pom.xml b/protocol/pom.xml
index ba3ffe3d..9228f72a 100644
--- a/protocol/pom.xml
+++ b/protocol/pom.xml
@@ -64,5 +64,14 @@
<version>1.3.0</version>
<scope>compile</scope>
</dependency>
+
+ <!-- FlameCord start - Add our dependencies -->
+ <dependency>
+ <groupId>dev._2lstudios</groupId>
+ <artifactId>travertine-flamecord</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- FlameCord end -->
</dependencies>
</project>
diff --git a/proxy/pom.xml b/proxy/pom.xml
index 4bda0d62..0018d6f8 100644
--- a/proxy/pom.xml
+++ b/proxy/pom.xml
@@ -113,6 +113,51 @@
<scope>runtime</scope>
</dependency>
<!-- Waterfall end -->
+
+ <!-- FlameCord start - Add our dependencies -->
+ <dependency>
+ <groupId>dev._2lstudios</groupId>
+ <artifactId>travertine-flamecord</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.github.waterfallmc</groupId>
+ <artifactId>travertine-module-cmd-alert</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.github.waterfallmc</groupId>
+ <artifactId>travertine-module-cmd-find</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.github.waterfallmc</groupId>
+ <artifactId>travertine-module-cmd-list</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.github.waterfallmc</groupId>
+ <artifactId>travertine-module-cmd-send</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.github.waterfallmc</groupId>
+ <artifactId>travertine-module-cmd-server</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.github.waterfallmc</groupId>
+ <artifactId>travertine-module-reconnect-yaml</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- FlameCord end -->
</dependencies>
<build>
--
2.20.1

View File

@ -0,0 +1,74 @@
From a931b0886161c8af9c8478dce3786c5de61b987e Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:00:49 +0800
Subject: [PATCH] Disable update checker & Use bungee name
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java b/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java
index ad9a6d0c..ad8f8733 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java
@@ -40,25 +40,12 @@ public class BungeeCordLauncher
return;
}
- if ( BungeeCord.class.getPackage().getSpecificationVersion() != null && System.getProperty( "IReallyKnowWhatIAmDoingISwear" ) == null )
- {
- Date buildDate = new SimpleDateFormat( "yyyyMMdd" ).parse( BungeeCord.class.getPackage().getSpecificationVersion() );
-
- Calendar deadline = Calendar.getInstance();
- deadline.add( Calendar.WEEK_OF_YEAR, -8 );
- if ( buildDate.before( deadline.getTime() ) )
- {
- System.err.println( "*** Hey! This build is potentially outdated :( ***" );
- System.err.println( "*** Please check for a new build from https://papermc.io/ci/job/Travertine/ ***" );
- System.err.println( "*** Should this build be outdated, you will get NO support for it. ***" );
- System.err.println( "*** Server will start in 10 seconds ***" );
- Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) );
- }
- }
+ // FlameCord - Disable update checker
BungeeCord bungee = new BungeeCord();
ProxyServer.setInstance( bungee );
- bungee.getLogger().info( "Enabled Travertine version " + bungee.getVersion() );
+ // FlameCord - Use bungee name
+ bungee.getLogger().info( "Enabled " + bungee.getName() + " version " + bungee.getVersion() );
bungee.start();
if ( !options.has( "noconsole" ) )
diff --git a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java
index d4fad294..7994c1c1 100644
--- a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java
+++ b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java
@@ -22,6 +22,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
import lombok.RequiredArgsConstructor;
+import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.Util;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.ProxyServer;
@@ -227,7 +228,8 @@ public class YamlConfig implements ConfigurationAdapter
Map<String, Object> val = entry.getValue();
String name = entry.getKey();
String addr = get( "address", "localhost:25565", val );
- String motd = ChatColor.translateAlternateColorCodes( '&', get( "motd", "&1Just another Travertine - Forced Host", val ) );
+ // FlameCord - Use Bungee name instead
+ String motd = ChatColor.translateAlternateColorCodes( '&', get( "motd", "&1Just another " + BungeeCord.getInstance().getName() + " - Forced Host", val ) );
boolean restricted = get( "restricted", false, val );
SocketAddress address = Util.getAddr( addr );
ServerInfo info = ProxyServer.getInstance().constructServerInfo( name, address, motd, restricted );
@@ -253,7 +255,8 @@ public class YamlConfig implements ConfigurationAdapter
for ( Map<String, Object> val : base )
{
- String motd = get( "motd", "&1Another Bungee server", val );
+ // FlameCord - Use Bungee name instead
+ String motd = get( "motd", "&1Another " + BungeeCord.getInstance().getName() + " server", val );
motd = ChatColor.translateAlternateColorCodes( '&', motd );
int maxPlayers = get( "max_players", 1, val );
--
2.20.1

View File

@ -0,0 +1,23 @@
From dca58a6a7ae25120b8aeccbe4f3ecf2c7fbef6a0 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:01:37 +0800
Subject: [PATCH] Change replaceAll() to replace()
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 c12085e1..44f257ae 100644
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
@@ -125,7 +125,8 @@ public class ServerConnector extends PacketHandler
newp[newp.length - 2] = new LoginResult.Property( ForgeConstants.FML_LOGIN_PROFILE, "true", null );
// If we do not perform the replacement, then the IP Forwarding code in Spigot et. al. will try to split on this prematurely.
- newp[newp.length - 1] = new LoginResult.Property( ForgeConstants.EXTRA_DATA, user.getExtraDataInHandshake().replaceAll( "\0", "\1"), "" );
+ // FlameCord - Change replaceAll() to replace()
+ newp[newp.length - 1] = new LoginResult.Property( ForgeConstants.EXTRA_DATA, user.getExtraDataInHandshake().replace( "\0", "\1"), "" );
// All done.
properties = newp;
--
2.20.1

View File

@ -0,0 +1,67 @@
From 80ace46853567b268136b98cab869eb2dd495846 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:03:12 +0800
Subject: [PATCH] Remove "Quitting" reason
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 44f257ae..e90237ac 100644
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
@@ -267,7 +267,8 @@ public class ServerConnector extends PacketHandler
user.getSentBossBars().clear();
user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(), false ) );
- user.getServer().disconnect( "Quitting" );
+ // FlameCord - Remove "Quitting" reason
+ user.getServer().disconnect();
} else
{
// Travertine start
@@ -362,13 +363,15 @@ public class ServerConnector extends PacketHandler
user.setDimension( login.getDimension() );
// Remove from old servers
- user.getServer().disconnect( "Quitting" );
+ // FlameCord - Remove "Quitting" reason
+ user.getServer().disconnect();
}
// TODO: Fix this?
if ( !user.isActive() )
{
- server.disconnect( "Quitting" );
+ // FlameCord - Remove "Quitting" reason
+ server.disconnect();
// Silly server admins see stack trace and die
bungee.getLogger().warning( "No client connected for pending server!" );
return;
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 986a9d05..6cc520c9 100644
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
@@ -425,7 +425,8 @@ public final class UserConnection implements ProxiedPlayer
if ( server != null )
{
server.setObsolete( true );
- server.disconnect( "Quitting" );
+ // FlameCord - Remove "Quitting" reason
+ server.disconnect();
}
}
}
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 ad3bdee5..c05714ba 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
@@ -92,6 +92,7 @@ public class UpstreamBridge extends PacketHandler
}
// Travertine end
}
+ // FlameCord - Remove "Quitting" reason
con.getServer().disconnect( "Quitting" );
}
}
--
2.20.1

View File

@ -0,0 +1,188 @@
From e2a93fffc50d08cc1d1a97d5c8b713add74feb69 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:06:17 +0800
Subject: [PATCH] Close connections & Don't flush if not necessary
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index c2ec12b4..1be9ae77 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -197,6 +197,13 @@ public class InitialHandler extends PacketHandler implements PendingConnection
}
ServerPing legacy = result.getResponse();
+
+ // FlameCord - Close and return if legacy == null
+ if (legacy == null) {
+ ch.close();
+ return;
+ }
+
String kickMessage;
if ( v1_5 )
@@ -267,6 +274,16 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{
bungee.getConnectionThrottle().unthrottle( getSocketAddress() );
}
+
+ // FlameCord - Close if response is null
+ // FlameCord - Return if connection is closed
+ if (pingResult.getResponse() == null) {
+ ch.close();
+ return;
+ } else if (ch.isClosed()) {
+ return;
+ }
+
// Travertine start
if ( ProtocolConstants.isBeforeOrEq( handshake.getProtocolVersion() , ProtocolConstants.MINECRAFT_1_8 ) )
{
@@ -307,11 +324,11 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@Override
public void handle(PingPacket ping) throws Exception
{
- if (!ACCEPT_INVALID_PACKETS) {
- Preconditions.checkState(thisState == State.PING, "Not expecting PING");
- }
+ // FlameCord - Never accept invalid packets
+ Preconditions.checkState(thisState == State.PING, "Not expecting PING");
unsafe.sendPacket( ping );
- disconnect( "" );
+ // FlameCord - Close instead of disconnect
+ ch.close();
}
@Override
@@ -619,7 +636,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{
if ( canSendKickMessage() )
{
- ch.delayedClose( new Kick( ComponentSerializer.toString( reason ) ) );
+ // FlameCord - Changed delayedClose to close
+ ch.close( new Kick( ComponentSerializer.toString( reason ) ) );
} else
{
ch.close();
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java b/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java
index 6dc5633f..5c05f2b9 100644
--- a/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java
+++ b/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java
@@ -80,40 +80,27 @@ public class ChannelWrapper
if ( packet != null && ch.isActive() )
{
- ch.writeAndFlush( packet ).addListeners( ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE, ChannelFutureListener.CLOSE );
+ // FlameCord - Remove the firing of exceptions on failure
+ ch.writeAndFlush( packet ).addListeners( ChannelFutureListener.CLOSE );
} else
{
- ch.flush();
+ // FlameCord - Don't flush just close
ch.close();
}
}
}
+ // FlameCord - Deprecate and "disable" delayedClose because it doesn't have a reason to exist
+ @Deprecated
public void delayedClose(final Kick kick)
{
- if ( !closing )
- {
- closing = true;
-
- // Minecraft client can take some time to switch protocols.
- // Sending the wrong disconnect packet whilst a protocol switch is in progress will crash it.
- // Delay 250ms to ensure that the protocol switch (if any) has definitely taken place.
- ch.eventLoop().schedule( new Runnable()
- {
-
- @Override
- public void run()
- {
- close( kick );
- }
- }, 250, TimeUnit.MILLISECONDS );
- }
+ close(kick);
}
public void addBefore(String baseName, String name, ChannelHandler handler)
{
Preconditions.checkState( ch.eventLoop().inEventLoop(), "cannot add handler outside of event loop" );
- ch.pipeline().flush();
+ // FlameCord - Don't flush if not necessary
ch.pipeline().addBefore( baseName, name, handler );
}
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
index 989bfd87..1351d5d5 100644
--- a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
+++ b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
@@ -56,7 +56,8 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
{
if ( handler != null )
{
- channel.markClosed();
+ // FlameCord - close instead of markClosed
+ channel.close();
handler.disconnected( channel );
if ( !( handler instanceof InitialHandler || handler instanceof PingHandler ) )
@@ -180,8 +181,9 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
ProxyServer.getInstance().getLogger().log( Level.SEVERE, handler + " - exception processing exception", ex );
}
}
-
- ctx.close();
}
+
+ // FlameCord - Close even if the channel isn't active
+ ctx.close();
}
}
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
index 9a39f69e..a54da9c3 100644
--- a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
+++ b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
@@ -5,6 +5,7 @@ import io.github.waterfallmc.waterfall.event.ConnectionInitEvent;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.Channel;
import io.netty.channel.ChannelException;
+import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
@@ -102,6 +103,14 @@ public class PipelineUtils
BungeeCord.getInstance().getPluginManager().callEvent(connectionInitEvent);
}
+
+ // FlameCord - Close on exception caught
+ @Override
+ public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception {
+ cause.printStackTrace();
+
+ ctx.close();
+ }
};
public static final Base BASE = new Base();
private static final KickStringWriter legacyKicker = new KickStringWriter();
diff --git a/query/src/main/java/net/md_5/bungee/query/QueryHandler.java b/query/src/main/java/net/md_5/bungee/query/QueryHandler.java
index 0c1ecfb8..b3bdfd05 100644
--- a/query/src/main/java/net/md_5/bungee/query/QueryHandler.java
+++ b/query/src/main/java/net/md_5/bungee/query/QueryHandler.java
@@ -71,6 +71,8 @@ public class QueryHandler extends SimpleChannelInboundHandler<DatagramPacket>
if ( in.readUnsignedByte() != 0xFE || in.readUnsignedByte() != 0xFD )
{
bungee.getLogger().log( Level.WARNING, "Query - Incorrect magic!: {0}", msg.sender() );
+ // FlameCord - Close on incorrect magic
+ ctx.close();
return;
}
--
2.20.1

View File

@ -0,0 +1,157 @@
From 8483549f243a6d8aad3574fc2d6235c3326e2740 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:07:26 +0800
Subject: [PATCH] Use elseIfs
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 d54d8539..0dd2884d 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
@@ -285,6 +285,7 @@ public class DownstreamBridge extends PacketHandler
throw CancelSendSignal.INSTANCE;
}
+ // FlameCord - Use elseIfs
if ( pluginMessage.getTag().equals( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13 ? "minecraft:brand" : "MC|Brand" ) )
{
// Travertine start
@@ -313,8 +314,7 @@ public class DownstreamBridge extends PacketHandler
con.unsafe().sendPacket( pluginMessage );
throw CancelSendSignal.INSTANCE;
}
-
- if ( pluginMessage.getTag().equals( "BungeeCord" ) )
+ else if ( pluginMessage.getTag().equals( "BungeeCord" ) )
{
DataInput in = pluginMessage.getStream();
ByteArrayDataOutput out = ByteStreams.newDataOutput();
@@ -343,7 +343,7 @@ public class DownstreamBridge extends PacketHandler
// Null out stream, important as we don't want to send to ourselves
out = null;
}
- if ( subChannel.equals( "Forward" ) )
+ else if ( subChannel.equals( "Forward" ) )
{
// Read data from server
String target = in.readUTF();
@@ -388,7 +388,7 @@ public class DownstreamBridge extends PacketHandler
}
}
}
- if ( subChannel.equals( "Connect" ) )
+ else if ( subChannel.equals( "Connect" ) )
{
ServerInfo server = bungee.getServerInfo( in.readUTF() );
if ( server != null )
@@ -396,7 +396,7 @@ public class DownstreamBridge extends PacketHandler
con.connect( server, ServerConnectEvent.Reason.PLUGIN_MESSAGE );
}
}
- if ( subChannel.equals( "ConnectOther" ) )
+ else if ( subChannel.equals( "ConnectOther" ) )
{
ProxiedPlayer player = bungee.getPlayer( in.readUTF() );
if ( player != null )
@@ -408,7 +408,7 @@ public class DownstreamBridge extends PacketHandler
}
}
}
- if ( subChannel.equals( "IP" ) )
+ else if ( subChannel.equals( "IP" ) )
{
out.writeUTF( "IP" );
if ( con.getSocketAddress() instanceof InetSocketAddress )
@@ -421,7 +421,7 @@ public class DownstreamBridge extends PacketHandler
out.writeInt( 0 );
}
}
- if ( subChannel.equals( "IPOther" ) )
+ else if ( subChannel.equals( "IPOther" ) )
{
ProxiedPlayer player = bungee.getPlayer( in.readUTF() );
if ( player != null )
@@ -440,7 +440,7 @@ public class DownstreamBridge extends PacketHandler
}
}
}
- if ( subChannel.equals( "PlayerCount" ) )
+ else if ( subChannel.equals( "PlayerCount" ) )
{
String target = in.readUTF();
out.writeUTF( "PlayerCount" );
@@ -458,7 +458,7 @@ public class DownstreamBridge extends PacketHandler
}
}
}
- if ( subChannel.equals( "PlayerList" ) )
+ else if ( subChannel.equals( "PlayerList" ) )
{
String target = in.readUTF();
out.writeUTF( "PlayerList" );
@@ -476,12 +476,12 @@ public class DownstreamBridge extends PacketHandler
}
}
}
- if ( subChannel.equals( "GetServers" ) )
+ else if ( subChannel.equals( "GetServers" ) )
{
out.writeUTF( "GetServers" );
out.writeUTF( Util.csv( bungee.getServers().keySet() ) );
}
- if ( subChannel.equals( "Message" ) )
+ else if ( subChannel.equals( "Message" ) )
{
String target = in.readUTF();
String message = in.readUTF();
@@ -500,7 +500,7 @@ public class DownstreamBridge extends PacketHandler
}
}
}
- if ( subChannel.equals( "MessageRaw" ) )
+ else if ( subChannel.equals( "MessageRaw" ) )
{
String target = in.readUTF();
BaseComponent[] message = ComponentSerializer.parse( in.readUTF() );
@@ -519,17 +519,17 @@ public class DownstreamBridge extends PacketHandler
}
}
}
- if ( subChannel.equals( "GetServer" ) )
+ else if ( subChannel.equals( "GetServer" ) )
{
out.writeUTF( "GetServer" );
out.writeUTF( server.getInfo().getName() );
}
- if ( subChannel.equals( "UUID" ) )
+ else if ( subChannel.equals( "UUID" ) )
{
out.writeUTF( "UUID" );
out.writeUTF( con.getUUID() );
}
- if ( subChannel.equals( "UUIDOther" ) )
+ else if ( subChannel.equals( "UUIDOther" ) )
{
ProxiedPlayer player = bungee.getPlayer( in.readUTF() );
if ( player != null )
@@ -539,7 +539,7 @@ public class DownstreamBridge extends PacketHandler
out.writeUTF( player.getUUID() );
}
}
- if ( subChannel.equals( "ServerIP" ) )
+ else if ( subChannel.equals( "ServerIP" ) )
{
ServerInfo info = bungee.getServerInfo( in.readUTF() );
if ( info != null && !info.getAddress().isUnresolved() )
@@ -550,7 +550,7 @@ public class DownstreamBridge extends PacketHandler
out.writeShort( info.getAddress().getPort() );
}
}
- if ( subChannel.equals( "KickPlayer" ) )
+ else if ( subChannel.equals( "KickPlayer" ) )
{
ProxiedPlayer player = bungee.getPlayer( in.readUTF() );
if ( player != null )
--
2.20.1

View File

@ -0,0 +1,49 @@
From 7ff984d41446f889b790be1376acae78cddc2fe8 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:10:30 +0800
Subject: [PATCH] Packet Checks
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
index ec932e92..f1f34626 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
@@ -39,6 +39,19 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
}
Protocol.DirectionData prot = ( server ) ? protocol.TO_SERVER : protocol.TO_CLIENT;
+
+ // FlameCord - Check size before decoding
+ if (prot == protocol.TO_SERVER) {
+ final int readableBytes = in.readableBytes();
+ final int capacity = in.capacity();
+
+ if (readableBytes > 2097152) {
+ throw new FastDecoderException("Error decoding packet with too many readableBytes: " + readableBytes);
+ } else if (capacity > 2097152) {
+ throw new FastDecoderException("Error decoding packet with too big capacity: " + capacity);
+ }
+ }
+
ByteBuf slice = in.copy(); // Can't slice this one due to EntityMap :(
Object packetTypeInfo = null;
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
index 1351d5d5..d68cc2ce 100644
--- a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
+++ b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java
@@ -79,6 +79,11 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
{
+ // FlameCord - Return if channel isn't active
+ if (!ctx.channel().isActive()) {
+ return;
+ }
+
if ( msg instanceof HAProxyMessage )
{
HAProxyMessage proxy = (HAProxyMessage) msg;
--
2.20.1

View File

@ -0,0 +1,56 @@
From d4213ec9e7529f96c403a2a6af8f24b6e5aa2242 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:11:48 +0800
Subject: [PATCH] Rebrand
diff --git a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
index 527f310e..a4ef6d3b 100644
--- a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
+++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
@@ -51,7 +51,8 @@ public class WaterfallConfiguration extends Configuration {
YamlConfig config = new YamlConfig(new File("waterfall.yml"));
config.load(false); // Load, but no permissions
logInitialHandlerConnections = config.getBoolean( "log_initial_handler_connections", logInitialHandlerConnections );
- gameVersion = config.getString("game_version", "").isEmpty() ? Joiner.on(", ").join(ProtocolConstants.SUPPORTED_VERSIONS) : config.getString("game_version", "");
+ // FlameCord - Make the version look better
+ gameVersion = config.getString("game_version", "").isEmpty() ? ProtocolConstants.SUPPORTED_VERSIONS.get(0) + "-" + ProtocolConstants.SUPPORTED_VERSIONS.get(ProtocolConstants.SUPPORTED_VERSIONS.size() - 1) : config.getString("game_version", "");
useNettyDnsResolver = config.getBoolean("use_netty_dns_resolver", useNettyDnsResolver);
// Throttling options
tabThrottle = config.getInt("throttling.tab_complete", tabThrottle);
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
index a17ed68e..3e4ebfc5 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
@@ -546,13 +546,13 @@ public class BungeeCord extends ProxyServer
@Override
public String getName()
{
- return "Travertine";
+ return "FlameCord";
}
@Override
public String getVersion()
{
- return ( BungeeCord.class.getPackage().getImplementationVersion() == null ) ? "unknown" : BungeeCord.class.getPackage().getImplementationVersion();
+ return "0.4.6";
}
public void reloadMessages()
diff --git a/proxy/src/main/java/net/md_5/bungee/command/CommandBungee.java b/proxy/src/main/java/net/md_5/bungee/command/CommandBungee.java
index 4e2c6129..aeda7963 100644
--- a/proxy/src/main/java/net/md_5/bungee/command/CommandBungee.java
+++ b/proxy/src/main/java/net/md_5/bungee/command/CommandBungee.java
@@ -16,6 +16,7 @@ public class CommandBungee extends Command
@Override
public void execute(CommandSender sender, String[] args)
{
- sender.sendMessage( ChatColor.BLUE + "This server is running Travertine version " + ProxyServer.getInstance().getVersion() + " by md_5" );
+ // FlameCord - Use custom version message
+ sender.sendMessage( ChatColor.translateAlternateColorCodes( '&', "&eThis server is running &c" + ProxyServer.getInstance().getName() + "&e version &a" + ProxyServer.getInstance().getVersion() + "&e by &bLinsaFTW & Sammwy&e." ) );
}
}
--
2.20.1

View File

@ -0,0 +1,23 @@
From b8e427d68694e1af04e005b78f4c58e161c8ee35 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:14:02 +0800
Subject: [PATCH] Default timeout to 10000
diff --git a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
index 85d2197a..1294495d 100644
--- a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
+++ b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
@@ -35,7 +35,8 @@ public abstract class Configuration implements ProxyConfig
/**
* Time before users are disconnected due to no network activity.
*/
- private int timeout = 30000;
+ // FlameCord - Default timeout to 10000
+ private int timeout = 10000;
/**
* UUID used for metrics.
*/
--
2.20.1

View File

@ -0,0 +1,32 @@
From 7fc05a47e12839eb256a9141ab122886ca788522 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:24:42 +0800
Subject: [PATCH] use address & getHostString
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 0dd2884d..474551d3 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
@@ -542,12 +542,15 @@ public class DownstreamBridge extends PacketHandler
else if ( subChannel.equals( "ServerIP" ) )
{
ServerInfo info = bungee.getServerInfo( in.readUTF() );
- if ( info != null && !info.getAddress().isUnresolved() )
+ // FlameCord use address
+ InetSocketAddress address = info.getAddress();
+ if ( info != null && !address.isUnresolved() )
{
out.writeUTF( "ServerIP" );
out.writeUTF( info.getName() );
- out.writeUTF( info.getAddress().getAddress().getHostAddress() );
- out.writeShort( info.getAddress().getPort() );
+ // FlameCord - Use getHostString
+ out.writeUTF( address.getHostString() );
+ out.writeShort( address.getPort() );
}
}
else if ( subChannel.equals( "KickPlayer" ) )
--
2.20.1

View File

@ -0,0 +1,27 @@
From 1fa924e0e980d172556ff43ee97caee5211c53a0 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:25:03 +0800
Subject: [PATCH] Change state to encrypt only if onlineMode is true
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index 1be9ae77..93486904 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -452,11 +452,12 @@ public class InitialHandler extends PacketHandler implements PendingConnection
if ( onlineMode )
{
unsafe().sendPacket( request = EncryptionUtil.encryptRequest() );
+ // FlameCord - Change state to encrypt only if onlineMode is true
+ thisState = State.ENCRYPT;
} else
{
finish();
}
- thisState = State.ENCRYPT;
}
};
--
2.20.1

View File

@ -0,0 +1,32 @@
From 69632ee3a5f3963b39c933c2dba4d0c3ecf05f6c Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:25:51 +0800
Subject: [PATCH] Don't allow name containing dot
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index 93486904..1f5492fb 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -407,13 +407,16 @@ public class InitialHandler extends PacketHandler implements PendingConnection
Preconditions.checkState( thisState == State.USERNAME, "Not expecting USERNAME" );
this.loginRequest = loginRequest;
- if ( getName().contains( "." ) )
+ // FlameCord - Use name
+ final String name = getName();
+
+ if ( name.contains( "." ) )
{
disconnect( bungee.getTranslation( "name_invalid" ) );
return;
}
- if ( getName().length() > 16 )
+ if ( name.length() > 16 )
{
disconnect( bungee.getTranslation( "name_too_long" ) );
return;
--
2.20.1

View File

@ -0,0 +1,78 @@
From 9c45d17f7e322b01c8a5a55d21b7cb1d65345056 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:30:07 +0800
Subject: [PATCH] Use pipeline to reduce redundancy
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java b/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java
index 5c05f2b9..606866a5 100644
--- a/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java
+++ b/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java
@@ -5,6 +5,8 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelPipeline;
+
import java.net.SocketAddress;
import java.util.concurrent.TimeUnit;
import lombok.Getter;
@@ -37,14 +39,18 @@ public class ChannelWrapper
public void setProtocol(Protocol protocol)
{
- ch.pipeline().get( MinecraftDecoder.class ).setProtocol( protocol );
- ch.pipeline().get( MinecraftEncoder.class ).setProtocol( protocol );
+ // FlameCord - Use pipeline to reduce redundancy
+ final ChannelPipeline pipeline = ch.pipeline();
+ pipeline.get( MinecraftDecoder.class ).setProtocol( protocol );
+ pipeline.get( MinecraftEncoder.class ).setProtocol( protocol );
}
public void setVersion(int protocol)
{
- ch.pipeline().get( MinecraftDecoder.class ).setProtocolVersion( protocol );
- ch.pipeline().get( MinecraftEncoder.class ).setProtocolVersion( protocol );
+ // FlameCord - Use pipeline to reduce redundancy
+ final ChannelPipeline pipeline = ch.pipeline();
+ pipeline.get( MinecraftDecoder.class ).setProtocolVersion( protocol );
+ pipeline.get( MinecraftEncoder.class ).setProtocolVersion( protocol );
}
public void write(Object packet)
@@ -111,25 +117,27 @@ public class ChannelWrapper
public void setCompressionThreshold(int compressionThreshold)
{
- if ( ch.pipeline().get( PacketCompressor.class ) == null && compressionThreshold != -1 )
+ // FlameCord - Use pipeline to reduce redundancy
+ final ChannelPipeline pipeline = ch.pipeline();
+ if ( pipeline.get( PacketCompressor.class ) == null && compressionThreshold != -1 )
{
addBefore( PipelineUtils.PACKET_ENCODER, "compress", new PacketCompressor() );
}
if ( compressionThreshold != -1 )
{
- ch.pipeline().get( PacketCompressor.class ).setThreshold( compressionThreshold );
+ pipeline.get( PacketCompressor.class ).setThreshold( compressionThreshold );
} else
{
- ch.pipeline().remove( "compress" );
+ pipeline.remove( "compress" );
}
- if ( ch.pipeline().get( PacketDecompressor.class ) == null && compressionThreshold != -1 )
+ if ( pipeline.get( PacketDecompressor.class ) == null && compressionThreshold != -1 )
{
addBefore( PipelineUtils.PACKET_DECODER, "decompress", new PacketDecompressor(compressionThreshold) );
}
if ( compressionThreshold == -1 )
{
- ch.pipeline().remove( "decompress" );
+ pipeline.remove( "decompress" );
}
}
}
--
2.20.1

View File

@ -0,0 +1,22 @@
From ce563b65a254311d942f69311fa5e675cbedd48e Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:35:33 +0800
Subject: [PATCH] Allow custom uuids even if onlineMode is true
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index 1f5492fb..b71d25dc 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -698,7 +698,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
public void setUniqueId(UUID uuid)
{
Preconditions.checkState( thisState == State.USERNAME, "Can only set uuid while state is username" );
- Preconditions.checkState( !onlineMode, "Can only set uuid when online mode is false" );
+ // FlameCord - Allow custom uuids even if onlineMode is true
this.uniqueId = uuid;
}
--
2.20.1

View File

@ -0,0 +1,41 @@
From 68c2b0ea3b16f7b571ff8c576f54042f4402e251 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:36:08 +0800
Subject: [PATCH] Finish early to avoid multiple incoming packets
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index b71d25dc..61f80012 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -472,6 +472,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
public void handle(final EncryptionResponse encryptResponse) throws Exception
{
Preconditions.checkState( thisState == State.ENCRYPT, "Not expecting ENCRYPT" );
+ // FlameCord - Finish here to avoid multiple incoming packets
+ thisState = State.FINISHED;
SecretKey sharedKey = EncryptionUtil.getSecret( encryptResponse, request );
BungeeCipher decrypt = EncryptionUtil.getCipher( false, sharedKey );
@@ -524,6 +526,9 @@ public class InitialHandler extends PacketHandler implements PendingConnection
private void finish()
{
+ // FlameCord - Finish here to avoid multiple incoming packets
+ thisState = State.FINISHED;
+
if ( isOnlineMode() )
{
// Check for multiple connections
@@ -605,8 +610,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
}
userCon.connect( server, null, true, ServerConnectEvent.Reason.JOIN_PROXY );
-
- thisState = State.FINISHED;
}
}
} );
--
2.20.1

View File

@ -0,0 +1,24 @@
From 8918151068bb611b3d455693ccea42387cbd3719 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:40:55 +0800
Subject: [PATCH] Change IllegalStateException to QuietException and explain
that is a plugin
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 6cc520c9..159119c1 100644
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
@@ -307,7 +307,8 @@ public final class UserConnection implements ProxiedPlayer
if ( getServer() == null && !ch.isClosing() )
{
- throw new IllegalStateException( "Cancelled ServerConnectEvent with no server or disconnect." );
+ // FlameCord - Change IllegalStateException to QuietException and explain that is a plugin
+ throw new QuietException("A plugin cancelled ServerConnectEvent with no server or disconnect.");
}
return;
}
--
2.20.1

View File

@ -0,0 +1,25 @@
From 67efa4ede50e4b1fbf0d5dc8528b8543424a289b Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Wed, 16 Dec 2020 18:43:17 +0800
Subject: [PATCH] Don't declare uuid unless it's null
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index 61f80012..502e0ae1 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -508,7 +508,10 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{
loginProfile = obj;
name = obj.getName();
- uniqueId = Util.getUUID( obj.getId() );
+ // FlameCord - Don't declare uuid unless it's null
+ if (uniqueId == null) {
+ uniqueId = Util.getUUID(obj.getId());
+ }
finish();
return;
}
--
2.20.1