2020-01-24 23:41:39 +01:00
From 3260c592ab79a6b338f7f69712043155c3f7a7bf Mon Sep 17 00:00:00 2001
2016-05-28 18:34:39 +02:00
From: Tux <write@imaginarycode.com>
2018-05-28 22:53:01 +02:00
Date: Tue, 19 Jan 2016 15:13:29 -0700
2016-05-28 18:34:39 +02:00
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).
2016-12-09 13:56:14 +01:00
- 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
2016-05-28 18:34:39 +02:00
2016-12-09 13:56:14 +01:00
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
2020-01-21 18:36:22 +01:00
index 8d13d49f..5643684c 100644
2016-12-09 13:56:14 +01:00
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
2020-01-21 18:36:22 +01:00
@@ -523,7 +523,9 @@ public class BungeeCord extends ProxyServer
2016-12-09 13:56:14 +01:00
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
2020-01-24 23:41:39 +01:00
index 99e7376b..6d5b00c2 100644
2016-12-09 13:56:14 +01:00
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
2020-01-24 23:41:39 +01:00
@@ -243,7 +243,6 @@ public class DownstreamBridge extends PacketHandler
2016-12-09 13:56:14 +01:00
@Override
public void handle(PluginMessage pluginMessage) throws Exception
{
- DataInput in = pluginMessage.getStream();
2017-12-05 20:14:11 +01:00
PluginMessageEvent event = new PluginMessageEvent( server, con, pluginMessage.getTag(), pluginMessage.getData().clone() );
2016-12-09 13:56:14 +01:00
if ( bungee.getPluginManager().callEvent( event ).isCancelled() )
2020-01-24 23:41:39 +01:00
@@ -270,6 +269,7 @@ public class DownstreamBridge extends PacketHandler
2016-12-09 13:56:14 +01:00
if ( pluginMessage.getTag().equals( "BungeeCord" ) )
{
+ DataInput in = pluginMessage.getStream();
ByteArrayDataOutput out = ByteStreams.newDataOutput();
String subChannel = in.readUTF();
2016-05-28 18:34:39 +02:00
--
2020-01-21 18:36:22 +01:00
2.25.0
2016-05-28 18:34:39 +02:00