From 42d8300bb702719326cb57be5f8f1345d3003b07 Mon Sep 17 00:00:00 2001 From: Valtn Date: Sat, 4 Dec 2021 16:04:26 -0500 Subject: [PATCH 01/17] #3220: Fix server list info being cached permanently --- proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java index 4bb0f68f9d..8fecbd73c4 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java @@ -154,7 +154,7 @@ public void ping(final Callback callback, final int protocolVersion) Preconditions.checkNotNull( callback, "callback" ); int pingCache = ProxyServer.getInstance().getConfig().getRemotePingCache(); - if ( pingCache > 0 && cachedPing != null && ( lastPing - System.currentTimeMillis() ) > pingCache ) + if ( pingCache > 0 && cachedPing != null && ( System.currentTimeMillis() - lastPing ) > pingCache ) { cachedPing = null; } From 425ee4e142b13b29cf89b8f25c31245d026a35d1 Mon Sep 17 00:00:00 2001 From: Janmm14 Date: Sat, 4 Dec 2021 22:51:33 +0100 Subject: [PATCH 02/17] #3215: Add time measurement per event listener method --- .../src/main/java/net/md_5/bungee/event/EventBus.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 a6d717f2cd..b3effc8aa1 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 @@ -42,6 +42,8 @@ public void post(Object event) { for ( EventHandlerMethod method : handlers ) { + long start = System.nanoTime(); + try { method.invoke( event ); @@ -55,6 +57,15 @@ public void post(Object event) { logger.log( Level.WARNING, MessageFormat.format( "Error dispatching event {0} to listener {1}", event, method.getListener() ), ex.getCause() ); } + + long elapsed = System.nanoTime() - start; + if ( elapsed > 20000000 ) + { + logger.log( Level.WARNING, "Plugin listener {0} took {1}ms to process event {2}!", new Object[] + { + method.getListener().getClass().getName(), elapsed / 1000000, event + } ); + } } } } From 1ad81504ca04260cd600fcb49d6ebd72c07437e4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 10 Dec 2021 15:50:27 +1100 Subject: [PATCH 03/17] Update native cipher --- native/mbedtls | 2 +- native/src/main/resources/native-cipher.so | Bin 40336 -> 36152 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/native/mbedtls b/native/mbedtls index e483a77c85..8df2f8e7b9 160000 --- a/native/mbedtls +++ b/native/mbedtls @@ -1 +1 @@ -Subproject commit e483a77c85e1f9c1dd2eb1c5a8f552d2617fe400 +Subproject commit 8df2f8e7b9c7bb9390ac74bb7bace27edca81a2b diff --git a/native/src/main/resources/native-cipher.so b/native/src/main/resources/native-cipher.so index 8ac128df6f1ebb309238cda9816d083de4fb685d..573626fb15fdf9fd767dc58c0e85f2bad2e095df 100755 GIT binary patch delta 7376 zcmZvh3v^V~xySdJ$%G`tWWp;CLNmbx0w_tukOaZZkVpmyG87O*9@86C9wCHY^;&8( z69~#cvsU1vf(RN5_ex#1H=0$86mdW*c)eU>X?@^>v2bO=qlDYl3W}cl-)Db29R~MW zXa0NtzWsikefG5f-nM_Itvx$qps<`@Qk4!*{c$^ukYSV`|Kt5yrh@tO3Og<*%Ilhy~J2V zFC=7=J0Z)MZuy$v+a`U+ZtM3!>(@u`C)65uTQN!;m4R$z49C4I*4u>`Aku`hTJdBh zqQR!Pn=AG+*#@|5=1!Lt6bqGzAETROK9R`^(B)=FI6}o=E5TrbPQ5Nw>ZQt3(KyDdqRmY zIiubx1s-GmJKaO06}ZH_9xC(i;Z{E{&W$MQWcpvesgw~8~0>Vkiu_(g;*$6RoQ zcq)nKxqt|d@luX{ow=`Afli3k#s(fs-`&cvgA2&u0y=q46n1%%erluclze(FIgwu8 zn%_!lZj7dpX83LHvfk6uX;Gp=RS(zyxu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^h;@2 zEWiNq0C7LhfWe_(89PGUL+NFUFUs^0{Bz>$JHi2fw}_=_5-k`YgIshfaa#np5%)hN z9C?JWQppL(3b}}fh|BcNCN@%Z^+Ry@$zp3j_>m*JLC=PBH2|?|ij_X7UQ=WmS^DEcq+7W!3;+xe* zDW#aj*{;n2_pB{4F(<5AyU4`m!0ENc^|>OE+~K@NX**^L-cLS)(npa1@)Y$lad!pG zURRXSd$%yl(_lMxAU{?fD1e>o7G*>p3jdtU?&%Qw)VF@nw+sbXxWtvPS+#(@vZf24+9)GsW1a zvBgDY<#v1EL+=Y_=!?yO?oD;DI#vz5x#?|_G6cK7Uz`}idB%g(b~uMr?k=U?0Bct< zba$!BB53L=j`7o;)en7L_LvaGLhug8pAGsBZuAmR)X=g2w!IUy_<5GRVzR6EyjXW94&X#yr^Rv&VSIsRvH` z>?%Fby|{wK!&n$f<6Com=fPmc9W_--_8bK+-mQ939Dr_@fs- ziW&p$+p=PMso+k?>Pm$dk;n(oMmW9AE@SFONZLL#dZS2P2=8F_N4Mum;DX)T?J?aw V!n_vFZMVlN^j;mUKt|X2{|D$~Sdst$ From f2aadd60144161f33538022a4244140a7ef9aeec Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 13 Dec 2021 08:25:49 +1100 Subject: [PATCH 04/17] #3223: Only rewrite spectate packet if no IP forwarding --- .../main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java index 66586c8ca0..2f0e303d42 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_16_2.java @@ -56,7 +56,7 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId) int packetId = DefinedPacket.readVarInt( packet ); int packetIdLength = packet.readerIndex() - readerIndex; - if ( packetId == spectateId ) + if ( packetId == spectateId && !BungeeCord.getInstance().getConfig().isIpForward() ) { UUID uuid = DefinedPacket.readUUID( packet ); ProxiedPlayer player; From 879f37f0467747a9a4440d90a037bd7fd54491c1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 18 Dec 2021 11:36:05 +1100 Subject: [PATCH 05/17] Upgrade to SnakeYAML 1.30 release --- api/pom.xml | 2 +- config/pom.xml | 2 +- pom.xml | 15 --------------- protocol/pom.xml | 15 +++++++++++++++ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index f291fb2eed..b197272cfb 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -73,7 +73,7 @@ org.yaml snakeyaml - 1.30-SNAPSHOT + 1.30 compile diff --git a/config/pom.xml b/config/pom.xml index 318ea6ef28..87208ac2cc 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -29,7 +29,7 @@ org.yaml snakeyaml - 1.30-SNAPSHOT + 1.30 compile true diff --git a/pom.xml b/pom.xml index c638ef3274..311db811b8 100644 --- a/pom.xml +++ b/pom.xml @@ -70,21 +70,6 @@ - - - - sonatype-nexus-snapshots - Sonatype Nexus Snapshots - https://oss.sonatype.org/content/repositories/snapshots/ - - false - - - true - - - - unknown 1.18.20 diff --git a/protocol/pom.xml b/protocol/pom.xml index 6e23170f15..e7a492f6ca 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -18,6 +18,21 @@ BungeeCord-Protocol Minimal implementation of the Minecraft protocol for use in BungeeCord + + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots + + false + + + true + + + + net.md-5 From 51eb1ac62340f3c7d28f1d6cdd49074e1f12dec7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 18 Dec 2021 12:03:28 +1100 Subject: [PATCH 06/17] Dependency upgrades --- api/pom.xml | 6 +++--- pom.xml | 6 +++--- proxy/pom.xml | 6 +++--- slf4j/pom.xml | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index b197272cfb..79cab35b0c 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -52,21 +52,21 @@ org.apache.maven maven-resolver-provider - 3.8.1 + 3.8.4 provided org.apache.maven.resolver maven-resolver-connector-basic - 1.7.0 + 1.7.2 provided org.apache.maven.resolver maven-resolver-transport-http - 1.7.0 + 1.7.2 provided diff --git a/pom.xml b/pom.xml index 311db811b8..1b1e8e9dec 100644 --- a/pom.xml +++ b/pom.xml @@ -72,8 +72,8 @@ unknown - 1.18.20 - 4.1.70.Final + 1.18.22 + 4.1.72.Final 1.8 1.8 UTF-8 @@ -83,7 +83,7 @@ junit junit - 4.13.1 + 4.13.2 test diff --git a/proxy/pom.xml b/proxy/pom.xml index 84ace403e6..b49b4c5ceb 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -101,19 +101,19 @@ org.apache.maven maven-resolver-provider - 3.8.1 + 3.8.4 runtime org.apache.maven.resolver maven-resolver-connector-basic - 1.7.0 + 1.7.2 runtime org.apache.maven.resolver maven-resolver-transport-http - 1.7.0 + 1.7.2 runtime diff --git a/slf4j/pom.xml b/slf4j/pom.xml index d9495ea752..293597b65c 100644 --- a/slf4j/pom.xml +++ b/slf4j/pom.xml @@ -28,7 +28,7 @@ org.slf4j slf4j-api - 1.7.30 + 1.7.32 compile From 2479fab632e524e560e7dbc0b83742a565e0f6e5 Mon Sep 17 00:00:00 2001 From: Janmm14 Date: Fri, 10 Dec 2021 12:50:24 +0100 Subject: [PATCH 07/17] #3221: Use computeIfAbsent method in EventBus --- .../java/net/md_5/bungee/event/EventBus.java | 28 +++---------------- 1 file changed, 4 insertions(+), 24 deletions(-) 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 b3effc8aa1..d3c6ea9d1f 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 @@ -88,18 +88,8 @@ private Map, Map>> findHandlers(Object listener) } ); continue; } - Map> prioritiesMap = handler.get( params[0] ); - if ( prioritiesMap == null ) - { - prioritiesMap = new HashMap<>(); - handler.put( params[0], prioritiesMap ); - } - Set priority = prioritiesMap.get( annotation.priority() ); - if ( priority == null ) - { - priority = new HashSet<>(); - prioritiesMap.put( annotation.priority(), priority ); - } + Map> prioritiesMap = handler.computeIfAbsent( params[0], k -> new HashMap<>() ); + Set priority = prioritiesMap.computeIfAbsent( annotation.priority(), k -> new HashSet<>() ); priority.add( m ); } } @@ -114,20 +104,10 @@ public void register(Object listener) { for ( Map.Entry, Map>> e : handler.entrySet() ) { - Map> prioritiesMap = byListenerAndPriority.get( e.getKey() ); - if ( prioritiesMap == null ) - { - prioritiesMap = new HashMap<>(); - byListenerAndPriority.put( e.getKey(), prioritiesMap ); - } + Map> prioritiesMap = byListenerAndPriority.computeIfAbsent( e.getKey(), k -> new HashMap<>() ); for ( Map.Entry> entry : e.getValue().entrySet() ) { - Map currentPriorityMap = prioritiesMap.get( entry.getKey() ); - if ( currentPriorityMap == null ) - { - currentPriorityMap = new HashMap<>(); - prioritiesMap.put( entry.getKey(), currentPriorityMap ); - } + Map currentPriorityMap = prioritiesMap.computeIfAbsent( entry.getKey(), k -> new HashMap<>() ); currentPriorityMap.put( listener, entry.getValue().toArray( new Method[ 0 ] ) ); } bakeHandlers( e.getKey() ); From 3a11656909e11e85f408d6e303eeb752707f8d99 Mon Sep 17 00:00:00 2001 From: Janmm14 Date: Sat, 18 Dec 2021 23:53:13 +0100 Subject: [PATCH 08/17] #3116: Do not fill in LogRecord caller data by default in slf4j wrapper --- slf4j/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/slf4j/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java b/slf4j/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java index 7cfafc8861..4958945432 100644 --- a/slf4j/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java +++ b/slf4j/src/main/java/org/slf4j/impl/JDK14LoggerAdapter.java @@ -585,6 +585,8 @@ private void log(String callerFQCN, Level level, String msg, Throwable t) { static String SELF = JDK14LoggerAdapter.class.getName(); static String SUPER = MarkerIgnoringBase.class.getName(); + private static final boolean FILL_CALLER_DATA = Boolean.getBoolean( "net.md_5.bungee.slf4j-caller-data" ); + /** * Fill in caller data if possible. * @@ -592,6 +594,10 @@ private void log(String callerFQCN, Level level, String msg, Throwable t) { * The record to update */ final private void fillCallerData(String callerFQCN, LogRecord record) { + if ( !FILL_CALLER_DATA ) + { + return; + } StackTraceElement[] steArray = new Throwable().getStackTrace(); int selfIndex = -1; From b4ccdaa51c5e3ce8fbfb68536dc3a044fe0a1cff Mon Sep 17 00:00:00 2001 From: Janmm14 Date: Sat, 18 Dec 2021 23:54:37 +0100 Subject: [PATCH 09/17] #2715: Improve BadPacketException message in MinecraftDecoder --- .../main/java/net/md_5/bungee/protocol/MinecraftDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d36b7f3c09..773e954c4f 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 @@ -41,7 +41,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t if ( in.isReadable() ) { - throw new BadPacketException( "Did not read all bytes from packet " + packet.getClass() + " " + packetId + " Protocol " + protocol + " Direction " + prot.getDirection() ); + throw new BadPacketException( "Packet " + protocol + ":" + prot.getDirection() + "/" + packetId + " (" + packet.getClass().getSimpleName() + ") larger than expected, extra bytes: " + in.readableBytes() ); } } else { From e6766a1ee2da7196a3f835554758abef84b8cd4e Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 1 Jan 2022 08:50:50 +1100 Subject: [PATCH 10/17] Update README date --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e64158e0b..77864e529f 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,4 @@ Binaries -------- Precompiled binaries are available for end users on [Jenkins](https://www.spigotmc.org/go/bungeecord-dl). -(c) 2012-2021 SpigotMC Pty. Ltd. +(c) 2012-2022 SpigotMC Pty. Ltd. From ad8a8ef5a92bd55e0fc11fabf396926761d37834 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 1 Jan 2022 09:22:26 +1100 Subject: [PATCH 11/17] Increase per-listener event bus warning time --- event/src/main/java/net/md_5/bungee/event/EventBus.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d3c6ea9d1f..fb301a4498 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 @@ -59,7 +59,7 @@ public void post(Object event) } long elapsed = System.nanoTime() - start; - if ( elapsed > 20000000 ) + if ( elapsed > 50000000 ) { logger.log( Level.WARNING, "Plugin listener {0} took {1}ms to process event {2}!", new Object[] { From 6cbd7404f483028068f858aaf6e42f4eb23136be Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Jan 2022 10:13:48 +1100 Subject: [PATCH 12/17] Fix checkstyle paren pad settings --- checkstyle.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checkstyle.xml b/checkstyle.xml index cde9c2101f..3acb90f5dd 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -55,11 +55,11 @@ - + - + From 9c95d4ba43ba84d10e8bb7d7c92d7e6c5f161ed2 Mon Sep 17 00:00:00 2001 From: Outfluencer <48880402+Outfluencer@users.noreply.github.com> Date: Sun, 2 Jan 2022 10:13:48 +1100 Subject: [PATCH 13/17] #3226: Add console command name tab completion --- .../command/ConsoleCommandCompleter.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/command/ConsoleCommandCompleter.java b/proxy/src/main/java/net/md_5/bungee/command/ConsoleCommandCompleter.java index bd52d880b0..3e5ca39475 100644 --- a/proxy/src/main/java/net/md_5/bungee/command/ConsoleCommandCompleter.java +++ b/proxy/src/main/java/net/md_5/bungee/command/ConsoleCommandCompleter.java @@ -2,6 +2,9 @@ import java.util.ArrayList; import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.stream.Collectors; import jline.console.completer.Completer; import lombok.RequiredArgsConstructor; import net.md_5.bungee.api.ProxyServer; @@ -15,11 +18,21 @@ public class ConsoleCommandCompleter implements Completer @Override public int complete(String buffer, int cursor, List candidates) { - List suggestions = new ArrayList<>(); - proxy.getPluginManager().dispatchCommand( proxy.getConsole(), buffer, suggestions ); - candidates.addAll( suggestions ); - int lastSpace = buffer.lastIndexOf( ' ' ); + if ( lastSpace == -1 ) + { + String lowerCase = buffer.toLowerCase( Locale.ROOT ); + candidates.addAll( proxy.getPluginManager().getCommands().stream() + .map( Map.Entry::getKey ) + .filter( (name) -> name.toLowerCase( Locale.ROOT ).startsWith( lowerCase ) ) + .collect( Collectors.toList() ) ); + } else + { + List suggestions = new ArrayList<>(); + proxy.getPluginManager().dispatchCommand( proxy.getConsole(), buffer, suggestions ); + candidates.addAll( suggestions ); + } + return ( lastSpace == -1 ) ? cursor - buffer.length() : cursor - ( buffer.length() - lastSpace - 1 ); } } From d2d157c1fe31bdb4f5fb19596e40a030f6ef9226 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 6 Feb 2022 08:26:09 +1100 Subject: [PATCH 14/17] #3246: Fix commands not working due to MinecraftForge changes --- .../md_5/bungee/connection/DownstreamBridge.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 075676e730..257779bfb0 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 @@ -11,7 +11,7 @@ import com.mojang.brigadier.context.StringRange; import com.mojang.brigadier.suggestion.Suggestion; import com.mojang.brigadier.suggestion.Suggestions; -import com.mojang.brigadier.tree.LiteralCommandNode; +import com.mojang.brigadier.tree.CommandNode; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.Unpooled; @@ -67,6 +67,13 @@ public class DownstreamBridge extends PacketHandler { + // #3246: Recent versions of MinecraftForge alter Vanilla behaviour and require a command so that the executable flag is set + // If the flag is not set, then the command will appear and successfully tab complete, but cannot be successfully executed + private static final com.mojang.brigadier.Command DUMMY_COMMAND = (context) -> + { + return 0; + }; + // private final ProxyServer bungee; private final UserConnection con; private final ServerConnection server; @@ -654,9 +661,9 @@ public void handle(Commands commands) throws Exception { if ( !bungee.getDisabledCommands().contains( command.getKey() ) && commands.getRoot().getChild( command.getKey() ) == null && command.getValue().hasPermission( con ) ) { - LiteralCommandNode dummy = LiteralArgumentBuilder.literal( command.getKey() ) + CommandNode dummy = LiteralArgumentBuilder.literal( command.getKey() ).executes( DUMMY_COMMAND ) .then( RequiredArgumentBuilder.argument( "args", StringArgumentType.greedyString() ) - .suggests( Commands.SuggestionRegistry.ASK_SERVER ) ) + .suggests( Commands.SuggestionRegistry.ASK_SERVER ).executes( DUMMY_COMMAND ) ) .build(); commands.getRoot().addChild( dummy ); From eae9d45c8a4142541dfda7f6322784d148d4b027 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 6 Feb 2022 08:39:23 +1100 Subject: [PATCH 15/17] Provide more information in connect errors --- api/src/main/java/net/md_5/bungee/Util.java | 15 ++++++++++++++- .../main/java/net/md_5/bungee/UserConnection.java | 9 +-------- proxy/src/main/resources/messages.properties | 3 +-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/Util.java b/api/src/main/java/net/md_5/bungee/Util.java index e565c836bc..1457d4c8ab 100644 --- a/api/src/main/java/net/md_5/bungee/Util.java +++ b/api/src/main/java/net/md_5/bungee/Util.java @@ -88,11 +88,24 @@ public static String unicode(char c) * @return a string representing information about the {@link Throwable} */ public static String exception(Throwable t) + { + return exception( t, true ); + } + + /** + * Constructs a pretty one line version of a {@link Throwable}. Useful for + * debugging. + * + * @param t the {@link Throwable} to format. + * @param includeLineNumbers whether to include line numbers + * @return a string representing information about the {@link Throwable} + */ + public static String exception(Throwable t, boolean includeLineNumbers) { // TODO: We should use clear manually written exceptions StackTraceElement[] trace = t.getStackTrace(); return t.getClass().getSimpleName() + " : " + t.getMessage() - + ( ( trace.length > 0 ) ? " @ " + t.getStackTrace()[0].getClassName() + ":" + t.getStackTrace()[0].getLineNumber() : "" ); + + ( ( includeLineNumbers && trace.length > 0 ) ? " @ " + t.getStackTrace()[0].getClassName() + ":" + t.getStackTrace()[0].getLineNumber() : "" ); } public static String csv(Iterable objects) 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 bf25658bae..e481d6dfa4 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -8,7 +8,6 @@ import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; -import io.netty.channel.ConnectTimeoutException; import io.netty.util.internal.PlatformDependent; import java.net.InetSocketAddress; import java.net.SocketAddress; @@ -373,13 +372,7 @@ public void operationComplete(ChannelFuture future) throws Exception private String connectionFailMessage(Throwable cause) { - if ( cause instanceof ConnectTimeoutException ) - { - return bungee.getTranslation( "timeout" ); - } else - { - return cause.getClass().getName(); - } + return Util.exception( cause, false ); } @Override diff --git a/proxy/src/main/resources/messages.properties b/proxy/src/main/resources/messages.properties index 5890e8c909..e16cf0a816 100644 --- a/proxy/src/main/resources/messages.properties +++ b/proxy/src/main/resources/messages.properties @@ -5,9 +5,8 @@ already_connecting=\u00a7cAlready connecting to this server! command_list=\u00a7a[{0}] \u00a7e({1}): \u00a7r{2} connect_kick=\u00a7cKicked whilst connecting to {0}: {1} current_server=\u00a76You are currently connected to {0}. -fallback_kick=\u00a7cCould not connect to a default or fallback server, please try again later: {0} +fallback_kick=\u00a7cCould not connect to a default or fallback server. Incorrectly configured address/port/firewall? {0} fallback_lobby=\u00a7cCould not connect to target server, you have been moved to a fallback server. -timeout=Server not reachable (timeout). Offline? Incorrectly configured address/port/firewall? lost_connection=[Proxy] Lost connection to server. mojang_fail=Error occurred while contacting login servers, are they down? no_permission=\u00a7cYou do not have permission to execute this command! From f4f94d3b56019bb9c02e7a33842dba74e8877b11 Mon Sep 17 00:00:00 2001 From: nnnnt21 Date: Wed, 23 Feb 2022 15:06:10 -0600 Subject: [PATCH 16/17] #3256: Allow - and . in online mode as some accounts still have these usernames --- proxy/src/main/java/net/md_5/bungee/util/AllowedCharacters.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/src/main/java/net/md_5/bungee/util/AllowedCharacters.java b/proxy/src/main/java/net/md_5/bungee/util/AllowedCharacters.java index d1cd109055..1a4242a2ec 100644 --- a/proxy/src/main/java/net/md_5/bungee/util/AllowedCharacters.java +++ b/proxy/src/main/java/net/md_5/bungee/util/AllowedCharacters.java @@ -17,7 +17,7 @@ private static boolean isNameAllowedCharacter(char c, boolean onlineMode) { if ( onlineMode ) { - return ( c >= 'a' && c <= 'z' ) || ( c >= '0' && c <= '9' ) || ( c >= 'A' && c <= 'Z' ) || c == '_'; + return ( c >= 'a' && c <= 'z' ) || ( c >= '0' && c <= '9' ) || ( c >= 'A' && c <= 'Z' ) || c == '_' || c == '.' || c == '-'; } else { // Don't allow spaces, Yaml config doesn't support them From 7e47490e7053d110a33a3c86b025af91bd803388 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 1 Mar 2022 02:00:00 +1100 Subject: [PATCH 17/17] Minecraft 1.18.2 support --- .../md_5/bungee/protocol/ProtocolConstants.java | 4 +++- .../md_5/bungee/protocol/packet/Commands.java | 16 ++++++++++++++++ .../net/md_5/bungee/entitymap/EntityMap.java | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java b/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java index a821fb545d..7da127fb33 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java @@ -37,6 +37,7 @@ public class ProtocolConstants public static final int MINECRAFT_1_17 = 755; public static final int MINECRAFT_1_17_1 = 756; public static final int MINECRAFT_1_18 = 757; + public static final int MINECRAFT_1_18_2 = 758; public static final List SUPPORTED_VERSIONS; public static final List SUPPORTED_VERSION_IDS; @@ -85,7 +86,8 @@ public class ProtocolConstants ProtocolConstants.MINECRAFT_1_16_4, ProtocolConstants.MINECRAFT_1_17, ProtocolConstants.MINECRAFT_1_17_1, - ProtocolConstants.MINECRAFT_1_18 + ProtocolConstants.MINECRAFT_1_18, + ProtocolConstants.MINECRAFT_1_18_2 ); if ( SNAPSHOT_SUPPORT ) diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java index 26edbca85b..633e557cd3 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Commands.java @@ -498,6 +498,20 @@ protected String getKey() return "brigadier:string"; } }; + private static final ArgumentSerializer RAW_STRING = new ArgumentSerializer() + { + @Override + protected String read(ByteBuf buf) + { + return DefinedPacket.readString( buf ); + } + + @Override + protected void write(ByteBuf buf, String t) + { + DefinedPacket.writeString( t, buf ); + } + }; static { @@ -551,6 +565,8 @@ protected String getKey() PROVIDERS.put( "minecraft:test_argument", VOID ); // 1.16, debug PROVIDERS.put( "minecraft:test_class", VOID ); // 1.16, debug PROVIDERS.put( "minecraft:angle", VOID ); // 1.16.2 + PROVIDERS.put( "minecraft:resource", RAW_STRING ); // 1.18.2 + PROVIDERS.put( "minecraft:resource_or_tag", RAW_STRING ); // 1.18.2 } private static ArgumentType read(String key, ByteBuf buf) 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 23715f68c8..75164c67f3 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 @@ -72,6 +72,7 @@ public static EntityMap getEntityMap(int version) case ProtocolConstants.MINECRAFT_1_17_1: return EntityMap_1_16_2.INSTANCE_1_17; case ProtocolConstants.MINECRAFT_1_18: + case ProtocolConstants.MINECRAFT_1_18_2: return EntityMap_1_16_2.INSTANCE_1_18; } throw new RuntimeException( "Version " + version + " has no entity map" );