mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-30 14:13:47 +01:00
Implement ServerDisconnectEvent. Wow so many server switch events.
This commit is contained in:
parent
d7e78d0945
commit
f7851b0436
@ -0,0 +1,29 @@
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
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.plugin.Event;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@ToString(callSuper = false)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ServerDisconnectEvent extends Event
|
||||
{
|
||||
|
||||
/**
|
||||
* Player disconnecting from a server.
|
||||
*/
|
||||
@NonNull
|
||||
private final ProxiedPlayer player;
|
||||
/**
|
||||
* Server the player is disconnecting from.
|
||||
*/
|
||||
@NonNull
|
||||
private ServerInfo target;
|
||||
}
|
@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.EntityMap;
|
||||
import net.md_5.bungee.ServerConnection;
|
||||
import net.md_5.bungee.api.event.ServerDisconnectEvent;
|
||||
import net.md_5.bungee.UserConnection;
|
||||
import net.md_5.bungee.Util;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
@ -69,6 +70,9 @@ public class DownstreamBridge extends PacketHandler
|
||||
{
|
||||
con.disconnect( bungee.getTranslation( "lost_connection" ) );
|
||||
}
|
||||
|
||||
ServerDisconnectEvent serverDisconnectEvent = new ServerDisconnectEvent( con, server.getInfo() );
|
||||
bungee.getPluginManager().callEvent( serverDisconnectEvent );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user