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
@@ -63,7 +63,7 @@ public class RemoteProcess extends BaseProcessor{
classes = new Seq<>(); classes = new Seq<>();
Seq<Smethod> orderedElements = elements.copy(); Seq<Smethod> orderedElements = elements.copy();
orderedElements.sortComparing(Object::toString); orderedElements.sort((a, b) -> -a.toString().compareTo(b.toString()));
//create methods //create methods
for(Smethod element : orderedElements){ for(Smethod element : orderedElements){
+2
View File
@@ -81,6 +81,8 @@ public class NetServer implements ApplicationListener{
public NetServer(){ public NetServer(){
net.handleServer(Connect.class, (con, connect) -> { net.handleServer(Connect.class, (con, connect) -> {
Events.fire(new ConnectionEvent(con));
if(admins.isIPBanned(connect.addressTCP) || admins.isSubnetBanned(connect.addressTCP)){ if(admins.isIPBanned(connect.addressTCP) || admins.isSubnetBanned(connect.addressTCP)){
con.kick(KickReason.banned); con.kick(KickReason.banned);
} }
+9
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.*/ /** Called after connecting; when a player receives world data and is ready to play.*/
public static class PlayerJoin{ public static class PlayerJoin{
public final Player player; public final Player player;