Merge pull request #250 from weaondara/master
check the player's server before connecting
This commit is contained in:
commit
3733ecf628
@ -92,8 +92,8 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
public void setDisplayName(String name)
|
public void setDisplayName(String name)
|
||||||
{
|
{
|
||||||
Preconditions.checkArgument( name.length() <= 16, "Display name cannot be longer than 16 characters" );
|
Preconditions.checkArgument( name.length() <= 16, "Display name cannot be longer than 16 characters" );
|
||||||
displayName=name;
|
|
||||||
bungee.getTabListHandler().onDisconnect( this );
|
bungee.getTabListHandler().onDisconnect( this );
|
||||||
|
displayName=name;
|
||||||
bungee.getTabListHandler().onConnect( this );
|
bungee.getTabListHandler().onConnect( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +121,11 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
ServerConnectEvent event = new ServerConnectEvent( this, info );
|
ServerConnectEvent event = new ServerConnectEvent( this, info );
|
||||||
ProxyServer.getInstance().getPluginManager().callEvent( event );
|
ProxyServer.getInstance().getPluginManager().callEvent( event );
|
||||||
final ServerInfo target = event.getTarget(); // Update in case the event changed target
|
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()
|
new Bootstrap()
|
||||||
.channel( NioSocketChannel.class )
|
.channel( NioSocketChannel.class )
|
||||||
.group( BungeeCord.getInstance().eventLoops )
|
.group( BungeeCord.getInstance().eventLoops )
|
||||||
|
Loading…
Reference in New Issue
Block a user