Use a fixed entity spawn cause of PLUGIN type for creating entities

This commit is contained in:
Wyatt Childers 2016-05-17 00:58:07 -04:00
parent d1e9446d47
commit 03819a2342

View File

@ -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);
}
}