Added getKickedFrom() to ServerKickEvent.
This commit is contained in:
parent
e849afbb23
commit
4d1f0cbb26
@ -27,6 +27,11 @@ public class ServerKickEvent extends Event implements Cancellable
|
||||
* Player being kicked.
|
||||
*/
|
||||
private final ProxiedPlayer player;
|
||||
/**
|
||||
* The server the player was kicked from, should be used in preference to
|
||||
* {@link ProxiedPlayer#getServer()}.
|
||||
*/
|
||||
private final ServerInfo kickedFrom;
|
||||
/**
|
||||
* Kick reason.
|
||||
*/
|
||||
@ -46,14 +51,22 @@ public class ServerKickEvent extends Event implements Cancellable
|
||||
CONNECTING, CONNECTED, UNKNOWN;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ServerKickEvent(ProxiedPlayer player, BaseComponent[] kickReasonComponent, ServerInfo cancelServer)
|
||||
{
|
||||
this( player, kickReasonComponent, cancelServer, State.UNKNOWN );
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ServerKickEvent(ProxiedPlayer player, BaseComponent[] kickReasonComponent, ServerInfo cancelServer, State state)
|
||||
{
|
||||
this( player, player.getServer().getInfo(), kickReasonComponent, cancelServer, state );
|
||||
}
|
||||
|
||||
public ServerKickEvent(ProxiedPlayer player, ServerInfo kickedFrom, BaseComponent[] kickReasonComponent, ServerInfo cancelServer, State state)
|
||||
{
|
||||
this.player = player;
|
||||
this.kickedFrom = kickedFrom;
|
||||
this.kickReasonComponent = kickReasonComponent;
|
||||
this.cancelServer = cancelServer;
|
||||
this.state = state;
|
||||
|
@ -210,7 +210,7 @@ public class ServerConnector extends PacketHandler
|
||||
{
|
||||
def = null;
|
||||
}
|
||||
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( user, ComponentSerializer.parse( kick.getMessage() ), def, ServerKickEvent.State.CONNECTING ) );
|
||||
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( user, target, ComponentSerializer.parse( kick.getMessage() ), def, ServerKickEvent.State.CONNECTING ) );
|
||||
if ( event.isCancelled() && event.getCancelServer() != null )
|
||||
{
|
||||
user.connect( event.getCancelServer() );
|
||||
|
@ -383,7 +383,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
{
|
||||
def = null;
|
||||
}
|
||||
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( con, ComponentSerializer.parse( kick.getMessage() ), def, ServerKickEvent.State.CONNECTED ) );
|
||||
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( con, server.getInfo(), ComponentSerializer.parse( kick.getMessage() ), def, ServerKickEvent.State.CONNECTED ) );
|
||||
if ( event.isCancelled() && event.getCancelServer() != null )
|
||||
{
|
||||
con.connectNow( event.getCancelServer() );
|
||||
|
Loading…
Reference in New Issue
Block a user