From 39a80e414e3172375809c331fd1b571271ada1a5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 26 May 2021 10:31:08 +1000 Subject: [PATCH] #3093: Support names with '.', block names with ' ' --- proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java | 5 ++++- .../main/java/net/md_5/bungee/connection/InitialHandler.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java index c0620445c..2691b8b84 100644 --- a/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java +++ b/proxy/src/main/java/net/md_5/bungee/conf/YamlConfig.java @@ -299,7 +299,10 @@ public class YamlConfig implements ConfigurationAdapter @SuppressWarnings("unchecked") public Collection getGroups(String player) { - Collection groups = get( "groups." + player, null ); + // #1270: Do this to support player names with . + Map> raw = get( "groups", Collections.emptyMap() ); + Collection groups = raw.get( player ); + Collection ret = ( groups == null ) ? new HashSet() : new HashSet<>( groups ); ret.add( "default" ); return ret; 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 ea7614c5d..e7ae30d3e 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 @@ -354,7 +354,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection Preconditions.checkState( thisState == State.USERNAME, "Not expecting USERNAME" ); this.loginRequest = loginRequest; - if ( getName().contains( "." ) ) + if ( getName().contains( " " ) ) { disconnect( bungee.getTranslation( "name_invalid" ) ); return;