Package com.sk89q.worldguard.bukkit.util
Class Entities
java.lang.Object
com.sk89q.worldguard.bukkit.util.Entities
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.sk89q.worldguard.protection.flags.StateFlag
getExplosionFlag
(org.bukkit.entity.Entity entity) Get the explosion flag relevant for an entity type.static org.bukkit.entity.Entity
getShooter
(org.bukkit.entity.Entity entity) Get the underlying shooter of a projectile if one exists.static boolean
isAmbient
(org.bukkit.entity.Entity entity) Test whether an entity is ambient.static boolean
isAoECloud
(org.bukkit.entity.EntityType type) static boolean
isBoat
(org.bukkit.entity.EntityType type) Test whether the given entity type is a Boat type.static boolean
isConsideredBuildingIfUsed
(org.bukkit.entity.Entity entity) Test whether using the given entity should be considered "building" rather than merely using an entity.static boolean
isFireball
(org.bukkit.entity.EntityType type) Return if the given entity type is a fireball (not including wither skulls).static boolean
isHostile
(org.bukkit.entity.Entity entity) Test whether an entity is hostile.static boolean
isMinecart
(org.bukkit.entity.EntityType type) Test whether the given entity type is a Minecart type.static boolean
isNonHostile
(org.bukkit.entity.Entity entity) Test whether an entity is a non-hostile creature.static boolean
isNonPlayerCreature
(org.bukkit.entity.Entity entity) Test whether an entity is a creature (a living thing) that is not a player.static boolean
isNPC
(org.bukkit.entity.Entity entity) Test whether an entity is an NPC.static boolean
isPluginSpawning
(org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) Check whether the spawn reason should be considered as a "plugin spawning".static boolean
isPotionArrow
(org.bukkit.entity.Entity entity) static boolean
isRiddenOnUse
(org.bukkit.entity.Entity entity) Test whether the given entity can be ridden if it is right clicked.static boolean
isTamed
(org.bukkit.entity.Entity entity) Test whether the given entity is tameable and tamed.static boolean
isTNTBased
(org.bukkit.entity.Entity entity) Return if the given entity type is TNT-based.static boolean
isVehicle
(org.bukkit.entity.EntityType type) Test whether the given entity type is a vehicle type.
-
Method Details
-
isTamed
public static boolean isTamed(@Nullable org.bukkit.entity.Entity entity) Test whether the given entity is tameable and tamed.- Parameters:
entity
- the entity, or null- Returns:
- true if tamed
-
isTNTBased
public static boolean isTNTBased(org.bukkit.entity.Entity entity) Return if the given entity type is TNT-based.- Parameters:
entity
- the entity- Returns:
- true if TNT based
-
isFireball
public static boolean isFireball(org.bukkit.entity.EntityType type) Return if the given entity type is a fireball (not including wither skulls).- Parameters:
type
- the type- Returns:
- true if a fireball
-
isRiddenOnUse
public static boolean isRiddenOnUse(org.bukkit.entity.Entity entity) Test whether the given entity can be ridden if it is right clicked.- Parameters:
entity
- the entity- Returns:
- true if the entity can be ridden
-
isVehicle
public static boolean isVehicle(org.bukkit.entity.EntityType type) Test whether the given entity type is a vehicle type.- Parameters:
type
- the type- Returns:
- true if the type is a vehicle type
-
isBoat
public static boolean isBoat(org.bukkit.entity.EntityType type) Test whether the given entity type is a Boat type.- Parameters:
type
- the type- Returns:
- true if the type is a Boat type
-
isMinecart
public static boolean isMinecart(org.bukkit.entity.EntityType type) Test whether the given entity type is a Minecart type.- Parameters:
type
- the type- Returns:
- true if the type is a Minecart type
-
getShooter
public static org.bukkit.entity.Entity getShooter(org.bukkit.entity.Entity entity) Get the underlying shooter of a projectile if one exists.- Parameters:
entity
- the entity- Returns:
- the shooter
-
isHostile
public static boolean isHostile(org.bukkit.entity.Entity entity) Test whether an entity is hostile.- Parameters:
entity
- the entity- Returns:
- true if hostile
-
isNonHostile
public static boolean isNonHostile(org.bukkit.entity.Entity entity) Test whether an entity is a non-hostile creature.- Parameters:
entity
-- Returns:
- true if non-hostile
-
isAmbient
public static boolean isAmbient(org.bukkit.entity.Entity entity) Test whether an entity is ambient.- Parameters:
entity
- the entity- Returns:
- true if ambient
-
isNPC
public static boolean isNPC(org.bukkit.entity.Entity entity) Test whether an entity is an NPC.- Parameters:
entity
- the entity- Returns:
- true if an NPC
-
isNonPlayerCreature
public static boolean isNonPlayerCreature(org.bukkit.entity.Entity entity) Test whether an entity is a creature (a living thing) that is not a player.- Parameters:
entity
- the entity- Returns:
- true if a non-player creature
-
isConsideredBuildingIfUsed
public static boolean isConsideredBuildingIfUsed(org.bukkit.entity.Entity entity) Test whether using the given entity should be considered "building" rather than merely using an entity.- Parameters:
entity
- the entity- Returns:
- true if considered building
-
isPotionArrow
public static boolean isPotionArrow(org.bukkit.entity.Entity entity) -
isAoECloud
public static boolean isAoECloud(org.bukkit.entity.EntityType type) -
isPluginSpawning
public static boolean isPluginSpawning(org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) Check whether the spawn reason should be considered as a "plugin spawning". This is true for custom creations or the summon command.- Parameters:
spawnReason
- the reason- Returns:
- true if considered plugin spawning
-
getExplosionFlag
@Nonnull public static com.sk89q.worldguard.protection.flags.StateFlag getExplosionFlag(org.bukkit.entity.Entity entity) Get the explosion flag relevant for an entity type.- Parameters:
entity
- the entity- Returns:
- the relevant StateFlag or OTHER_EXPLOSION if none is matching
-