From 68712ab8541cec9471bbf0e8e9fe37f6e9242d38 Mon Sep 17 00:00:00 2001 From: weaondara Date: Tue, 2 Apr 2013 02:13:29 +0300 Subject: [PATCH 1/3] check the player's server before really connecting otherwise the player will be kicked with the message "Logged in from another location" if the target server is the current server --- proxy/src/main/java/net/md_5/bungee/UserConnection.java | 4 ++++ 1 file changed, 4 insertions(+) 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 4a04e8eb8..070cb761d 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -121,6 +121,10 @@ public final class UserConnection implements ProxiedPlayer ServerConnectEvent event = new ServerConnectEvent( this, info ); ProxyServer.getInstance().getPluginManager().callEvent( event ); final ServerInfo target = event.getTarget(); // Update in case the event changed target + if ( getServer() != null && getServer().getInfo() == target ) + { + return; + } new Bootstrap() .channel( NioSocketChannel.class ) .group( BungeeCord.getInstance().eventLoops ) From d900a5eae74c43cb613b298cf7fb11e0268cbe74 Mon Sep 17 00:00:00 2001 From: weaondara Date: Tue, 2 Apr 2013 12:18:43 +0300 Subject: [PATCH 2/3] setDisplayName bug fix first remove then change and add again --- proxy/src/main/java/net/md_5/bungee/UserConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 070cb761d..68e31b760 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -92,8 +92,8 @@ public final class UserConnection implements ProxiedPlayer public void setDisplayName(String name) { Preconditions.checkArgument( name.length() <= 16, "Display name cannot be longer than 16 characters" ); - displayName=name; bungee.getTabListHandler().onDisconnect( this ); + displayName=name; bungee.getTabListHandler().onConnect( this ); } From 6e9cdb2e20c8d4138f08e9e4596dbb3f6cc54a75 Mon Sep 17 00:00:00 2001 From: weaondara Date: Thu, 4 Apr 2013 18:44:46 +0300 Subject: [PATCH 3/3] send message to player if target is current server --- proxy/src/main/java/net/md_5/bungee/UserConnection.java | 1 + 1 file changed, 1 insertion(+) 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 68e31b760..fdc6ee7f4 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -123,6 +123,7 @@ public final class UserConnection implements ProxiedPlayer final ServerInfo target = event.getTarget(); // Update in case the event changed target if ( getServer() != null && getServer().getInfo() == target ) { + sendMessage( ChatColor.RED + "Cannot connect to server you are already on!" ); return; } new Bootstrap()