Added 2 versatile trigger event types (#6130)

* t

* oops
This commit is contained in:
GlennFolker 2021-10-10 19:08:04 +07:00 committed by GitHub
parent c22ede229e
commit 758921c077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 9 deletions

View File

@ -191,6 +191,7 @@ const PlayEvent = Packages.mindustry.game.EventType.PlayEvent
const DisposeEvent = Packages.mindustry.game.EventType.DisposeEvent
const ServerLoadEvent = Packages.mindustry.game.EventType.ServerLoadEvent
const ClientCreateEvent = Packages.mindustry.game.EventType.ClientCreateEvent
const SaveWriteEvent = Packages.mindustry.game.EventType.SaveWriteEvent
const SaveLoadEvent = Packages.mindustry.game.EventType.SaveLoadEvent
const MapPublishEvent = Packages.mindustry.game.EventType.MapPublishEvent
const MapMakeEvent = Packages.mindustry.game.EventType.MapMakeEvent

View File

@ -299,6 +299,7 @@ public class Renderer implements ApplicationListener{
Draw.draw(Layer.overlayUI, overlays::drawTop);
Draw.draw(Layer.space, this::drawLanding);
Events.fire(Trigger.drawOver);
blocks.drawBlocks();
Groups.draw.draw(Drawc::draw);

View File

@ -33,6 +33,7 @@ public class EventType{
socketConfigChanged,
update,
draw,
drawOver,
preDraw,
postDraw,
uiDrawBegin,
@ -50,6 +51,7 @@ public class EventType{
public static class ResizeEvent{}
public static class MapMakeEvent{}
public static class MapPublishEvent{}
public static class SaveWriteEvent{}
public static class SaveLoadEvent{}
public static class ClientCreateEvent{}
public static class ServerLoadEvent{}
@ -503,7 +505,7 @@ public class EventType{
this.player = player;
}
}
public static class PlayerBanEvent{
@Nullable
public final Player player;
@ -514,7 +516,7 @@ public class EventType{
this.uuid = uuid;
}
}
public static class PlayerUnbanEvent{
@Nullable
public final Player player;
@ -525,7 +527,7 @@ public class EventType{
this.uuid = uuid;
}
}
public static class PlayerIpBanEvent{
public final String ip;
@ -533,7 +535,7 @@ public class EventType{
this.ip = ip;
}
}
public static class PlayerIpUnbanEvent{
public final String ip;
@ -541,6 +543,5 @@ public class EventType{
this.ip = ip;
}
}
}
}

View File

@ -113,13 +113,17 @@ public class SaveIO{
public static void write(OutputStream os, StringMap tags){
try(DataOutputStream stream = new DataOutputStream(os)){
SaveVersion ver = getVersion();
stream.write(header);
stream.writeInt(getVersion().version);
stream.writeInt(ver.version);
if(tags == null){
getVersion().write(stream);
ver.write(stream);
}else{
getVersion().write(stream, tags);
ver.write(stream, tags);
}
Events.fire(new SaveWriteEvent());
}catch(Throwable e){
throw new RuntimeException(e);
}