use of org.bukkit.entity.ArmorStand in project Towny by ElgarL.
the class TownyEntityListener method onEntityDamageByEntityEvent.
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
if (plugin.isError()) {
return;
}
TownyWorld townyWorld = null;
Entity entity = event.getEntity();
if (entity instanceof ArmorStand) {
String damager = event.getDamager().getType().name();
if (damager == "PRIMED_TNT" || damager == "WITHER_SKULL" || damager == "FIREBALL" || damager == "SMALL_FIREBALL" || damager == "LARGE_FIREBALL" || damager == "WITHER") {
try {
townyWorld = TownyUniverse.getDataSource().getWorld(entity.getWorld().getName());
} catch (NotRegisteredException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (!locationCanExplode(townyWorld, entity.getLocation())) {
event.setCancelled(true);
return;
}
}
if (event.getDamager() instanceof Projectile) {
try {
townyWorld = TownyUniverse.getDataSource().getWorld(entity.getWorld().getName());
} catch (NotRegisteredException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Object remover = event.getDamager();
remover = ((Projectile) remover).getShooter();
if (remover instanceof Monster) {
event.setCancelled(true);
} else if (remover instanceof Player) {
Player player = (Player) remover;
// Get destroy permissions (updates if none exist)
boolean bDestroy = PlayerCacheUtil.getCachePermission(player, entity.getLocation(), 416, (byte) 0, TownyPermission.ActionType.DESTROY);
// Allow the removal if we are permitted
if (bDestroy)
return;
/*
* Fetch the players cache
*/
PlayerCache cache = plugin.getCache(player);
event.setCancelled(true);
}
}
}
}
use of org.bukkit.entity.ArmorStand in project Denizen-For-Bukkit by DenizenScript.
the class EntityArmorPose method getPoseList.
private dList getPoseList() {
ArmorStand armorStand = (ArmorStand) entity.getBukkitEntity();
dList list = new dList();
for (PosePart posePart : PosePart.values()) {
list.add(CoreUtilities.toLowerCase(posePart.name()));
list.add(fromEulerAngle(posePart.getAngle(armorStand)).identify());
}
return list;
}
use of org.bukkit.entity.ArmorStand in project Minigames by AddstarMC.
the class RegionDisplayManager method showInfo.
private void showInfo(Region region, MinigamePlayer player) {
activeWatchers.put(region, player);
ArmorStand stand = nameDisplay.get(region);
if (stand == null) {
Location midPoint = region.getFirstPoint().clone().add(region.getSecondPoint()).add(1, 1, 1).multiply(0.5).subtract(0, 1.4, 0);
stand = region.getFirstPoint().getWorld().spawn(midPoint, ArmorStand.class);
stand.setGravity(false);
stand.setSmall(true);
stand.setVisible(false);
stand.setCustomNameVisible(true);
nameDisplay.put(region, stand);
}
StringBuilder info = new StringBuilder();
info.append(ChatColor.BLUE);
info.append("Region: ");
info.append(ChatColor.WHITE);
info.append(region.getName());
info.append("Enabled: " + region.getEnabled());
stand.setCustomName(info.toString());
}
Aggregations