Add State to ServerKickEvent
This commit is contained in:
parent
14ac2dd308
commit
ee8f33c196
@ -33,11 +33,27 @@ public class ServerKickEvent extends Event implements Cancellable
|
|||||||
* Server to send player to if this event is cancelled.
|
* Server to send player to if this event is cancelled.
|
||||||
*/
|
*/
|
||||||
private ServerInfo cancelServer;
|
private ServerInfo cancelServer;
|
||||||
|
/**
|
||||||
|
* State in which the kick occured.
|
||||||
|
*/
|
||||||
|
private State state;
|
||||||
|
|
||||||
|
public enum State
|
||||||
|
{
|
||||||
|
|
||||||
|
CONNECTING, CONNECTED, UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
public ServerKickEvent(ProxiedPlayer player, String kickReason, ServerInfo cancelServer)
|
public ServerKickEvent(ProxiedPlayer player, String kickReason, ServerInfo cancelServer)
|
||||||
|
{
|
||||||
|
this(player, kickReason, cancelServer, State.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerKickEvent(ProxiedPlayer player, String kickReason, ServerInfo cancelServer, State state)
|
||||||
{
|
{
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.kickReason = kickReason;
|
this.kickReason = kickReason;
|
||||||
this.cancelServer = cancelServer;
|
this.cancelServer = cancelServer;
|
||||||
|
this.state = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ public class ServerConnector extends PacketHandler
|
|||||||
{
|
{
|
||||||
def = null;
|
def = null;
|
||||||
}
|
}
|
||||||
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( user, kick.getMessage(), def ) );
|
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( user, kick.getMessage(), def, ServerKickEvent.State.CONNECTING ) );
|
||||||
if ( event.isCancelled() && event.getCancelServer() != null )
|
if ( event.isCancelled() && event.getCancelServer() != null )
|
||||||
{
|
{
|
||||||
user.connect( event.getCancelServer() );
|
user.connect( event.getCancelServer() );
|
||||||
|
@ -325,7 +325,7 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
{
|
{
|
||||||
def = null;
|
def = null;
|
||||||
}
|
}
|
||||||
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( con, kick.getMessage(), def ) );
|
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( con, kick.getMessage(), def, ServerKickEvent.State.CONNECTED ) );
|
||||||
if ( event.isCancelled() && event.getCancelServer() != null )
|
if ( event.isCancelled() && event.getCancelServer() != null )
|
||||||
{
|
{
|
||||||
con.connectNow( event.getCancelServer() );
|
con.connectNow( event.getCancelServer() );
|
||||||
|
Loading…
Reference in New Issue
Block a user