mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-25 18:17:38 +01:00
#2379: Add ServerSwitchEvent getFrom API
This commit is contained in:
parent
cb3f87bb27
commit
f1c32f84f4
@ -3,6 +3,7 @@ package net.md_5.bungee.api.event;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.plugin.Event;
|
import net.md_5.bungee.api.plugin.Event;
|
||||||
|
|
||||||
@ -19,4 +20,9 @@ public class ServerSwitchEvent extends Event
|
|||||||
* Player whom the server is for.
|
* Player whom the server is for.
|
||||||
*/
|
*/
|
||||||
private final ProxiedPlayer player;
|
private final ProxiedPlayer player;
|
||||||
|
/**
|
||||||
|
* Server the player is switch from. May be null if initial proxy
|
||||||
|
* connection.
|
||||||
|
*/
|
||||||
|
private final ServerInfo from;
|
||||||
}
|
}
|
||||||
|
@ -292,10 +292,11 @@ public class ServerConnector extends PacketHandler
|
|||||||
user.setServerJoinQueue( null );
|
user.setServerJoinQueue( null );
|
||||||
user.setDimensionChange( false );
|
user.setDimensionChange( false );
|
||||||
|
|
||||||
|
ServerInfo from = ( user.getServer() == null ) ? null : user.getServer().getInfo();
|
||||||
user.setServer( server );
|
user.setServer( server );
|
||||||
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 ) );
|
bungee.getPluginManager().callEvent( new ServerSwitchEvent( user, from ) );
|
||||||
|
|
||||||
thisState = State.FINISHED;
|
thisState = State.FINISHED;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user