Merge upstream; remove fire-pit

This commit is contained in:
Jamie Mansfield 2018-09-30 19:17:21 +01:00
parent dd0a4d8be8
commit f7f3cfeb27
No known key found for this signature in database
GPG Key ID: 27F6918C0D47DF94
39 changed files with 52 additions and 689 deletions

@ -1 +1 @@
Subproject commit 98860214282441786d759ae200db4d40d4af6de0
Subproject commit bba5098ff169c0a57ccf8c30c8b9e00e44d1f831

View File

@ -1,4 +1,4 @@
From 7aabe3afd7361973f69bd229ee7334f2d53dd3fb Mon Sep 17 00:00:00 2001
From 555f577cbb568ac8fd28417ebebec22f713a9826 Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Thu, 19 May 2016 19:33:31 +0200
Subject: [PATCH] POM Changes
@ -487,7 +487,7 @@ index 15c0ada2..7073b404 100644
<dependencies>
<dependency>
diff --git a/pom.xml b/pom.xml
index 9cad53d8..81c7165c 100644
index f0bbecfb..ddd91e8d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,18 +3,25 @@
@ -582,7 +582,7 @@ index 9cad53d8..81c7165c 100644
<properties>
<build.number>unknown</build.number>
<netty.version>4.1.25.Final</netty.version>
<netty.version>4.1.30.Final</netty.version>
- <maven.compiler.source>1.7</maven.compiler.source>
- <maven.compiler.target>1.7</maven.compiler.target>
+ <!-- Require Java 8 -->

View File

@ -1,4 +1,4 @@
From a4c060f03113dd6ae08b86396f80f65f716fcd63 Mon Sep 17 00:00:00 2001
From 0253c1e81e0ba939642670b1d68a7e71caaa537e Mon Sep 17 00:00:00 2001
From: Jamie Mansfield <dev@jamierocks.uk>
Date: Thu, 19 May 2016 10:55:20 -0700
Subject: [PATCH] Disable Metrics
@ -172,5 +172,5 @@ index a7ce8d82..00000000
- }
-}
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From 5dd2cfc7123b90e96b0c3023c5f0202b1b4b5bf2 Mon Sep 17 00:00:00 2001
From f8f184cb101633ece93dd65d1d7cf8f54d41ebe5 Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Thu, 19 May 2016 11:34:52 -0700
Subject: [PATCH] Fetch modules from the Waterfall CI
@ -40,5 +40,5 @@ index 2536435c..e1cf0010 100644
} catch ( IOException ex )
{
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From 9eae8e8fc923baa334e53d6ad6934a6f85ef2c69 Mon Sep 17 00:00:00 2001
From 77ebde84a5230eb442dcb33a91c31452d83ce3fa Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Mon, 25 Jan 2016 01:19:07 -0500
Subject: [PATCH] Get rid of the security manager.
@ -103,5 +103,5 @@ index 53c81923..00000000
- }
-}
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From 716366fa0881650256d344ca93b784ba7b64ffd2 Mon Sep 17 00:00:00 2001
From eda3a0cf78e1d41ea4aeb3d09e052314b8a6be5d Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Wed, 13 Apr 2016 15:17:05 -0400
Subject: [PATCH] Presize the HTTP response buffer
@ -19,5 +19,5 @@ index 96d0a71d..bac6b1b0 100644
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From fe62110e228d96e03bb71aafdf33d365c5c658d0 Mon Sep 17 00:00:00 2001
From e7e565face505edda19fc4f24b19b51f648b9e65 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@techcable.net>
Date: Tue, 3 May 2016 20:31:52 -0700
Subject: [PATCH] Don't access a ByteBuf's underlying array
@ -6,7 +6,7 @@ Subject: [PATCH] Don't access a ByteBuf's underlying array
It returns the underlying array storage, and does *not* return a view of the buffer as an array
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java
index 8d4eacbc..04644236 100644
index a71cc710..0e06b49d 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java
@@ -3,6 +3,7 @@ package net.md_5.bungee.protocol.packet;
@ -56,7 +56,7 @@ index d81cda98..29245c94 100644
user.setDimension( login.getDimension() );
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 8f6f5c0f..03794435 100644
index 22a5ac05..d4c58098 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
@@ -242,7 +242,7 @@ public class DownstreamBridge extends PacketHandler
@ -69,7 +69,7 @@ index 8f6f5c0f..03794435 100644
// changes in the packet are ignored so we need to send it manually
con.unsafe().sendPacket( pluginMessage );
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 551ae1e1..be9685b9 100644
index ffee7062..09486b4a 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
@@ -42,9 +42,9 @@ import net.md_5.bungee.protocol.Varint21LengthFieldPrepender;
@ -86,5 +86,5 @@ index 551ae1e1..be9685b9 100644
{
@Override
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From d66b4b15d05ce1243e66a8b29f5c0615d11fa9e5 Mon Sep 17 00:00:00 2001
From 6e372e8642d47083dc0af12366e83f89a6443534 Mon Sep 17 00:00:00 2001
From: kamcio96 <k.nadworski@icloud.com>
Date: Sat, 21 May 2016 17:17:36 -0600
Subject: [PATCH] Fix unicode characters in configuration files
@ -53,5 +53,5 @@ index db8aa4be..9258d7dd 100644
return load( reader, defaults );
}
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From fbed7db1bba999269cd489496076d862a0513cba Mon Sep 17 00:00:00 2001
From d3c6dfe50626400638941023153187a4b993b019 Mon Sep 17 00:00:00 2001
From: Harry <me@harry5573.uk>
Date: Sun, 24 Jan 2016 15:13:29 -0700
Subject: [PATCH] Enable TCP_NODELAY.
@ -6,10 +6,10 @@ Subject: [PATCH] Enable TCP_NODELAY.
This is enabled by default on CraftBukkit/Spigot >= 1.8 and may help with network performance.
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 be9685b9..b0bbc1d7 100644
index 09486b4a..41330ec2 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
@@ -133,6 +133,7 @@ public class PipelineUtils
@@ -134,6 +134,7 @@ public class PipelineUtils
{
// IP_TOS is not supported (Windows XP / Windows Server 2003)
}

