From d2e261a2758c061e445b1d323deb60ebefebc2e2 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Wed, 10 Apr 2013 09:44:15 +0200 Subject: [PATCH] Get rid of old CB refference trick to get creature type. --- .../listeners/FactionsEntityListener.java | 5 +++-- src/com/massivecraft/factions/util/MiscUtil.java | 16 ---------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index 4fcfe011..0ee5a930 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -48,7 +48,6 @@ import com.massivecraft.factions.Faction; import com.massivecraft.factions.Factions; import com.massivecraft.factions.Rel; import com.massivecraft.factions.event.PowerLossEvent; -import com.massivecraft.factions.util.MiscUtil; public class FactionsEntityListener implements Listener @@ -375,7 +374,9 @@ public class FactionsEntityListener implements Listener if (target == null) return; // We are interested in blocking targeting for certain mobs: - if ( ! ConfServer.monsters.contains(MiscUtil.creatureTypeFromEntity(event.getEntity()))) return; + + + if ( ! ConfServer.monsters.contains(event.getEntity().getType())) return; FLocation floc = new FLocation(target.getLocation()); Faction faction = Board.getFactionAt(floc); diff --git a/src/com/massivecraft/factions/util/MiscUtil.java b/src/com/massivecraft/factions/util/MiscUtil.java index 32067ae8..a144619f 100644 --- a/src/com/massivecraft/factions/util/MiscUtil.java +++ b/src/com/massivecraft/factions/util/MiscUtil.java @@ -4,25 +4,9 @@ import java.util.Arrays; import java.util.HashSet; import org.bukkit.ChatColor; -import org.bukkit.entity.Creature; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Entity; public class MiscUtil { - public static EntityType creatureTypeFromEntity(Entity entity) - { - if ( ! (entity instanceof Creature)) - { - return null; - } - - String name = entity.getClass().getSimpleName(); - name = name.substring(5); // Remove "Craft" - - return EntityType.fromName(name); - } - // Inclusive range public static long[] range(long start, long end) { long[] values = new long[(int) Math.abs(end - start) + 1];