use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class ItemAttributeNBT method adjust.
@Override
public void adjust(Mechanism mechanism) {
// -->
if (mechanism.matches("nbt_attributes")) {
dList list = mechanism.getValue().asType(dList.class);
ItemStack itemStack = item.getItemStack();
for (String string : list) {
String[] split = string.split("/");
String attribute = EscapeTags.unEscape(split[0]);
String slot = EscapeTags.unEscape(split[1]);
int op = new Element(split[2]).asInt();
double amt = new Element(split[3]).asDouble();
itemStack = CustomNBT.addAttribute(itemStack, attribute, slot, op, amt);
}
item.setItemStack(itemStack);
}
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class EntityBoundingBox method adjust.
@Override
public void adjust(Mechanism mechanism) {
Element value = mechanism.getValue();
if (mechanism.matches("bounding_box")) {
if (entity.isCitizensNPC()) {
// TODO: Allow editing NPC boxes properly?
return;
}
List<dLocation> locations = value.asType(dList.class).filter(dLocation.class);
if (locations.size() == 2) {
BoundingBox boundingBox = new BoundingBox(locations.get(0).toVector(), locations.get(1).toVector());
NMSHandler.getInstance().getEntityHelper().setBoundingBox(entity.getBukkitEntity(), boundingBox);
modifiedBoxes.add(entity.getUUID());
} else {
dB.echoError("Must specify exactly 2 dLocations in the format '<low>|<high>'!");
}
}
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class HorseJumpsScriptEvent method onHorseJumps.
@EventHandler
public void onHorseJumps(HorseJumpEvent event) {
if (event.getEntity() instanceof Horse) {
entity = new dEntity(event.getEntity());
color = new Element(((Horse) event.getEntity()).getColor().name());
variant = new Element(event.getEntity().getVariant().name());
power = event.getPower();
cancelled = event.isCancelled();
this.event = event;
fire();
event.setCancelled(cancelled);
event.setPower(power);
}
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class PlayerEquipsArmorScriptEvent method fireUnequipsEvent.
private void fireUnequipsEvent(Player bukkitPlayer, String type, ItemStack oldItem, String reasonString) {
equipType = new Element("unequips");
armorType = new Element(type);
reason = new Element(reasonString);
armor = new dItem(oldItem);
player = dPlayer.mirrorBukkitPlayer(bukkitPlayer);
fire();
}
use of net.aufdemrand.denizencore.objects.Element in project Denizen-For-Bukkit by DenizenScript.
the class PlayerEquipsArmorScriptEvent method fireEquipsEvent.
private void fireEquipsEvent(Player bukkitPlayer, String type, ItemStack newItem, String reasonString) {
equipType = new Element("equips");
armorType = new Element(type);
reason = new Element(reasonString);
armor = new dItem(newItem);
player = dPlayer.mirrorBukkitPlayer(bukkitPlayer);
fire();
}
Aggregations