View File

@ -1,46 +0,0 @@
From 42bf77d8efdb2be88cad1ad291a2eb0337f0c414 Mon Sep 17 00:00:00 2001
From: Harry <me@harry5573.uk>
Date: Tue, 26 Jan 2016 01:01:57 +0000
Subject: [PATCH] Don't create a new KickStringWriter for each new connection.
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/KickStringWriter.java b/protocol/src/main/java/net/md_5/bungee/protocol/KickStringWriter.java
index eda9571e..e5275c76 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/KickStringWriter.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/KickStringWriter.java
@@ -1,9 +1,11 @@
package net.md_5.bungee.protocol;
import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
+@Sharable
public class KickStringWriter extends MessageToByteEncoder<String>
{
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 b0bbc1d7..0cad5c89 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
@@ -56,7 +56,7 @@ public class PipelineUtils
ch.pipeline().addBefore( FRAME_DECODER, LEGACY_DECODER, new LegacyDecoder() );
ch.pipeline().addAfter( FRAME_DECODER, PACKET_DECODER, new MinecraftDecoder( Protocol.HANDSHAKE, true, ProxyServer.getInstance().getProtocolVersion() ) );
ch.pipeline().addAfter( FRAME_PREPENDER, PACKET_ENCODER, new MinecraftEncoder( Protocol.HANDSHAKE, true, ProxyServer.getInstance().getProtocolVersion() ) );
- ch.pipeline().addBefore( FRAME_PREPENDER, LEGACY_KICKER, new KickStringWriter() );
+ ch.pipeline().addBefore( FRAME_PREPENDER, LEGACY_KICKER, PipelineUtils.KICK_STRING_WRITER );
ch.pipeline().get( HandlerBoss.class ).setHandler( new InitialHandler( BungeeCord.getInstance(), listener ) );
if ( listener.isProxyProtocol() )
@@ -77,6 +77,7 @@ public class PipelineUtils
public static final String FRAME_PREPENDER = "frame-prepender";
public static final String LEGACY_DECODER = "legacy-decoder";
public static final String LEGACY_KICKER = "legacy-kick";
+ private static final KickStringWriter KICK_STRING_WRITER = new KickStringWriter();
private static boolean epoll;
--
2.19.0

View File

@ -1,4 +1,4 @@
From ef45f40dff0368b1ceb9cacb3b77330e9111e0e3 Mon Sep 17 00:00:00 2001
From acc40b9ef7853831675e73f4aee176ea7e856bda Mon Sep 17 00:00:00 2001
From: Janmm14 <computerjanimaus@yahoo.de>
Date: Sat, 12 Dec 2015 23:43:30 +0100
Subject: [PATCH] Optional server list ping logging.

View File

@ -1,4 +1,4 @@
From 3ec7385e988c8680d15111097fa208045e6b3232 Mon Sep 17 00:00:00 2001
From 34d378cba51952d0be676eede8bab2bd1ee7fb35 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Sun, 7 Feb 2016 00:01:19 -0700
Subject: [PATCH] Add a property to accept invalid ping packets

View File

@ -1,4 +1,4 @@
From 04a02d91bae08cef3e601d2ab867e46481b00d2d Mon Sep 17 00:00:00 2001
From bf87adff567326af8fb38fbe5f8dbd8f5575068f Mon Sep 17 00:00:00 2001
From: kamcio96 <k.nadworski@icloud.com>
Date: Mon, 14 Mar 2016 16:07:20 -0700
Subject: [PATCH] Use a worker and a boss event loop group.

View File

@ -1,4 +1,4 @@
From 062ac4f24d2a0a13f957fbb6d62ed3a0b968a894 Mon Sep 17 00:00:00 2001
From 0033c8d2a08a7f23abf23ce5519a1a25e152644d Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@techcable.net>
Date: Fri, 18 Mar 2016 10:53:24 -0700
Subject: [PATCH] Better Decompression Sanity

View File

@ -1,4 +1,4 @@
From 7ff4b1f6cc370a7201062cc00fe9884c19acf2df Mon Sep 17 00:00:00 2001
From fe63aa2e77ed7922cc569a17bd7688d85edf8498 Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Tue, 25 Oct 2016 12:34:41 -0400
Subject: [PATCH] Validate that chat messages are non-blank

View File

@ -1,4 +1,4 @@
From 65fe87a6fdae029e01fd2c96635aa3192e5c1825 Mon Sep 17 00:00:00 2001
From 19ea87698830df73118bb9c1abae7c3cc0ddf77b Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@techcable.net>
Date: Mon, 25 Apr 2016 23:46:00 -0700
Subject: [PATCH] Reduce the overhead of lots and lots of teams with the same

View File

@ -1,4 +1,4 @@
From cecbf55e268ea36c72c850c4f6c086e8996264dc Mon Sep 17 00:00:00 2001
From a18ebcc6c9cbb1e27a759d6f8a51861016665595 Mon Sep 17 00:00:00 2001
From: Troy Frew <fuzzy_bot@arenaga.me>
Date: Wed, 29 Jun 2016 04:29:25 +0200
Subject: [PATCH] Add dynamic server addition/removal api.

View File

@ -1,4 +1,4 @@
From c168478bfee6c8b99ebef5eb0dd56ebce8ed6407 Mon Sep 17 00:00:00 2001
From c089b4f064ac4bece17323bf2e715cec1500dc55 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@techcable.net>
Date: Mon, 6 Jun 2016 13:36:10 -0600
Subject: [PATCH] Don't send KICK packets while in HANDSHAKE state

View File

@ -1,4 +1,4 @@
From 4872b219496840e8052ab036c0742c4e10daa793 Mon Sep 17 00:00:00 2001
From 9e607e607838e80d222e106c7610f6ed6732ac4f Mon Sep 17 00:00:00 2001
From: Nathan Poirier <nathan@poirier.io>
Date: Tue, 28 Jun 2016 23:00:49 -0500
Subject: [PATCH] Improve ServerKickEvent

View File

@ -1,4 +1,4 @@
From 8e7821954fb8a610f11eaf9c80f67d318ab4081e Mon Sep 17 00:00:00 2001
From d6793fa77ac0f2c27a92d2445f9066c1d340be94 Mon Sep 17 00:00:00 2001
From: Troy Frew <fuzzy_bot@arenaga.me>
Date: Wed, 29 Jun 2016 13:56:57 -0500
Subject: [PATCH] Configurable server version in ping response

View File

@ -1,4 +1,4 @@
From 042244f3cc15ebaf7b3263fcf1f525a75ec771cb Mon Sep 17 00:00:00 2001
From 1eb620e3305682150b973c3499691a7ae0193cfc Mon Sep 17 00:00:00 2001
From: Ichbinjoe <joe@ibj.io>
Date: Sat, 16 Jul 2016 20:44:01 -0400
Subject: [PATCH] Add timeout variant to connect methods

View File

@ -1,4 +1,4 @@
From 35665bf8f0fcb188652f8f18fffe379b380d7271 Mon Sep 17 00:00:00 2001
From fd5287e0f251e5c990647e26959c7b81df8145fc Mon Sep 17 00:00:00 2001
From: minecrafter <unknown@unknown>
Date: Sun, 3 Jul 2016 04:03:21 -0400
Subject: [PATCH] Proxy query event

View File

@ -1,4 +1,4 @@
From d4a158e924a73ada77ee3a779e940d006ec14bce Mon Sep 17 00:00:00 2001
From 96aa31c0c0c0b31c97579f5db486b32d77ecd382 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@techcable.net>
Date: Thu, 4 Aug 2016 19:30:49 -0700
Subject: [PATCH] Dump the raw hex of a packet on a decoding error

View File

@ -1,4 +1,4 @@
From 36cab3b3d3e8573e4137eaff507441f905b898bc Mon Sep 17 00:00:00 2001
From e20e038ca67510970e7dc7f5d7e5d575cc84999f Mon Sep 17 00:00:00 2001
From: Aaron Hill <aa1ronham@gmail.com>
Date: Thu, 15 Sep 2016 22:38:37 +0200
Subject: [PATCH] Fix potion race condition on Forge 1.8.9

View File

@ -1,4 +1,4 @@
From 7192a6be45748b3d605fb31d913d6846c63d2d48 Mon Sep 17 00:00:00 2001
From 2772e4b241a3cec4e8df622f1f56bcd2c9a0fc93 Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Wed, 21 Dec 2016 03:13:03 -0500
Subject: [PATCH] Optionally use async Netty DNS resolver
@ -168,7 +168,7 @@ index 2feb4d66..b265bb43 100644
+ // Waterfall End
}
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 0cad5c89..3af6a1db 100644
index 41330ec2..c26fc55b 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
@@ -112,7 +112,7 @@ public class PipelineUtils

