use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class PlayerItemTakesDamageScriptEvent method onPlayerItemTakesDamage.
@EventHandler
public void onPlayerItemTakesDamage(PlayerItemDamageEvent event) {
if (dEntity.isNPC(event.getPlayer())) {
return;
}
item = new dItem(event.getItem());
damage = new Element(event.getDamage());
location = new dLocation(event.getPlayer().getLocation());
cancelled = event.isCancelled();
this.event = event;
fire();
event.setCancelled(cancelled);
event.setDamage(damage.asInt());
final Player p = event.getPlayer();
if (cancelled) {
Bukkit.getScheduler().scheduleSyncDelayedTask(DenizenAPI.getCurrentInstance(), new Runnable() {
@Override
public void run() {
p.updateInventory();
}
}, 1);
}
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class LingeringPotionSplashScriptEvent method onLingeringPotionSplash.
@EventHandler
public void onLingeringPotionSplash(LingeringPotionSplashEvent event) {
AreaEffectCloud cloud = event.getAreaEffectCloud();
item = new dItem(event.getEntity().getItem());
duration = new Element(cloud.getDuration());
entity = new dEntity(event.getEntity());
location = entity.getLocation();
radius = new Element(cloud.getRadius());
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 PlayerEditsBookScriptEvent method onPlayerEditsBook.
@EventHandler
public void onPlayerEditsBook(PlayerEditBookEvent event) {
player = dPlayer.mirrorBukkitPlayer(event.getPlayer());
signing = new Element(event.isSigning());
bookMeta = event.getNewBookMeta();
pages = new Element(bookMeta.getPageCount());
title = event.isSigning() ? new Element(bookMeta.getTitle()) : null;
book = new dItem(event.getPlayer().getInventory().getItem(event.getSlot()));
cancelled = event.isCancelled();
this.event = event;
fire();
event.setCancelled(cancelled);
event.setNewBookMeta(bookMeta);
event.setSigning(signing.asBoolean());
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class PlayerReceivesMessageScriptEvent method applyDetermination.
@Override
public boolean applyDetermination(ScriptContainer container, String determination) {
String lower = CoreUtilities.toLowerCase(determination);
if (lower.startsWith("message:")) {
message = new Element(determination.substring("message:".length()));
messageModified = true;
return true;
}
if (lower.startsWith("raw_json:")) {
rawJson = new Element(determination.substring("raw_json:".length()));
rawJsonModified = true;
return true;
}
return super.applyDetermination(container, determination);
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class EntityHealsScriptEvent method onEntityHeals.
@EventHandler
public void onEntityHeals(EntityRegainHealthEvent event) {
entity = new dEntity(event.getEntity());
amount = new Element(event.getAmount());
reason = new Element(event.getRegainReason().toString());
cancelled = event.isCancelled();
this.event = event;
fire();
event.setCancelled(cancelled);
event.setAmount(amount.asDouble());
}
Aggregations