Follow vanilla and kick the joining user on connect if the name is already taken (Fixes #1383)

This commit is contained in:
Thinkofdeath 2015-02-28 13:07:13 +00:00
parent f2673c5876
commit f2d17cb216

View File

@ -433,6 +433,16 @@ public class InitialHandler extends PacketHandler implements PendingConnection
// TODO See #1218 // TODO See #1218
oldID.disconnect( bungee.getTranslation( "already_connected" ) ); oldID.disconnect( bungee.getTranslation( "already_connected" ) );
} }
} else {
// In offline mode the existing user stays and we kick the new one
ProxiedPlayer oldName = bungee.getPlayer( getName() );
if ( oldName != null )
{
// TODO See #1218
disconnect( bungee.getTranslation( "already_connected" ) );
return;
}
} }
offlineId = java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + getName() ).getBytes( Charsets.UTF_8 ) ); offlineId = java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + getName() ).getBytes( Charsets.UTF_8 ) );