From 6ada8812029b4ac6ca8b113c7a78e408ca1f1028 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 26 Apr 2016 09:35:17 +1000 Subject: [PATCH] SPIGOT-2206: playEffect doesn't accept sub classes of the expected data type By: md_5 --- .../src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 2 +- .../main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 2be8a568d0..04e99b1b39 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -863,7 +863,7 @@ public class CraftWorld implements World { public void playEffect(Location loc, Effect effect, T data, int radius) { if (data != null) { - Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!"); + Validate.isTrue(effect.getData() != null && effect.getData().isAssignableFrom(data.getClass()), "Wrong kind of data for this effect!"); } else { Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index cf307e59c5..681cc9b497 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -322,7 +322,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void playEffect(Location loc, Effect effect, T data) { if (data != null) { - Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!"); + Validate.isTrue(effect.getData() != null && effect.getData().isAssignableFrom(data.getClass()), "Wrong kind of data for this effect!"); } else { Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); }