Add server connected event
This commit is contained in:
parent
77d5398124
commit
9ce148681d
@ -0,0 +1,30 @@
|
||||
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.connection.Server;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
/**
|
||||
* Not to be confused with {@link ServerConnectEvent}, this event is called once
|
||||
* a connection to a server is fully operational, and is about to hand over
|
||||
* control of the session to the player. It is useful if you wish to send
|
||||
* information to the server before the player logs in.
|
||||
*/
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ServerConnectedEvent extends Event
|
||||
{
|
||||
|
||||
/**
|
||||
* Player whom the server is for.
|
||||
*/
|
||||
private final ProxiedPlayer player;
|
||||
/**
|
||||
* The server itself.
|
||||
*/
|
||||
private final Server server;
|
||||
}
|
@ -8,9 +8,11 @@ import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import javax.crypto.SecretKey;
|
||||
import net.md_5.bungee.api.Callback;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.ServerPing;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.Server;
|
||||
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
||||
import net.md_5.bungee.packet.DefinedPacket;
|
||||
import net.md_5.bungee.packet.Packet1Login;
|
||||
import net.md_5.bungee.packet.Packet2Handshake;
|
||||
@ -81,7 +83,10 @@ public class ServerConnection extends GenericConnection implements Server
|
||||
}
|
||||
Packet1Login login = new Packet1Login(loginResponse);
|
||||
|
||||
return new ServerConnection(name, socket, in, out, login);
|
||||
ServerConnection server = new ServerConnection(name, socket, in, out, login);
|
||||
ServerConnectedEvent event = new ServerConnectedEvent(user, server);
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(event);
|
||||
return server;
|
||||
} catch (KickException ex)
|
||||
{
|
||||
throw ex;
|
||||
|
Loading…
Reference in New Issue
Block a user