View File

@ -1,4 +1,4 @@
From aec1919f2bf9b904e6bf4b23129fec4b593015f5 Mon Sep 17 00:00:00 2001
From c13507d54f34d80d8b9be247d93dd2dce4fd7a69 Mon Sep 17 00:00:00 2001
From: Jamie Mansfield <dev@jamierocks.uk>
Date: Sat, 10 Jun 2017 20:56:02 +0100
Subject: [PATCH] Improve outdated build message

View File

@ -1,4 +1,4 @@
From 5136e117d684d982b898c42a6584b09dd07f7227 Mon Sep 17 00:00:00 2001
From 75c9b9a7e8d4ddd4291a19ad618f1e1be877f188 Mon Sep 17 00:00:00 2001
From: Daniel Naylor <git@drnaylor.co.uk>
Date: Mon, 17 Jul 2017 20:24:17 +0100
Subject: [PATCH] Fix some forge plugin message packets not being forwarded

View File

@ -1,4 +1,4 @@
From f016de7e4a334cdf630bb1142ce0ad92c8615702 Mon Sep 17 00:00:00 2001
From 8c53e34fa13ec80f999086cf44dec2850854cefc Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 22 Sep 2017 12:46:47 +0200
Subject: [PATCH] Use Log4j2 for logging and TerminalConsoleAppender for
@ -245,7 +245,7 @@ index 00000000..93ce3b14
+ </Loggers>
+</Configuration>
diff --git a/pom.xml b/pom.xml
index 79493df2..0183bf9c 100644
index ddd91e8d..565e70a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,6 +56,7 @@

