Skip to content

Commit

Permalink
register static property tags
Browse files Browse the repository at this point in the history
also items can't be static
  • Loading branch information
mcmonkey4eva committed Oct 28, 2021
1 parent 6cfd836 commit 7af1875
Show file tree
Hide file tree
Showing 27 changed files with 72 additions and 73 deletions.
Expand Up @@ -17,7 +17,6 @@
import com.denizenscript.denizencore.tags.Attribute;
import com.denizenscript.denizencore.tags.ObjectTagProcessor;
import com.denizenscript.denizencore.tags.TagContext;
import com.denizenscript.denizencore.tags.TagRunnable;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -93,7 +93,7 @@ public static void registerTags() {
// @description
// Returns the name of the default step of an interact script.
// -->
PropertyParser.<BukkitScriptProperties, ElementTag>registerTag(ElementTag.class, "default_step", (attribute, script) -> {
PropertyParser.<BukkitScriptProperties, ElementTag>registerStaticTag(ElementTag.class, "default_step", (attribute, script) -> {
String step = ((InteractScriptContainer) script.script.getContainer()).getDefaultStepName();
return new ElementTag(step);
});
Expand Down
Expand Up @@ -51,8 +51,8 @@ public static void registerTags() {
PropertyParser.PropertyTagWithReturn<MaterialAge, ElementTag> runnable = (attribute, material) -> {
return new ElementTag(material.getMax());
};
PropertyParser.registerTag(ElementTag.class, "maximum_age", runnable);
PropertyParser.registerTag(ElementTag.class, "maximum_plant_growth", runnable);
PropertyParser.registerStaticTag(ElementTag.class, "maximum_age", runnable);
PropertyParser.registerStaticTag(ElementTag.class, "maximum_plant_growth", runnable);

// <--[tag]
// @attribute <MaterialTag.age>
Expand All @@ -65,8 +65,8 @@ public static void registerTags() {
runnable = (attribute, material) -> {
return new ElementTag(material.getCurrent());
};
PropertyParser.registerTag(ElementTag.class, "age", runnable);
PropertyParser.registerTag(ElementTag.class, "plant_growth", runnable);
PropertyParser.registerStaticTag(ElementTag.class, "age", runnable);
PropertyParser.registerStaticTag(ElementTag.class, "plant_growth", runnable);
}

public TurtleEgg getTurtleEgg() {
Expand Down
Expand Up @@ -60,7 +60,7 @@ public static void registerTags() {
// For piston_heads, output is NORMAL or STICKY.
// For campfires, output is NORMAL or SIGNAL.
// -->
PropertyParser.<MaterialBlockType, ElementTag>registerTag(ElementTag.class, "type", (attribute, material) -> {
PropertyParser.<MaterialBlockType, ElementTag>registerStaticTag(ElementTag.class, "type", (attribute, material) -> {
return new ElementTag(material.getSlab().getType().name());
}, "slab_type");
}
Expand Down
Expand Up @@ -51,7 +51,7 @@ public static void registerTags() {
// @description
// Returns the amount of pickles in a Sea Pickle material, eggs in a Turtle Egg material, or charges in a Respawn Anchor material.
// -->
PropertyParser.<MaterialCount, ElementTag>registerTag(ElementTag.class, "count", (attribute, material) -> {
PropertyParser.<MaterialCount, ElementTag>registerStaticTag(ElementTag.class, "count", (attribute, material) -> {
return new ElementTag(material.getCurrent());
}, "pickle_count");

Expand All @@ -63,7 +63,7 @@ public static void registerTags() {
// @description
// Returns the maximum amount of pickles allowed in a Sea Pickle material, eggs in a Turtle Egg material, or charges in a Respawn Anchor material.
// -->
PropertyParser.<MaterialCount, ElementTag>registerTag(ElementTag.class, "count_max", (attribute, material) -> {
PropertyParser.<MaterialCount, ElementTag>registerStaticTag(ElementTag.class, "count_max", (attribute, material) -> {
return new ElementTag(material.getMax());
}, "pickle_max");

Expand All @@ -75,7 +75,7 @@ public static void registerTags() {
// @description
// Returns the minimum amount of pickles allowed in a Sea Pickle material, eggs in a Turtle Egg material, or charges in a Respawn Anchor material.
// -->
PropertyParser.<MaterialCount, ElementTag>registerTag(ElementTag.class, "count_min", (attribute, material) -> {
PropertyParser.<MaterialCount, ElementTag>registerStaticTag(ElementTag.class, "count_min", (attribute, material) -> {
return new ElementTag(material.getMin());
}, "pickle_min");
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ public static void registerTags() {
// @description
// Returns the current delay of a redstone repeater material.
// -->
PropertyParser.<MaterialDelay, ElementTag>registerTag(ElementTag.class, "delay", (attribute, material) -> {
PropertyParser.<MaterialDelay, ElementTag>registerStaticTag(ElementTag.class, "delay", (attribute, material) -> {
return new ElementTag(material.getCurrent());
});

Expand All @@ -57,7 +57,7 @@ public static void registerTags() {
// @description
// Returns the maximum delay allowed for the redstone repeater material.
// -->
PropertyParser.<MaterialDelay, ElementTag>registerTag(ElementTag.class, "max_delay", (attribute, material) -> {
PropertyParser.<MaterialDelay, ElementTag>registerStaticTag(ElementTag.class, "max_delay", (attribute, material) -> {
return new ElementTag(material.getMax());
});

Expand All @@ -69,7 +69,7 @@ public static void registerTags() {
// @description
// Returns the minimum delay allowed for the redstone repeater material.
// -->
PropertyParser.<MaterialDelay, ElementTag>registerTag(ElementTag.class, "min_delay", (attribute, material) -> {
PropertyParser.<MaterialDelay, ElementTag>registerStaticTag(ElementTag.class, "min_delay", (attribute, material) -> {
return new ElementTag(material.getMin());
});

Expand Down
Expand Up @@ -60,7 +60,7 @@ public static void registerTags() {
// Returns a list of directions that are valid for a directional material.
// See also <@link tag MaterialTag.direction>
// -->
PropertyParser.<MaterialDirectional, ListTag>registerTag(ListTag.class, "valid_directions", (attribute, material) -> {
PropertyParser.<MaterialDirectional, ListTag>registerStaticTag(ListTag.class, "valid_directions", (attribute, material) -> {
ListTag toReturn = new ListTag();
if (material.isOrientable()) {
for (Axis axis : material.getOrientable().getAxes()) {
Expand Down Expand Up @@ -92,7 +92,7 @@ else if (material.isDirectional()) {
// Returns the current facing direction for a directional material (like a door or a bed).
// Output is a direction name like "NORTH", or an axis like "X", or a rail direction like "ASCENDING_NORTH".
// -->
PropertyParser.<MaterialDirectional, ElementTag>registerTag(ElementTag.class, "direction", (attribute, material) -> {
PropertyParser.<MaterialDirectional, ElementTag>registerStaticTag(ElementTag.class, "direction", (attribute, material) -> {
return new ElementTag(material.getDirectionName());
});
}
Expand Down
Expand Up @@ -47,7 +47,7 @@ public static void registerTags() {
// Returns a list of faces that are valid for a material that has multiple faces.
// See also <@link tag MaterialTag.faces>
// -->
PropertyParser.<MaterialFaces, ListTag>registerTag(ListTag.class, "valid_faces", (attribute, material) -> {
PropertyParser.<MaterialFaces, ListTag>registerStaticTag(ListTag.class, "valid_faces", (attribute, material) -> {
ListTag toReturn = new ListTag();
for (BlockFace face : material.getFaces().getAllowedFaces()) {
toReturn.add(face.name());
Expand All @@ -64,7 +64,7 @@ public static void registerTags() {
// Returns a list of the current faces for a material that has multiple faces (like a mushroom block).
// Output is a direction name like "NORTH".
// -->
PropertyParser.<MaterialFaces, ListTag>registerTag(ListTag.class, "faces", (attribute, material) -> {
PropertyParser.<MaterialFaces, ListTag>registerStaticTag(ListTag.class, "faces", (attribute, material) -> {
return material.getFaceList();
});
}
Expand Down
Expand Up @@ -62,7 +62,7 @@ public static void registerTags() {
// Output for beds is "HEAD" or "FOOT".
// Output for chests is "LEFT" or "RIGHT".
// -->
PropertyParser.<MaterialHalf, ElementTag>registerTag(ElementTag.class, "half", (attribute, material) -> {
PropertyParser.<MaterialHalf, ElementTag>registerStaticTag(ElementTag.class, "half", (attribute, material) -> {
String halfName = material.getHalfName();
if (halfName == null) {
return null;
Expand All @@ -78,7 +78,7 @@ public static void registerTags() {
// @description
// Returns a vector location of the other block for a bisected material.
// -->
PropertyParser.<MaterialHalf, LocationTag>registerTag(LocationTag.class, "relative_vector", (attribute, material) -> {
PropertyParser.<MaterialHalf, LocationTag>registerStaticTag(LocationTag.class, "relative_vector", (attribute, material) -> {
Vector vector = material.getRelativeBlockVector();
if (vector == null) {
return null;
Expand Down
Expand Up @@ -57,7 +57,7 @@ public static void registerTags() {
// Returns the list of heights for a wall block, in order North|East|South|West|Vertical.
// For n/e/s/w, can be "tall", "low", or "none". For vertical, can be "tall" or "none".
// -->
PropertyParser.<MaterialHeights, ListTag>registerTag(ListTag.class, "heights", (attribute, material) -> {
PropertyParser.<MaterialHeights, ListTag>registerStaticTag(ListTag.class, "heights", (attribute, material) -> {
return material.getHeightsList();
});
}
Expand Down
Expand Up @@ -46,7 +46,7 @@ public static void registerTags() {
// Returns a door's hinge side.
// Output is LEFT or RIGHT.
// -->
PropertyParser.<MaterialHinge, ElementTag>registerTag(ElementTag.class, "hinge", (attribute, material) -> {
PropertyParser.<MaterialHinge, ElementTag>registerStaticTag(ElementTag.class, "hinge", (attribute, material) -> {
return new ElementTag(material.getDoor().getHinge().name());
});
}
Expand Down
Expand Up @@ -48,7 +48,7 @@ public static void registerTags() {
// see list at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Instrument.html>.
// For the instrument that a material *would* produce if below a noteblock <@link tag MaterialTag.produced_instrument>.
// -->
PropertyParser.<MaterialInstrument, ElementTag>registerTag(ElementTag.class, "instrument", (attribute, material) -> {
PropertyParser.<MaterialInstrument, ElementTag>registerStaticTag(ElementTag.class, "instrument", (attribute, material) -> {
return new ElementTag(material.getNoteBlock().getInstrument().name());
});
}
Expand Down
Expand Up @@ -46,7 +46,7 @@ public static void registerTags() {
// Returns the size of the leaves for this bamboo block.
// Output is SMALL, LARGE, or NONE.
// -->
PropertyParser.<MaterialLeafSize, ElementTag>registerTag(ElementTag.class, "leaf_size", (attribute, material) -> {
PropertyParser.<MaterialLeafSize, ElementTag>registerStaticTag(ElementTag.class, "leaf_size", (attribute, material) -> {
return new ElementTag(material.getBamboo().getLeaves().name());
});
}
Expand Down
Expand Up @@ -52,7 +52,7 @@ public static void registerTags() {
// @description
// Returns the maximum level for a Levelled material (like water, lava, and cauldrons), cake, beehives, and snow.
// -->
PropertyParser.<MaterialLevel, ElementTag>registerTag(ElementTag.class, "maximum_level", (attribute, material) -> {
PropertyParser.<MaterialLevel, ElementTag>registerStaticTag(ElementTag.class, "maximum_level", (attribute, material) -> {
return new ElementTag(material.getMax());
});

Expand All @@ -64,7 +64,7 @@ public static void registerTags() {
// Returns the minimum level for a Levelled material (like water, lava, and cauldrons), cake, beehives, and snow.
// This will return 0 for all valid materials aside from snow.
// -->
PropertyParser.<MaterialLevel, ElementTag>registerTag(ElementTag.class, "minimum_level", (attribute, material) -> {
PropertyParser.<MaterialLevel, ElementTag>registerStaticTag(ElementTag.class, "minimum_level", (attribute, material) -> {
return new ElementTag(material.getMin());
});

Expand All @@ -76,7 +76,7 @@ public static void registerTags() {
// @description
// Returns the current level for a Levelled material (like water, lava, and cauldrons), cake, beehives, and snow.
// -->
PropertyParser.<MaterialLevel, ElementTag>registerTag(ElementTag.class, "level", (attribute, material) -> {
PropertyParser.<MaterialLevel, ElementTag>registerStaticTag(ElementTag.class, "level", (attribute, material) -> {
return new ElementTag(material.getCurrent());
});
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ public static void registerTags() {
// @description
// Returns whether this redstone repeater material is locked.
// -->
PropertyParser.<MaterialLocked, ElementTag>registerTag(ElementTag.class, "is_locked", (attribute, material) -> {
PropertyParser.<MaterialLocked, ElementTag>registerStaticTag(ElementTag.class, "is_locked", (attribute, material) -> {
return new ElementTag(material.isLocked());
});
}
Expand Down
Expand Up @@ -60,7 +60,7 @@ public static void registerTags() {
// For piston_heads, output is NORMAL or SHORT.
// For bubble-columns, output is NORMAL or DRAG.
// -->
PropertyParser.<MaterialMode, ElementTag>registerTag(ElementTag.class, "mode", (attribute, material) -> {
PropertyParser.<MaterialMode, ElementTag>registerStaticTag(ElementTag.class, "mode", (attribute, material) -> {
return new ElementTag(material.getPropertyString());
});
}
Expand Down
Expand Up @@ -46,7 +46,7 @@ public static void registerTags() {
// @description
// Returns the octave of note played from this note block, as 0, 1, or 2.
// -->
PropertyParser.<MaterialNote, ElementTag>registerTag(ElementTag.class, "note_octave", (attribute, material) -> {
PropertyParser.<MaterialNote, ElementTag>registerStaticTag(ElementTag.class, "note_octave", (attribute, material) -> {
return new ElementTag(material.getNoteBlock().getNote().getOctave());
});

Expand All @@ -59,7 +59,7 @@ public static void registerTags() {
// Returns the tone of note played from this note block, as a letter from A to F, sometimes with a # to indicate sharp.
// Like A or A#.
// -->
PropertyParser.<MaterialNote, ElementTag>registerTag(ElementTag.class, "note_tone", (attribute, material) -> {
PropertyParser.<MaterialNote, ElementTag>registerStaticTag(ElementTag.class, "note_tone", (attribute, material) -> {
Note note = material.getNoteBlock().getNote();
return new ElementTag(note.getTone().name() + (note.isSharped() ? "#" : ""));
});
Expand All @@ -72,7 +72,7 @@ public static void registerTags() {
// @description
// Returns the note played from this note block, as an ID number from 0 to 24.
// -->
PropertyParser.<MaterialNote, ElementTag>registerTag(ElementTag.class, "note", (attribute, material) -> {
PropertyParser.<MaterialNote, ElementTag>registerStaticTag(ElementTag.class, "note", (attribute, material) -> {
return new ElementTag(material.getNoteBlock().getNote().getId());
});
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ public static void registerTags() {
// @description
// Returns whether this block will decay from being too far away from a tree.
// -->
PropertyParser.<MaterialPersistent, ElementTag>registerTag(ElementTag.class, "persistent", (attribute, material) -> {
PropertyParser.<MaterialPersistent, ElementTag>registerStaticTag(ElementTag.class, "persistent", (attribute, material) -> {
return new ElementTag(material.getLeaves().isPersistent());
});
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ public static void registerTags() {
// @description
// Returns the redstone power level of an analogue-powerable block.
// -->
PropertyParser.<MaterialPower, ElementTag>registerTag(ElementTag.class, "power", (attribute, material) -> {
PropertyParser.<MaterialPower, ElementTag>registerStaticTag(ElementTag.class, "power", (attribute, material) -> {
return new ElementTag(((AnaloguePowerable) material.material.getModernData()).getPower());
});

Expand All @@ -57,7 +57,7 @@ public static void registerTags() {
// @description
// Returns the maximum redstone power an analogue-powerable block can have.
// -->
PropertyParser.<MaterialPower, ElementTag>registerTag(ElementTag.class, "max_power", (attribute, material) -> {
PropertyParser.<MaterialPower, ElementTag>registerStaticTag(ElementTag.class, "max_power", (attribute, material) -> {
return new ElementTag(((AnaloguePowerable) material.material.getModernData()).getMaximumPower());
});
}
Expand Down
Expand Up @@ -46,7 +46,7 @@ public static void registerTags() {
// Returns the shape of a block.
// For stairs, output is the corner shape as INNER_LEFT, INNER_RIGHT, OUTER_LEFT, OUTER_RIGHT, or STRAIGHT.
// -->
PropertyParser.<MaterialShape, ElementTag>registerTag(ElementTag.class, "shape", (attribute, material) -> {
PropertyParser.<MaterialShape, ElementTag>registerStaticTag(ElementTag.class, "shape", (attribute, material) -> {
return new ElementTag(material.getStairs().getShape().name());
});
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ public static void registerTags() {
// @description
// Returns whether this material is covered in snow or not.
// -->
PropertyParser.<MaterialSnowable, ElementTag>registerTag(ElementTag.class, "snowy", (attribute, material) -> {
PropertyParser.<MaterialSnowable, ElementTag>registerStaticTag(ElementTag.class, "snowy", (attribute, material) -> {
return new ElementTag(material.isSnowy());
});
}
Expand Down
Expand Up @@ -53,7 +53,7 @@ public static void registerTags() {
// Returns the current attach direction for a switch or other attachable material.
// Output is "CEILING", "FLOOR", or "WALL".
// -->
PropertyParser.<MaterialSwitchFace, ElementTag>registerTag(ElementTag.class, "switch_face", (attribute, material) -> {
PropertyParser.<MaterialSwitchFace, ElementTag>registerStaticTag(ElementTag.class, "switch_face", (attribute, material) -> {
if (material.isSwitch()) {
return new ElementTag(material.getSwitch().getFace().name());
}
Expand Down
Expand Up @@ -63,7 +63,7 @@ public static void registerTags() {
// @description
// Returns whether a Powerable material (like pressure plates) an Openable material (like doors), a dispenser, a daylight sensor, a lightable block, or a piston is switched.
// -->
PropertyParser.<MaterialSwitchable, ElementTag>registerTag(ElementTag.class, "switched", (attribute, material) -> {
PropertyParser.<MaterialSwitchable, ElementTag>registerStaticTag(ElementTag.class, "switched", (attribute, material) -> {
return new ElementTag(material.getState());
});
}
Expand Down

0 comments on commit 7af1875

Please sign in to comment.