Search in sources :

Example 1 with Ageable

use of org.bukkit.block.data.Ageable in project Denizen-For-Bukkit by DenizenScript.

the class MaterialAge method registerTags.

public static void registerTags() {
    // <--[tag]
    // @attribute <MaterialTag.maximum_age>
    // @returns ElementTag(Number)
    // @group properties
    // @description
    // Returns the maximum age for an ageable material. This includes plant growth.
    // -->
    PropertyParser.PropertyTagWithReturn<MaterialAge, ElementTag> runnable = (attribute, material) -> {
        return new ElementTag(material.getMax());
    };
    PropertyParser.registerStaticTag(ElementTag.class, "maximum_age", runnable);
    PropertyParser.registerStaticTag(ElementTag.class, "maximum_plant_growth", runnable);
    // <--[tag]
    // @attribute <MaterialTag.age>
    // @returns ElementTag(Number)
    // @mechanism MaterialTag.age
    // @group properties
    // @description
    // Returns the current age for an ageable material. This includes plant growth.
    // -->
    runnable = (attribute, material) -> {
        return new ElementTag(material.getCurrent());
    };
    PropertyParser.registerStaticTag(ElementTag.class, "age", runnable);
    PropertyParser.registerStaticTag(ElementTag.class, "plant_growth", runnable);
}
Also used : Ageable(org.bukkit.block.data.Ageable) Property(com.denizenscript.denizencore.objects.properties.Property) Sapling(org.bukkit.block.data.type.Sapling) TurtleEgg(org.bukkit.block.data.type.TurtleEgg) MaterialTag(com.denizenscript.denizen.objects.MaterialTag) ObjectTag(com.denizenscript.denizencore.objects.ObjectTag) Mechanism(com.denizenscript.denizencore.objects.Mechanism) ElementTag(com.denizenscript.denizencore.objects.core.ElementTag) PropertyParser(com.denizenscript.denizencore.objects.properties.PropertyParser) ElementTag(com.denizenscript.denizencore.objects.core.ElementTag) PropertyParser(com.denizenscript.denizencore.objects.properties.PropertyParser)

Aggregations

MaterialTag (com.denizenscript.denizen.objects.MaterialTag)1 Mechanism (com.denizenscript.denizencore.objects.Mechanism)1 ObjectTag (com.denizenscript.denizencore.objects.ObjectTag)1 ElementTag (com.denizenscript.denizencore.objects.core.ElementTag)1 Property (com.denizenscript.denizencore.objects.properties.Property)1 PropertyParser (com.denizenscript.denizencore.objects.properties.PropertyParser)1 Ageable (org.bukkit.block.data.Ageable)1 Sapling (org.bukkit.block.data.type.Sapling)1 TurtleEgg (org.bukkit.block.data.type.TurtleEgg)1