From c3047a5df70a74fc83af11aa0839d3c67d2fd48b Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 7 Nov 2017 19:32:24 +1100 Subject: [PATCH] SPIGOT-3629: Greatly expand entity effect API --- .../java/org/bukkit/craftbukkit/entity/CraftEntity.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 700c0072da..8477337b09 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -436,8 +436,13 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return entity; } + @Override public void playEffect(EntityEffect type) { - this.getHandle().world.broadcastEntityEffect(getHandle(), type.getData()); + Preconditions.checkArgument(type != null, "type"); + + if (this.getClass().isAssignableFrom(type.getApplicable())) { + this.getHandle().world.broadcastEntityEffect(getHandle(), type.getData()); + } } public void setHandle(final Entity entity) {