use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class PaperPlayerProperties method adjust.
@Override
public void adjust(Mechanism mechanism) {
// -->
if (mechanism.matches("affects_monster_spawning") && mechanism.requireBoolean()) {
player.getPlayerEntity().setAffectsSpawning(mechanism.getValue().asBoolean());
}
// -->
if (mechanism.matches("firework_boost") && mechanism.requireObject(ItemTag.class)) {
if (!player.getPlayerEntity().isGliding()) {
mechanism.echoError("Player must be gliding to use firework_boost.");
return;
}
ItemTag item = mechanism.valueAsType(ItemTag.class);
if (item.getBukkitMaterial() != Material.FIREWORK_ROCKET) {
mechanism.echoError("Invalid input item: must be a firework rocket.");
return;
}
player.getPlayerEntity().boostElytra(item.getItemStack());
}
}
use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class BlockCooksSmeltsItemScriptEvent method onBlockCooks.
@EventHandler
public void onBlockCooks(BlockCookEvent event) {
block = event.getBlock();
source_item = new ItemTag(event.getSource());
result_item = new ItemTag(event.getResult());
this.event = event;
fire(event);
}
use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class BlockDispensesScriptEvent method applyDetermination.
@Override
public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
if (determinationObj.canBeType(LocationTag.class)) {
LocationTag vel = determinationObj.asType(LocationTag.class, getTagContext(path));
if (vel != null) {
event.setVelocity(vel.toVector());
return true;
}
}
if (determinationObj.canBeType(ItemTag.class)) {
ItemTag it = determinationObj.asType(ItemTag.class, getTagContext(path));
if (it != null) {
item = it;
event.setItem(item.getItemStack());
return true;
}
}
if (ArgumentHelper.matchesDouble(determinationObj.toString())) {
Deprecations.blockDispensesItemDetermination.warn();
event.setVelocity(event.getVelocity().multiply(Double.parseDouble(determinationObj.toString())));
return true;
}
return super.applyDetermination(path, determinationObj);
}
use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class BlockDispensesScriptEvent method onBlockDispenses.
@EventHandler
public void onBlockDispenses(BlockDispenseEvent event) {
location = new LocationTag(event.getBlock().getLocation());
material = new MaterialTag(event.getBlock());
item = new ItemTag(event.getItem());
this.event = event;
fire(event);
}
use of com.denizenscript.denizen.objects.ItemTag in project Denizen-For-Bukkit by DenizenScript.
the class PlayerEquipsArmorScriptEvent method armorChangeEvent.
@EventHandler
public void armorChangeEvent(PlayerArmorChangeEvent event) {
if (EntityTag.isCitizensNPC(event.getPlayer())) {
return;
}
if (simpleComparisonString(event.getOldItem()).equals(simpleComparisonString(event.getNewItem()))) {
return;
}
newItem = new ItemTag(event.getNewItem());
oldItem = new ItemTag(event.getOldItem());
slot = event.getSlotType();
player = new PlayerTag(event.getPlayer());
fire(event);
}
Aggregations