View File

@ -1,4 +1,4 @@
From 60576cb3636b8db873ad3152f2e1a74132087da0 Mon Sep 17 00:00:00 2001
From 51c4576c7c91450cbe7dd1638d6017b6e56ebc75 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 22 Sep 2017 13:07:31 +0200
Subject: [PATCH] Handle plugin prefixes using Log4J

View File

@ -1,4 +1,4 @@
From c14a76642e045b3e6ae52d27e7120dcfae258e78 Mon Sep 17 00:00:00 2001
From 78ba3b760b6d9700fce0aa6b490265f06f8ceec1 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 22 Sep 2017 13:15:09 +0200
Subject: [PATCH] Allow plugins to use SLF4J for logging

View File

@ -1,4 +1,4 @@
From 8f3f74d7384b3cc99e0928330c6f75355f848700 Mon Sep 17 00:00:00 2001
From f6da3e02cecfeb3ea84b205e37ae1f0f6955b685 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Sun, 24 Sep 2017 12:06:49 +0200
Subject: [PATCH] Add Log4j configuration that replicates the old BungeeCord

View File

@ -1,4 +1,4 @@
From 963a8e38d4818b2571125c9d038523a35ae62461 Mon Sep 17 00:00:00 2001
From 15a2fa23bb78dee5bc42eaf414a8d078f3bcbe9c Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Tue, 26 Sep 2017 18:59:37 +0200
Subject: [PATCH] Add console command completion

View File

@ -1,4 +1,4 @@
From 82bc39ae984e65a50e3fc72959d0f15bc825f1b9 Mon Sep 17 00:00:00 2001
From 69672dc2952d20ba5aa38514e487713b0dace7ea Mon Sep 17 00:00:00 2001
From: phenomax <phenomax@revayd.net>
Date: Thu, 10 Aug 2017 18:41:17 +0200
Subject: [PATCH] Providing access to the player's LoginResult on LoginEvent
@ -52,7 +52,7 @@ similarity index 100%
rename from proxy/src/main/java/net/md_5/bungee/connection/LoginResult.java
rename to api/src/main/java/net/md_5/bungee/connection/LoginResult.java
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 ee05f957..62642683 100644
index 45cd5237..c546e7be 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
@@ -550,7 +550,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection

View File

