Get rid of old CB refference trick to get creature type.
This commit is contained in:
parent
57f5372d43
commit
d2e261a275
@ -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);
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user