Search in sources :

Example 1 with ArmorStandMeta

use of com.destroystokyo.paper.inventory.meta.ArmorStandMeta in project Denizen-For-Bukkit by DenizenScript.

the class ItemArmorStand method getDataMap.

public MapTag getDataMap() {
    ArmorStandMeta meta = (ArmorStandMeta) item.getItemMeta();
    if (meta == null) {
        return null;
    }
    MapTag result = new MapTag();
    result.putObject("base_plate", new ElementTag(!meta.hasNoBasePlate()));
    result.putObject("visible", new ElementTag(!meta.isInvisible()));
    result.putObject("marker", new ElementTag(meta.isMarker()));
    result.putObject("is_small", new ElementTag(meta.isSmall()));
    result.putObject("arms", new ElementTag(meta.shouldShowArms()));
    return result;
}
Also used : ArmorStandMeta(com.destroystokyo.paper.inventory.meta.ArmorStandMeta) ElementTag(com.denizenscript.denizencore.objects.core.ElementTag) MapTag(com.denizenscript.denizencore.objects.core.MapTag)

Example 2 with ArmorStandMeta

use of com.destroystokyo.paper.inventory.meta.ArmorStandMeta in project Denizen-For-Bukkit by DenizenScript.

the class ItemArmorStand method adjust.

@Override
public void adjust(Mechanism mechanism) {
    // -->
    if (mechanism.matches("armor_stand_data") && mechanism.requireObject(MapTag.class)) {
        MapTag map = mechanism.valueAsType(MapTag.class);
        ArmorStandMeta meta = (ArmorStandMeta) item.getItemMeta();
        ObjectTag base_plate = map.getObject("base_plate");
        ObjectTag visible = map.getObject("visible");
        ObjectTag marker = map.getObject("marker");
        ObjectTag is_small = map.getObject("is_small");
        ObjectTag arms = map.getObject("arms");
        if (base_plate != null) {
            meta.setNoBasePlate(!((ElementTag) base_plate).asBoolean());
        }
        if (visible != null) {
            meta.setInvisible(!((ElementTag) visible).asBoolean());
        }
        if (marker != null) {
            meta.setMarker(((ElementTag) marker).asBoolean());
        }
        if (is_small != null) {
            meta.setSmall(((ElementTag) is_small).asBoolean());
        }
        if (arms != null) {
            meta.setShowArms(((ElementTag) arms).asBoolean());
        }
        item.setItemMeta(meta);
    }
}
Also used : ObjectTag(com.denizenscript.denizencore.objects.ObjectTag) ArmorStandMeta(com.destroystokyo.paper.inventory.meta.ArmorStandMeta) ElementTag(com.denizenscript.denizencore.objects.core.ElementTag) MapTag(com.denizenscript.denizencore.objects.core.MapTag)

Aggregations

ElementTag (com.denizenscript.denizencore.objects.core.ElementTag)2 MapTag (com.denizenscript.denizencore.objects.core.MapTag)2 ArmorStandMeta (com.destroystokyo.paper.inventory.meta.ArmorStandMeta)2 ObjectTag (com.denizenscript.denizencore.objects.ObjectTag)1