use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class PlayerBreaksBlockScriptEvent method onPlayerBreaksBlock.
@EventHandler
public void onPlayerBreaksBlock(BlockBreakEvent event) {
if (dEntity.isNPC(event.getPlayer())) {
return;
}
material = dMaterial.getMaterialFrom(event.getBlock().getType(), event.getBlock().getData());
location = new dLocation(event.getBlock().getLocation());
cuboids = new dList();
for (dCuboid cuboid : dCuboid.getNotableCuboidsContaining(location)) {
cuboids.add(cuboid.identifySimple());
}
cancelled = event.isCancelled();
xp = new Element(event.getExpToDrop());
this.event = event;
fire();
event.setCancelled(cancelled);
event.setExpToDrop(xp.asInt());
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class PlayerChangesGamemodeScriptEvent method onPlayerChangesGamemode.
@EventHandler
public void onPlayerChangesGamemode(PlayerGameModeChangeEvent event) {
if (dEntity.isNPC(event.getPlayer())) {
return;
}
gamemode = new Element(event.getNewGameMode().name());
cancelled = event.isCancelled();
this.event = event;
fire();
event.setCancelled(cancelled);
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class EntityKilledScriptEvent method onEntityKilled.
@EventHandler
public void onEntityKilled(EntityDamageEvent event) {
entity = new dEntity(event.getEntity());
// Check for possibility of death first
if (entity.isValid() && entity.isLivingEntity()) {
if (event.getFinalDamage() < entity.getLivingEntity().getHealth()) {
return;
}
} else {
return;
}
damage = new Element(event.getDamage());
final_damage = new Element(event.getFinalDamage());
cause = new Element(CoreUtilities.toLowerCase(event.getCause().name()));
damager = null;
projectile = null;
if (event instanceof EntityDamageByEntityEvent) {
damager = new dEntity(((EntityDamageByEntityEvent) event).getDamager());
if (damager.isProjectile()) {
projectile = damager;
if (damager.hasShooter()) {
damager = damager.getShooter();
}
}
}
cancelled = event.isCancelled();
this.event = event;
fire();
event.setCancelled(cancelled);
event.setDamage(damage.asDouble());
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class EntityUnleashedScriptEvent method onEntityUnleashed.
@EventHandler
public void onEntityUnleashed(EntityUnleashEvent event) {
entity = new dEntity(event.getEntity());
reason = new Element(event.getReason().toString());
this.event = event;
fire();
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class HangingBreaksScriptEvent method onHangingBreaks.
@EventHandler
public void onHangingBreaks(HangingBreakEvent event) {
hanging = new dEntity(event.getEntity());
cause = new Element(event.getCause().name());
location = new dLocation(hanging.getLocation());
if (event instanceof HangingBreakByEntityEvent) {
entity = new dEntity(((HangingBreakByEntityEvent) event).getRemover());
}
cuboids = new dList();
for (dCuboid cuboid : dCuboid.getNotableCuboidsContaining(location)) {
cuboids.add(cuboid.identifySimple());
}
cancelled = event.isCancelled();
this.event = event;
fire();
event.setCancelled(cancelled);
}
Aggregations