Extra events (#630)
* eventype player join * playerjoin event * player leave * player leave event * typo * remove * leave fix
This commit is contained in:
@@ -20,7 +20,7 @@ import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
|
|||||||
import io.anuke.mindustry.entities.traits.Entity;
|
import io.anuke.mindustry.entities.traits.Entity;
|
||||||
import io.anuke.mindustry.entities.traits.SyncTrait;
|
import io.anuke.mindustry.entities.traits.SyncTrait;
|
||||||
import io.anuke.mindustry.entities.type.Player;
|
import io.anuke.mindustry.entities.type.Player;
|
||||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.game.Version;
|
import io.anuke.mindustry.game.Version;
|
||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.gen.Call;
|
||||||
@@ -185,6 +185,8 @@ public class NetServer implements ApplicationListener{
|
|||||||
sendWorldData(player, id);
|
sendWorldData(player, id);
|
||||||
|
|
||||||
platform.updateRPC();
|
platform.updateRPC();
|
||||||
|
|
||||||
|
Events.fire(new PlayerJoin(player));
|
||||||
});
|
});
|
||||||
|
|
||||||
Net.handleServer(InvokePacket.class, (id, packet) -> {
|
Net.handleServer(InvokePacket.class, (id, packet) -> {
|
||||||
@@ -402,6 +404,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(player.con.hasConnected){
|
if(player.con.hasConnected){
|
||||||
|
Events.fire(new PlayerLeave(player));
|
||||||
Call.sendMessage("[accent]" + player.name + "[accent] has disconnected.");
|
Call.sendMessage("[accent]" + player.name + "[accent] has disconnected.");
|
||||||
Call.onPlayerDisconnect(player.id);
|
Call.onPlayerDisconnect(player.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import io.anuke.mindustry.entities.traits.BuilderTrait;
|
|||||||
import io.anuke.mindustry.entities.type.Unit;
|
import io.anuke.mindustry.entities.type.Unit;
|
||||||
import io.anuke.mindustry.type.Zone;
|
import io.anuke.mindustry.type.Zone;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.mindustry.entities.type.Player;
|
||||||
|
|
||||||
public class EventType{
|
public class EventType{
|
||||||
|
|
||||||
@@ -184,5 +185,22 @@ public class EventType{
|
|||||||
public static class ResizeEvent{
|
public static class ResizeEvent{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class PlayerJoin{
|
||||||
|
public final Player player;
|
||||||
|
|
||||||
|
public PlayerJoin(Player player){
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PlayerLeave{
|
||||||
|
public final Player player;
|
||||||
|
|
||||||
|
public PlayerLeave(Player player){
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user