From 03819a23426db5296164e0a1524308772c63d981 Mon Sep 17 00:00:00 2001 From: Wyatt Childers Date: Tue, 17 May 2016 00:58:07 -0400 Subject: [PATCH] Use a fixed entity spawn cause of PLUGIN type for creating entities --- .../main/java/com/sk89q/worldedit/sponge/SpongeWorld.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index c6309cb22..33914c626 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -44,6 +44,8 @@ import org.spongepowered.api.data.property.block.SkyLuminanceProperty; import org.spongepowered.api.entity.EntityType; import org.spongepowered.api.entity.EntityTypes; import org.spongepowered.api.event.cause.Cause; +import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; +import org.spongepowered.api.event.cause.entity.spawn.SpawnTypes; import org.spongepowered.api.world.World; import javax.annotation.Nullable; @@ -262,6 +264,8 @@ public abstract class SpongeWorld extends AbstractWorld { protected abstract void applyEntityData(org.spongepowered.api.entity.Entity entity, BaseEntity data); + private static final Cause ENTITY_SPAWN_CAUSE = Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build(); + @Nullable @Override public Entity createEntity(Location location, BaseEntity entity) { @@ -285,7 +289,7 @@ public abstract class SpongeWorld extends AbstractWorld { new Vector3d(dir.getX(), dir.getY(), dir.getZ()) ); - if (world.spawnEntity(newEnt, Cause.source(SpongeWorldEdit.container()).build())) { + if (world.spawnEntity(newEnt, ENTITY_SPAWN_CAUSE)) { return new SpongeEntity(newEnt); } }