@ -1,4 +1,4 @@
From 9d0c7407255137963ff13d1ec464be6a1566bcca Mon Sep 17 00:00:00 2001
From 72328c146c1a82d7f97e24ae6e769945e0f06d16 Mon Sep 17 00:00:00 2001
From: Gabriele C <sgdc3.mail@gmail.com>
Date: Thu, 8 Feb 2018 19:10:52 +0100
Subject: [PATCH] Optionally log InitialHandler connections
@ -59,7 +59,7 @@ index 5c92768a..090c550b 100644
public String getGameVersion() {
return gameVersion;
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 62642683..21844f0c 100644
index c546e7be..8f63e997 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
@@ -312,7 +312,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection

View File

@ -1,4 +1,4 @@
From bc5ac28691983c67b821868df9a8b24046fe3e8f Mon Sep 17 00:00:00 2001
From 087e0fe4fe2617e8096256ab2b42c2dd9aa9ff6b Mon Sep 17 00:00:00 2001
From: Jamie Mansfield <dev@jamierocks.uk>
Date: Mon, 28 May 2018 21:43:55 +0100
Subject: [PATCH] Forge is a first class citizen

View File

@ -20,7 +20,7 @@ Waterfall will still track upstream BungeeCord and merge changes as needed.
## How To (Server Admins)
Download a copy of Waterfall.jar from our buildserver here: [Waterfall](https://ci.destroystokyo.com/job/Waterfall/)
Download a copy of Waterfall.jar from our buildserver here: [Waterfall](https://papermc.io/ci/job/Waterfall/)
Waterfall requires **Java 8** or above.

View File

@ -1,272 +0,0 @@
From 86c5823b0bfdfc21e38850b46bb486c4e10e940c Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Sun, 28 Feb 2016 22:46:22 -0700
Subject: [PATCH] Use ASM for events, via the Event4J library
According to benchmarks, this is about 7 nanoseconds faster than reflection (34 ns -> 27 ns).
Event4J falls back to Java 8's new MethodHandle if the event method isn't public.
diff --git a/event/pom.xml b/event/pom.xml
index b6ef990..ff72600 100644
--- a/event/pom.xml
+++ b/event/pom.xml
@@ -17,4 +17,24 @@
<name>Waterfall-Event</name>
<description>Generic java event dispatching API intended for use with Waterfall.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>net.techcable</groupId>
+ <artifactId>event4j</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-all</artifactId>
+ <version>5.0.4</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>techcable-repo</id>
+ <url>https://repo.techcable.net/content/groups/public/</url>
+ </repository>
+ </repositories>
</project>
diff --git a/event/src/main/java/net/md_5/bungee/event/EventBus.java b/event/src/main/java/net/md_5/bungee/event/EventBus.java
index 5b5d420..c93aa16 100644
--- a/event/src/main/java/net/md_5/bungee/event/EventBus.java
+++ b/event/src/main/java/net/md_5/bungee/event/EventBus.java
@@ -1,26 +1,13 @@
package net.md_5.bungee.event;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.logging.Level;
import java.util.logging.Logger;
public class EventBus
{
- private final Map<Class<?>, Map<Byte, Map<Object, Method[]>>> byListenerAndPriority = new HashMap<>();
- private final Map<Class<?>, EventHandlerMethod[]> byEventBaked = new ConcurrentHashMap<>();
- private final Lock lock = new ReentrantLock();
+ private final net.techcable.event4j.EventBus<Object, Object> event4JBus = net.techcable.event4j.EventBus.builder()
+ .eventMarker((m) -> m.isAnnotationPresent(EventHandler.class) ? m.getAnnotation(EventHandler.class)::priority : null)
+ .build();
private final Logger logger;
public EventBus()
@@ -35,167 +22,16 @@ public class EventBus
public void post(Object event)
{
- EventHandlerMethod[] handlers = byEventBaked.get( event.getClass() );
-
- if ( handlers != null )
- {
- for ( EventHandlerMethod method : handlers )
- {
- try
- {
- method.invoke( event );
- } catch ( IllegalAccessException ex )
- {
- throw new Error( "Method became inaccessible: " + event, ex );
- } catch ( IllegalArgumentException ex )
- {
- throw new Error( "Method rejected target/argument: " + event, ex );
- } catch ( InvocationTargetException ex )
- {
- logger.log( Level.WARNING, MessageFormat.format( "Error dispatching event {0} to listener {1}", event, method.getListener() ), ex.getCause() );
- }
- }
- }
- }
-
- private Map<Class<?>, Map<Byte, Set<Method>>> findHandlers(Object listener)
- {
- Map<Class<?>, Map<Byte, Set<Method>>> handler = new HashMap<>();
- for ( Method m : listener.getClass().getDeclaredMethods() )
- {
- EventHandler annotation = m.getAnnotation( EventHandler.class );
- if ( annotation != null )
- {
- Class<?>[] params = m.getParameterTypes();
- if ( params.length != 1 )
- {
- logger.log( Level.INFO, "Method {0} in class {1} annotated with {2} does not have single argument", new Object[]
- {
- m, listener.getClass(), annotation
- } );
- continue;
- }
- Map<Byte, Set<Method>> prioritiesMap = handler.get( params[0] );
- if ( prioritiesMap == null )
- {
- prioritiesMap = new HashMap<>();
- handler.put( params[0], prioritiesMap );
- }
- Set<Method> priority = prioritiesMap.get( annotation.priority() );
- if ( priority == null )
- {
- priority = new HashSet<>();
- prioritiesMap.put( annotation.priority(), priority );
- }
- priority.add( m );
- }
- }
- return handler;
+ event4JBus.fire(event);
}
public void register(Object listener)
{
- Map<Class<?>, Map<Byte, Set<Method>>> handler = findHandlers( listener );
- lock.lock();
- try
- {
- for ( Map.Entry<Class<?>, Map<Byte, Set<Method>>> e : handler.entrySet() )
- {
- Map<Byte, Map<Object, Method[]>> prioritiesMap = byListenerAndPriority.get( e.getKey() );
- if ( prioritiesMap == null )
- {
- prioritiesMap = new HashMap<>();
- byListenerAndPriority.put( e.getKey(), prioritiesMap );
- }
- for ( Map.Entry<Byte, Set<Method>> entry : e.getValue().entrySet() )
- {
- Map<Object, Method[]> currentPriorityMap = prioritiesMap.get( entry.getKey() );
- if ( currentPriorityMap == null )
- {
- currentPriorityMap = new HashMap<>();
- prioritiesMap.put( entry.getKey(), currentPriorityMap );
- }
- Method[] baked = new Method[ entry.getValue().size() ];
- currentPriorityMap.put( listener, entry.getValue().toArray( baked ) );
- }
- bakeHandlers( e.getKey() );
- }
- } finally
- {
- lock.unlock();
- }
+ event4JBus.register(listener);
}
public void unregister(Object listener)
{
- Map<Class<?>, Map<Byte, Set<Method>>> handler = findHandlers( listener );
- lock.lock();
- try
- {
- for ( Map.Entry<Class<?>, Map<Byte, Set<Method>>> e : handler.entrySet() )
- {
- Map<Byte, Map<Object, Method[]>> prioritiesMap = byListenerAndPriority.get( e.getKey() );
- if ( prioritiesMap != null )
- {
- for ( Byte priority : e.getValue().keySet() )
- {
- Map<Object, Method[]> currentPriority = prioritiesMap.get( priority );
- if ( currentPriority != null )
- {
- currentPriority.remove( listener );
- if ( currentPriority.isEmpty() )
- {
- prioritiesMap.remove( priority );
- }
- }
- }
- if ( prioritiesMap.isEmpty() )
- {
- byListenerAndPriority.remove( e.getKey() );
- }
- }
- bakeHandlers( e.getKey() );
- }
- } finally
- {
- lock.unlock();
- }
- }
-
- /**
- * Shouldn't be called without first locking the writeLock; intended for use
- * only inside {@link #register(java.lang.Object) register(Object)} or
- * {@link #unregister(java.lang.Object) unregister(Object)}.
- */
- private void bakeHandlers(Class<?> eventClass)
- {
- Map<Byte, Map<Object, Method[]>> handlersByPriority = byListenerAndPriority.get( eventClass );
- if ( handlersByPriority != null )
- {
- List<EventHandlerMethod> handlersList = new ArrayList<>( handlersByPriority.size() * 2 );
-
- // Either I'm really tired, or the only way we can iterate between Byte.MIN_VALUE and Byte.MAX_VALUE inclusively,
- // with only a byte on the stack is by using a do {} while() format loop.
- byte value = Byte.MIN_VALUE;
- do
- {
- Map<Object, Method[]> handlersByListener = handlersByPriority.get( value );
- if ( handlersByListener != null )
- {
- for ( Map.Entry<Object, Method[]> listenerHandlers : handlersByListener.entrySet() )
- {
- for ( Method method : listenerHandlers.getValue() )
- {
- EventHandlerMethod ehm = new EventHandlerMethod( listenerHandlers.getKey(), method );
- handlersList.add( ehm );
- }
- }
- }
- } while ( value++ < Byte.MAX_VALUE );
- byEventBaked.put( eventClass, handlersList.toArray( new EventHandlerMethod[ handlersList.size() ] ) );
- } else
- {
- byEventBaked.remove( eventClass );
- }
+ event4JBus.unregister(listener);
}
}
diff --git a/event/src/main/java/net/md_5/bungee/event/EventHandlerMethod.java b/event/src/main/java/net/md_5/bungee/event/EventHandlerMethod.java
deleted file mode 100644
index ad19c02..0000000
--- a/event/src/main/java/net/md_5/bungee/event/EventHandlerMethod.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package net.md_5.bungee.event;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-@AllArgsConstructor
-public class EventHandlerMethod
-{
-
- @Getter
- private final Object listener;
- @Getter
- private final Method method;
-
- public void invoke(Object event) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
- {
- method.invoke( listener, event );
- }
-}
--
2.8.3

View File

@ -1,23 +0,0 @@
From 051b62a81dccad2c628eedc59bdfbf212a968131 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@techcable.net>
Date: Tue, 5 Apr 2016 11:00:16 -0700
Subject: [PATCH] Print stack trace when the ByteBuf is not direct.
The issue with ByteBufs not being direct should be fixed as of netty 4.1, and stacktraces provide valuable information.
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
index 29e54dba..6da27fcf 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
@@ -51,7 +51,7 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder
if ( !DIRECT_WARNING )
{
DIRECT_WARNING = true;
- System.out.println( "Netty is not using direct IO buffers." );
+ new Throwable("Using a " + in.getClass().getTypeName() + ", not a direct byte buf!").printStackTrace();
}
// See https://github.com/SpigotMC/BungeeCord/issues/1717
--
2.14.1

View File

@ -1,296 +0,0 @@
From 3f7b0d3a64c7e0b7909bb3394954bfa2501ad8fb Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@techcable.net>
Date: Fri, 7 Apr 2017 20:19:15 -0700
Subject: [PATCH] Dump a packet's raw hex if entity rewriting fails.
diff --git a/proxy/src/main/java/io/github/waterfallmc/waterfall/utils/BufUtils.java b/proxy/src/main/java/io/github/waterfallmc/waterfall/utils/BufUtils.java
new file mode 100644
index 00000000..c21a707a
--- /dev/null
+++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/utils/BufUtils.java
@@ -0,0 +1,40 @@
+package io.github.waterfallmc.waterfall.utils;
+
+import java.util.function.Function;
+
+import io.netty.buffer.ByteBuf;
+import net.md_5.bungee.protocol.DefinedPacket;
+
+public final class BufUtils {
+ private BufUtils() {}
+
+ /**
+ * Read a varint from the ByteBuf without changing the index.
+ */
+ public static int peekVarInt(ByteBuf buf) {
+ return peek(buf, DefinedPacket::readVarInt);
+ }
+
+ /**
+ * Read values from the byte buf, then reset it's indexes to the old value.
+ *
+ * This effectively 'peeks' at values ahead of the index.
+ * This is preferable to `resetWriterIndex` and `resetReaderIndex`,
+ * since it doesn't rely on the buffer's mark.
+ *
+ * @param buf the buffer to peek from
+ * @param func the function that should peek values
+ * @return the value returned from the function
+ * @throws Throwable any exception thrown by the callable
+ */
+ public static <R> R peek(ByteBuf buf, Function<ByteBuf, R> func) {
+ int oldReaderIndex = buf.readerIndex();
+ int oldWriterIndex = buf.writerIndex();
+ try {
+ return func.apply(buf);
+ } finally {
+ buf.readerIndex(oldReaderIndex);
+ buf.writerIndex(oldWriterIndex);
+ }
+ }
+}
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
index d98a8056..736bd599 100644
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
@@ -10,6 +10,12 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants;
+// Waterfall start
+import io.github.waterfallmc.waterfall.utils.BufUtils;
+import io.netty.buffer.ByteBufUtil;
+import io.netty.handler.codec.DecoderException;
+import net.md_5.bungee.protocol.BadPacketException;
+// Waterfall end
/**
* Class to rewrite integers within packets.
@@ -66,13 +72,51 @@ public abstract class EntityMap
}
}
- public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
+ // Waterfall start - wrap rewrite calls to provide descriptive error messages
+ public final void rewriteServerbound(ByteBuf packet, int oldId, int newId) {
+ Integer packetId = null;
+ ByteBuf originalPacket = packet.copy(); // EntityMap modifies in place, so we need a copy :(
+ try {
+ packetId = BufUtils.peekVarInt(packet);
+ rewriteServerbound0(packet, oldId, newId);
+ } catch (BadPacketException | IndexOutOfBoundsException e) {
+ String packetType = packetId != null ? "id " + Integer.toHexString(packetId) : "unknown";
+ throw new DecoderException(
+ "Error rewriting packet "
+ + packetType
+ + " with contents:\n"
+ + ByteBufUtil.prettyHexDump(originalPacket),
+ e
+ );
+ }
+ }
+
+ public final void rewriteClientbound(ByteBuf packet, int oldId, int newId) {
+ Integer packetId = null;
+ ByteBuf originalPacket = packet.copy(); // EntityMap modifies in place, so we need a copy :(
+ try {
+ packetId = BufUtils.peekVarInt(packet);
+ rewriteClientbound0(packet, oldId, newId);
+ } catch (BadPacketException | IndexOutOfBoundsException e) {
+ String packetType = packetId != null ? "id " + Integer.toHexString(packetId) : "unknown";
+ throw new DecoderException(
+ "Error rewriting packet "
+ + packetType
+ + " with contents:\n"
+ + ByteBufUtil.prettyHexDump(originalPacket),
+ e
+ );
+ }
+ }
+
+ protected void rewriteServerbound0(ByteBuf packet, int oldId, int newId)
{
rewrite( packet, oldId, newId, serverboundInts, serverboundVarInts );
}
- public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
+ protected void rewriteClientbound0(ByteBuf packet, int oldId, int newId)
{
+ // Waterfall end
rewrite( packet, oldId, newId, clientboundInts, clientboundVarInts );
}
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java
index a89ea2e9..0de5ce25 100644
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_10.java
@@ -49,9 +49,11 @@ class EntityMap_1_10 extends EntityMap
@Override
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
- public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
+ // Waterfall start - rewriteClientbound -> rewriteClientbound0
+ protected void rewriteClientbound0(ByteBuf packet, int oldId, int newId)
{
- super.rewriteClientbound( packet, oldId, newId );
+ super.rewriteClientbound0( packet, oldId, newId );
+ // Waterfall end
// Special cases
int readerIndex = packet.readerIndex();
@@ -151,10 +153,13 @@ class EntityMap_1_10 extends EntityMap
packet.readerIndex( readerIndex );
}
+ // Waterfall start - rewriteServerbound -> rewriteServerbound0
@Override
- public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
+ public void rewriteServerbound0(ByteBuf packet, int oldId, int newId)
{
- super.rewriteServerbound( packet, oldId, newId );
+ super.rewriteServerbound0( packet, oldId, newId );
+ // Waterfall end
+
// Special cases
int readerIndex = packet.readerIndex();
int packetId = DefinedPacket.readVarInt( packet );
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java
index 260da17e..8a746116 100644
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_11.java
@@ -49,9 +49,11 @@ class EntityMap_1_11 extends EntityMap
@Override
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
- public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
+ // Waterfall start - rewriteClientbound -> rewriteClientbound0
+ protected void rewriteClientbound0(ByteBuf packet, int oldId, int newId)
{
- super.rewriteClientbound( packet, oldId, newId );
+ super.rewriteClientbound0( packet, oldId, newId );
+ // Waterfall end
// Special cases
int readerIndex = packet.readerIndex();
@@ -155,10 +157,13 @@ class EntityMap_1_11 extends EntityMap
packet.readerIndex( readerIndex );
}
+ // Waterfall start - rewriteServerbound -> rewriteServerbound0
@Override
- public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
+ public void rewriteServerbound0(ByteBuf packet, int oldId, int newId)
{
- super.rewriteServerbound( packet, oldId, newId );
+ super.rewriteServerbound0( packet, oldId, newId );
+ // Waterfall end
+
// Special cases
int readerIndex = packet.readerIndex();
int packetId = DefinedPacket.readVarInt( packet );
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java
index 4229fefa..23f29a4b 100644
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java
@@ -49,9 +49,11 @@ class EntityMap_1_8 extends EntityMap
@Override
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
- public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
+ // Waterfall start - rewriteClientbound -> rewriteClientbound0
+ protected void rewriteClientbound0(ByteBuf packet, int oldId, int newId)
{
- super.rewriteClientbound( packet, oldId, newId );
+ super.rewriteClientbound0( packet, oldId, newId );
+ // Waterfall end
//Special cases
int readerIndex = packet.readerIndex();
@@ -149,10 +151,13 @@ class EntityMap_1_8 extends EntityMap
packet.readerIndex( readerIndex );
}
+ // Waterfall start - rewriteServerbound -> rewriteServerbound0
@Override
- public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
+ public void rewriteServerbound0(ByteBuf packet, int oldId, int newId)
{
- super.rewriteServerbound( packet, oldId, newId );
+ super.rewriteServerbound0( packet, oldId, newId );
+ // Waterfall end
+
//Special cases
int readerIndex = packet.readerIndex();
int packetId = DefinedPacket.readVarInt( packet );
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java
index 19d96776..80075eb4 100644
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java
@@ -49,9 +49,11 @@ class EntityMap_1_9 extends EntityMap
@Override
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
- public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
+ // Waterfall start - rewriteClientbound -> rewriteClientbound0
+ protected void rewriteClientbound0(ByteBuf packet, int oldId, int newId)
{
- super.rewriteClientbound( packet, oldId, newId );
+ super.rewriteClientbound0( packet, oldId, newId );
+ // Waterfall end
// Special cases
int readerIndex = packet.readerIndex();
@@ -151,10 +153,13 @@ class EntityMap_1_9 extends EntityMap
packet.readerIndex( readerIndex );
}
+ // Waterfall start - rewriteServerbound -> rewriteServerbound0
@Override
- public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
+ public void rewriteServerbound0(ByteBuf packet, int oldId, int newId)
{
- super.rewriteServerbound( packet, oldId, newId );
+ super.rewriteServerbound0( packet, oldId, newId );
+ // Waterfall end
+
// Special cases
int readerIndex = packet.readerIndex();
int packetId = DefinedPacket.readVarInt( packet );
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java
index 412ab4ed..ae5ce7f0 100644
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9_4.java
@@ -49,9 +49,11 @@ class EntityMap_1_9_4 extends EntityMap
@Override
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
- public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
+ // Waterfall start - rewriteClientbound -> rewriteClientbound0
+ protected void rewriteClientbound0(ByteBuf packet, int oldId, int newId)
{
- super.rewriteClientbound( packet, oldId, newId );
+ super.rewriteClientbound0( packet, oldId, newId );
+ // Waterfall end
// Special cases
int readerIndex = packet.readerIndex();
@@ -151,10 +153,13 @@ class EntityMap_1_9_4 extends EntityMap
packet.readerIndex( readerIndex );
}
+ // Waterfall start - rewriteServerbound -> rewriteServerbound0
@Override
- public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
+ public void rewriteServerbound0(ByteBuf packet, int oldId, int newId)
{
- super.rewriteServerbound( packet, oldId, newId );
+ super.rewriteServerbound0( packet, oldId, newId );
+ // Waterfall end
+
// Special cases
int readerIndex = packet.readerIndex();
int packetId = DefinedPacket.readVarInt( packet );
--
2.12.2