parent
841c81cdc4
commit
e556fd7150
@ -51,6 +51,14 @@ public interface Connection
|
||||
*/
|
||||
void disconnect(BaseComponent reason);
|
||||
|
||||
/**
|
||||
* Gets whether this connection is currently open, ie: not disconnected, and
|
||||
* able to send / receive data.
|
||||
*
|
||||
* @return current connection status
|
||||
*/
|
||||
boolean isConnected();
|
||||
|
||||
/**
|
||||
* Get the unsafe methods of this class.
|
||||
*
|
||||
|
@ -77,6 +77,12 @@ public class ServerConnection implements Server
|
||||
return getInfo().getAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected()
|
||||
{
|
||||
return !ch.isClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Unsafe unsafe()
|
||||
{
|
||||
|
@ -274,15 +274,12 @@ public final class UserConnection implements ProxiedPlayer
|
||||
{
|
||||
sendMessage( bungee.getTranslation( "fallback_lobby" ) );
|
||||
connect( def, null, false );
|
||||
} else if ( dimensionChange )
|
||||
{
|
||||
disconnect( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
|
||||
} else
|
||||
{
|
||||
if ( dimensionChange )
|
||||
{
|
||||
disconnect( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
|
||||
} else
|
||||
{
|
||||
sendMessage( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
|
||||
}
|
||||
sendMessage( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -592,4 +589,10 @@ public final class UserConnection implements ProxiedPlayer
|
||||
ch.setCompressionThreshold( compressionThreshold );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected()
|
||||
{
|
||||
return !ch.isClosed();
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
private LoginRequest loginRequest;
|
||||
private EncryptionRequest request;
|
||||
@Getter
|
||||
private final List<PluginMessage> registerMessages = new BoundedArrayList<>(128);
|
||||
private final List<PluginMessage> registerMessages = new BoundedArrayList<>( 128 );
|
||||
private State thisState = State.HANDSHAKE;
|
||||
private final Unsafe unsafe = new Unsafe()
|
||||
{
|
||||
@ -606,4 +606,10 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
{
|
||||
return "[" + ( ( getName() != null ) ? getName() : getAddress() ) + "] <-> InitialHandler";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected()
|
||||
{
|
||||
return !ch.isClosed();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user