Skip to content

Commit

Permalink
missing as_x tags
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 20, 2021
1 parent 3c5a41a commit 9535900
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 14 deletions.
Expand Up @@ -67,6 +67,18 @@ public static String replaceEssentialsHexColors(char prefix, String input) {

public static void registerTags() {

// <--[tag]
// @attribute <ElementTag.as_biome>
// @returns BiomeTag
// @group conversion
// @description
// Returns the element as a BiomeTag. Note: the value must be a valid biome.
// -->
PropertyParser.<BukkitElementProperties, BiomeTag>registerTag(BiomeTag.class, "as_biome", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), BiomeTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "BiomeTag", attribute.hasAlternative());
});

// <--[tag]
// @attribute <ElementTag.as_chunk>
// @returns ChunkTag
Expand Down Expand Up @@ -103,6 +115,30 @@ public static void registerTags() {
new BukkitTagContext(attribute.getScriptEntry())), "CuboidTag", attribute.hasAlternative());
}, "ascuboid");

// <--[tag]
// @attribute <ElementTag.as_ellipsoid>
// @returns EllipsoidTag
// @group conversion
// @description
// Returns the element as an EllipsoidTag. Note: the value must be a valid ellipsoid.
// -->
PropertyParser.<BukkitElementProperties, EllipsoidTag>registerTag(EllipsoidTag.class, "as_ellipsoid", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), EllipsoidTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "EllipsoidTag", attribute.hasAlternative());
});

// <--[tag]
// @attribute <ElementTag.as_enchantment>
// @returns EnchantmentTag
// @group conversion
// @description
// Returns the element as an EnchantmentTag. Note: the value must be a valid enchantment.
// -->
PropertyParser.<BukkitElementProperties, EnchantmentTag>registerTag(EnchantmentTag.class, "as_enchantment", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), EnchantmentTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "EnchantmentTag", attribute.hasAlternative());
});

// <--[tag]
// @attribute <ElementTag.as_entity>
// @returns EntityTag
Expand Down Expand Up @@ -187,18 +223,6 @@ public static void registerTags() {
new BukkitTagContext(attribute.getScriptEntry())), "PlayerTag", attribute.hasAlternative());
}, "asplayer");

// <--[tag]
// @attribute <ElementTag.as_world>
// @returns WorldTag
// @group conversion
// @description
// Returns the element as a world.
// -->
PropertyParser.<BukkitElementProperties>registerTag("as_world", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), WorldTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "WorldTag", attribute.hasAlternative());
}, "asworld");

// <--[tag]
// @attribute <ElementTag.as_plugin>
// @returns PluginTag
Expand All @@ -211,6 +235,42 @@ public static void registerTags() {
new BukkitTagContext(attribute.getScriptEntry())), "PluginTag", attribute.hasAlternative());
}, "asplugin");

// <--[tag]
// @attribute <ElementTag.as_polygon>
// @returns PolygonTag
// @group conversion
// @description
// Returns the element as a PolygonTag. Note: the value must be a valid polygon.
// -->
PropertyParser.<BukkitElementProperties, PolygonTag>registerTag(PolygonTag.class, "as_polygon", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), PolygonTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "PolygonTag", attribute.hasAlternative());
});

// <--[tag]
// @attribute <ElementTag.as_trade>
// @returns TradeTag
// @group conversion
// @description
// Returns the element as a TradeTag. Note: the value must be a valid trade.
// -->
PropertyParser.<BukkitElementProperties, TradeTag>registerTag(TradeTag.class, "as_trade", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), TradeTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "TradeTag", attribute.hasAlternative());
});

// <--[tag]
// @attribute <ElementTag.as_world>
// @returns WorldTag
// @group conversion
// @description
// Returns the element as a world. Note: the value must be a valid world.
// -->
PropertyParser.<BukkitElementProperties, WorldTag>registerTag(WorldTag.class, "as_world", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), WorldTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "WorldTag", attribute.hasAlternative());
}, "asworld");

// <--[tag]
// @attribute <ElementTag.format[<script>]>
// @returns ElementTag
Expand Down
Expand Up @@ -2380,9 +2380,10 @@ public static void adjustServer(Mechanism mechanism) {
// @name reset_event_stats
// @input None
// @description
// Resets the statistics on events for the queue.stats tag.
// Resets the statistics on events used for <@link tag util.event_stats>
// @tags
// <queue.stats>
// <util.event_stats>
// <util.event_stats_data>
// -->
if (mechanism.matches("reset_event_stats")) {
for (ScriptEvent se : ScriptEvent.events) {
Expand Down

0 comments on commit 9535900

Please sign in to comment.