Add server switch event
This commit is contained in:
parent
9d3bddedb6
commit
49ea7f908f
@ -0,0 +1,21 @@
|
|||||||
|
package net.md_5.bungee.api.event;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.api.plugin.Event;
|
||||||
|
/**
|
||||||
|
* Called when a player has changed servers.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = false)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class ServerSwitchEvent extends Event
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Player whom the server is for.
|
||||||
|
*/
|
||||||
|
private final ProxiedPlayer player;
|
||||||
|
}
|
@ -15,6 +15,7 @@ import net.md_5.bungee.api.ProxyServer;
|
|||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
||||||
import net.md_5.bungee.api.event.ServerKickEvent;
|
import net.md_5.bungee.api.event.ServerKickEvent;
|
||||||
|
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||||
import net.md_5.bungee.api.scoreboard.Objective;
|
import net.md_5.bungee.api.scoreboard.Objective;
|
||||||
import net.md_5.bungee.api.scoreboard.Scoreboard;
|
import net.md_5.bungee.api.scoreboard.Scoreboard;
|
||||||
import net.md_5.bungee.api.scoreboard.Team;
|
import net.md_5.bungee.api.scoreboard.Team;
|
||||||
@ -189,6 +190,8 @@ public class ServerConnector extends PacketHandler
|
|||||||
ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new DownstreamBridge( bungee, user, server ) );
|
ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new DownstreamBridge( bungee, user, server ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bungee.getPluginManager().callEvent( new ServerSwitchEvent( user ) );
|
||||||
|
|
||||||
thisState = State.FINISHED;
|
thisState = State.FINISHED;
|
||||||
|
|
||||||
throw new CancelSendSignal();
|
throw new CancelSendSignal();
|
||||||
|
Loading…
Reference in New Issue
Block a user