use of com.denizenscript.denizen.objects.MaterialTag in project Denizen-For-Bukkit by DenizenScript.
the class PlayerFillsBucketScriptEvent method onBucketFill.
@EventHandler
public void onBucketFill(PlayerBucketFillEvent event) {
entity = new EntityTag(event.getPlayer());
location = new LocationTag(event.getBlockClicked().getLocation());
item = new ItemTag(event.getItemStack());
material = new MaterialTag(event.getBlockClicked());
this.event = event;
fire(event);
}
use of com.denizenscript.denizen.objects.MaterialTag in project Denizen-For-Bukkit by DenizenScript.
the class VehicleCollidesBlockScriptEvent method onVehicleCollidesBlock.
@EventHandler
public void onVehicleCollidesBlock(VehicleBlockCollisionEvent event) {
vehicle = new EntityTag(event.getVehicle());
location = new LocationTag(event.getBlock().getLocation());
material = new MaterialTag(event.getBlock());
this.event = event;
fire(event);
}
use of com.denizenscript.denizen.objects.MaterialTag in project Denizen-For-Bukkit by DenizenScript.
the class PlayerStandsOnScriptEvent method playerStandsOn.
@EventHandler
public void playerStandsOn(PlayerInteractEvent event) {
if (event.getAction() != Action.PHYSICAL) {
return;
}
material = new MaterialTag(event.getClickedBlock());
location = new LocationTag(event.getClickedBlock().getLocation());
this.event = event;
fire(event);
}
use of com.denizenscript.denizen.objects.MaterialTag in project Denizen-For-Bukkit by DenizenScript.
the class ItemCanDestroy method adjust.
@Override
public void adjust(Mechanism mechanism) {
// -->
if (mechanism.matches("can_destroy")) {
if (item.getMaterial().getMaterial() == Material.AIR) {
mechanism.echoError("Cannot apply NBT to AIR!");
return;
}
ItemStack itemStack = item.getItemStack();
if (mechanism.hasValue()) {
List<Material> materials = mechanism.valueAsType(ListTag.class).filter(MaterialTag.class, mechanism.context).stream().map(MaterialTag::getMaterial).collect(Collectors.toList());
itemStack = CustomNBT.setNBTMaterials(itemStack, CustomNBT.KEY_CAN_DESTROY, materials);
} else {
itemStack = CustomNBT.clearNBT(itemStack, CustomNBT.KEY_CAN_DESTROY);
}
item.setItemStack(itemStack);
}
}
use of com.denizenscript.denizen.objects.MaterialTag in project Denizen-For-Bukkit by DenizenScript.
the class ItemCanPlaceOn method getMaterials.
private ListTag getMaterials() {
ItemStack itemStack = item.getItemStack();
List<Material> materials = CustomNBT.getNBTMaterials(itemStack, CustomNBT.KEY_CAN_PLACE_ON);
if (materials != null && !materials.isEmpty()) {
ListTag list = new ListTag();
for (Material material : materials) {
list.addObject(new MaterialTag(material));
}
return list;
}
return null;
}
Aggregations