Waterfall/BungeeCord-Patches/0016-Micro-optimizations.patch
Shane Freeder cca83dfaf6
Updated Upstream (BungeeCord)
Upstream has released updates that appears 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:
a3ab2bf5 Update checkstyle
adee7bd2 Source jar does not need to fork build
7bd8a027 Always print remote IP in InitialHandler
0cf27a09 Update scriptus
bf673c5d Add pretty colours to console log levels
2235a323 Optimize ColouredWriter slightly
1dee0490 Don't send/construct redundant kick messages
e9ba95b9 Don't log full CorruptedFrameException
d3bd7852 #2762: Work correctly with disabled timeout
3ce4132c Switch keepalive queue to ArrayDeque
ce2dcaf7 #2763: Fix .DS_Store entry in .gitignore
cf72c3a7 Show slow event times in milliseconds
cd7a3ab2 #2758: Improve server list ping response where remote ping failed
0a4b9b49 #2752: Configurable connect and ping timeouts
2020-02-01 15:39:53 +00:00

48 lines
2.5 KiB
Diff

From 91cb5ca08458019081a0c4f463d2df21451da80f Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Tue, 19 Jan 2016 15:13:29 -0700
Subject: [PATCH] Micro-optimizations
- PluginManager.dispatchCommand() avoids regex while splitting commands. Java 7 introduced an optimized String.split() that should be used instead (affects command dispatch).
- Don't attempt to format arguments when there are none provided
- 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/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
index 8d13d49f..5643684c 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
@@ -523,7 +523,9 @@ public class BungeeCord extends ProxyServer
String translation = "<translation '" + name + "' missing>";
try
{
- translation = MessageFormat.format( customBundle != null && customBundle.containsKey( name ) ? customBundle.getString( name ) : baseBundle.getString( name ), args );
+ final String string = customBundle != null && customBundle.containsKey( name ) ? customBundle.getString( name ) : baseBundle.getString( name );
+
+ translation = ( args.length == 0 ) ? string : MessageFormat.format( string, args );
} catch ( MissingResourceException ex )
{
}
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 a2f62648..ea905b07 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
@@ -244,7 +244,6 @@ public class DownstreamBridge extends PacketHandler
@Override
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() )
@@ -271,6 +270,7 @@ public class DownstreamBridge extends PacketHandler
if ( pluginMessage.getTag().equals( "BungeeCord" ) )
{
+ DataInput in = pluginMessage.getStream();
ByteArrayDataOutput out = ByteStreams.newDataOutput();
String subChannel = in.readUTF();
--
2.25.0