From 95a7420d662210a38378c824c7ec1345e80ac506 Mon Sep 17 00:00:00 2001 From: bloodshot Date: Thu, 9 Jan 2020 20:12:58 -0500 Subject: [PATCH] Avoid checking entity spawns during shutdown. For whatever reason, during a shutdown a plugin may have custom data that causes Sponge to trigger spawn events. To avoid issues, we ignore all spawns during shutdown. --- .../java/com/griefdefender/listener/EntityEventHandler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sponge/src/main/java/com/griefdefender/listener/EntityEventHandler.java b/sponge/src/main/java/com/griefdefender/listener/EntityEventHandler.java index 998232c..611b950 100644 --- a/sponge/src/main/java/com/griefdefender/listener/EntityEventHandler.java +++ b/sponge/src/main/java/com/griefdefender/listener/EntityEventHandler.java @@ -91,6 +91,7 @@ import org.spongepowered.api.world.World; import org.spongepowered.api.world.explosion.Explosion; import org.spongepowered.api.world.storage.WorldProperties; +import org.spongepowered.common.SpongeImpl; import java.time.Instant; import java.util.Iterator; @@ -274,6 +275,11 @@ public void onEntityConstruct(ConstructEntityEvent.Pre event, @Root Object sourc @Listener(order = Order.FIRST, beforeModifications = true) public void onEntitySpawn(SpawnEntityEvent event) { + // For whatever reason, some custom data seems to be triggering spawn events during shutdown + if (!SpongeImpl.getServer().isServerRunning()) { + return; + } + Object source = event.getSource(); if (source instanceof ConsoleSource || !GDFlags.ENTITY_SPAWN || event.getEntities().isEmpty()) { return;