mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-12 10:44:42 +01:00
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.
This commit is contained in:
parent
a170a5cef0
commit
95a7420d66
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user