Waterfall/BungeeCord-Patches/0015-Micro-optimizations.patch
Shane Freeder 8050674c86
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:
5467e3a8 Minecraft 1.19.3 support
2022-12-07 16:30:18 +00:00

33 lines
1.6 KiB
Diff

From feede4c38be31f029da9c86306795c9b94ae1e69 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/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index 1059c67f..889e60c2 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
@@ -275,7 +275,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() )
@@ -302,6 +301,7 @@ public class DownstreamBridge extends PacketHandler
if ( pluginMessage.getTag().equals( "BungeeCord" ) )
{
+ DataInput in = pluginMessage.getStream();
ByteArrayDataOutput out = ByteStreams.newDataOutput();
String subChannel = in.readUTF();
--
2.38.1