diff --git a/src/main/java/cn/nukkit/Server.java b/src/main/java/cn/nukkit/Server.java index 0a726b824c5..6637ae40ba3 100644 --- a/src/main/java/cn/nukkit/Server.java +++ b/src/main/java/cn/nukkit/Server.java @@ -18,6 +18,7 @@ import cn.nukkit.event.server.BatchPacketsEvent; import cn.nukkit.event.server.PlayerDataSerializeEvent; import cn.nukkit.event.server.QueryRegenerateEvent; +import cn.nukkit.event.server.ServerStopEvent; import cn.nukkit.inventory.CraftingManager; import cn.nukkit.inventory.Recipe; import cn.nukkit.item.Item; @@ -813,6 +814,9 @@ public void forceShutdown() { this.hasStopped = true; + ServerStopEvent serverStopEvent = new ServerStopEvent(); + getPluginManager().callEvent(serverStopEvent); + if (this.rcon != null) { this.rcon.close(); } diff --git a/src/main/java/cn/nukkit/event/server/ServerStopEvent.java b/src/main/java/cn/nukkit/event/server/ServerStopEvent.java new file mode 100644 index 00000000000..f0938dada84 --- /dev/null +++ b/src/main/java/cn/nukkit/event/server/ServerStopEvent.java @@ -0,0 +1,17 @@ +package cn.nukkit.event.server; + +import cn.nukkit.event.Cancellable; +import cn.nukkit.event.HandlerList; + +/** + * author: NycuRO + * NukkitX Project + */ +public class ServerStopEvent extends ServerEvent { + + private static final HandlerList handlers = new HandlerList(); + + public static HandlerList getHandlers() { + return handlers; + } +}