Added ConnectionEvent

This commit is contained in:
Anuken
2021-03-04 18:39:47 -05:00
parent c12b9ee3e3
commit cc65feb392
3 changed files with 12 additions and 1 deletions

View File

@@ -81,6 +81,8 @@ public class NetServer implements ApplicationListener{
public NetServer(){
net.handleServer(Connect.class, (con, connect) -> {
Events.fire(new ConnectionEvent(con));
if(admins.isIPBanned(connect.addressTCP) || admins.isSubnetBanned(connect.addressTCP)){
con.kick(KickReason.banned);
}

View File

@@ -383,6 +383,15 @@ public class EventType{
}
}
/** Called when a connection is established to a client. */
public static class ConnectionEvent{
public final NetConnection connection;
public ConnectionEvent(NetConnection connection){
this.connection = connection;
}
}
/** Called after connecting; when a player receives world data and is ready to play.*/
public static class PlayerJoin{
public final Player player;