Skip to content

Commit

Permalink
fix as_xx using wrong context reference
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 3, 2022
1 parent 3269453 commit 2d7646d
Showing 1 changed file with 17 additions and 34 deletions.
Expand Up @@ -77,8 +77,7 @@ public static void registerTags() {
// Returns the element as a BiomeTag. Note: the value must be a valid biome.
// -->
PropertyParser.<BukkitElementProperties, BiomeTag>registerStaticTag(BiomeTag.class, "as_biome", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), BiomeTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "BiomeTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), BiomeTag.valueOf(object.asString(), attribute.context), "BiomeTag", attribute.hasAlternative());
});

// <--[tag]
Expand All @@ -89,8 +88,7 @@ public static void registerTags() {
// Returns the element as a chunk. Note: the value must be a valid chunk.
// -->
PropertyParser.<BukkitElementProperties, ChunkTag>registerTag(ChunkTag.class, "as_chunk", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), ChunkTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "ChunkTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), ChunkTag.valueOf(object.asString(), attribute.context), "ChunkTag", attribute.hasAlternative());
}, "aschunk");

// <--[tag]
Expand All @@ -101,8 +99,7 @@ public static void registerTags() {
// Returns the element as a ColorTag. Note: the value must be a valid color.
// -->
PropertyParser.<BukkitElementProperties, ColorTag>registerStaticTag(ColorTag.class, "as_color", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), ColorTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "ColorTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), ColorTag.valueOf(object.asString(), attribute.context), "ColorTag", attribute.hasAlternative());
}, "ascolor");

// <--[tag]
Expand All @@ -113,8 +110,7 @@ public static void registerTags() {
// Returns the element as a cuboid. Note: the value must be a valid cuboid.
// -->
PropertyParser.<BukkitElementProperties, CuboidTag>registerTag(CuboidTag.class, "as_cuboid", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), CuboidTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "CuboidTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), CuboidTag.valueOf(object.asString(), attribute.context), "CuboidTag", attribute.hasAlternative());
}, "ascuboid");

// <--[tag]
Expand All @@ -125,8 +121,7 @@ public static void registerTags() {
// 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());
return ElementTag.handleNull(object.asString(), EllipsoidTag.valueOf(object.asString(), attribute.context), "EllipsoidTag", attribute.hasAlternative());
});

// <--[tag]
Expand All @@ -137,8 +132,7 @@ public static void registerTags() {
// Returns the element as an EnchantmentTag. Note: the value must be a valid enchantment.
// -->
PropertyParser.<BukkitElementProperties, EnchantmentTag>registerStaticTag(EnchantmentTag.class, "as_enchantment", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), EnchantmentTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "EnchantmentTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), EnchantmentTag.valueOf(object.asString(), attribute.context), "EnchantmentTag", attribute.hasAlternative());
});

// <--[tag]
Expand All @@ -149,8 +143,7 @@ public static void registerTags() {
// Returns the element as an entity. Note: the value must be a valid entity.
// -->
PropertyParser.<BukkitElementProperties, EntityTag>registerTag(EntityTag.class, "as_entity", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), EntityTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "EntityTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), EntityTag.valueOf(object.asString(), attribute.context), "EntityTag", attribute.hasAlternative());
}, "asentity");

// <--[tag]
Expand All @@ -161,8 +154,7 @@ public static void registerTags() {
// Returns the element as an inventory. Note: the value must be a valid inventory.
// -->
PropertyParser.<BukkitElementProperties, InventoryTag>registerTag(InventoryTag.class, "as_inventory", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), InventoryTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "InventoryTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), InventoryTag.valueOf(object.asString(), attribute.context), "InventoryTag", attribute.hasAlternative());
}, "asinventory");

// <--[tag]
Expand All @@ -173,8 +165,7 @@ public static void registerTags() {
// Returns the element as an item. Note: the value must be a valid item.
// -->
PropertyParser.<BukkitElementProperties, ItemTag>registerTag(ItemTag.class, "as_item", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), ItemTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "ItemTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), ItemTag.valueOf(object.asString(), attribute.context), "ItemTag", attribute.hasAlternative());
}, "asitem");

// <--[tag]
Expand All @@ -185,8 +176,7 @@ public static void registerTags() {
// Returns the element as a location. Note: the value must be a valid location.
// -->
PropertyParser.<BukkitElementProperties, LocationTag>registerTag(LocationTag.class, "as_location", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), LocationTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "LocationTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), LocationTag.valueOf(object.asString(), attribute.context), "LocationTag", attribute.hasAlternative());
}, "aslocation");

// <--[tag]
Expand All @@ -197,8 +187,7 @@ public static void registerTags() {
// Returns the element as a material. Note: the value must be a valid material.
// -->
PropertyParser.<BukkitElementProperties, MaterialTag>registerStaticTag(MaterialTag.class, "as_material", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), MaterialTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "MaterialTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), MaterialTag.valueOf(object.asString(), attribute.context), "MaterialTag", attribute.hasAlternative());
}, "asmaterial");

// <--[tag]
Expand All @@ -209,8 +198,7 @@ public static void registerTags() {
// Returns the element as an NPC. Note: the value must be a valid NPC.
// -->
PropertyParser.<BukkitElementProperties, NPCTag>registerTag(NPCTag.class, "as_npc", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), NPCTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "NPCTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), NPCTag.valueOf(object.asString(), attribute.context), "NPCTag", attribute.hasAlternative());
}, "asnpc");

// <--[tag]
Expand All @@ -221,8 +209,7 @@ public static void registerTags() {
// Returns the element as a player. Note: the value must be a valid player. Can be online or offline.
// -->
PropertyParser.<BukkitElementProperties, PlayerTag>registerTag(PlayerTag.class, "as_player", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), PlayerTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "PlayerTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), PlayerTag.valueOf(object.asString(), attribute.context), "PlayerTag", attribute.hasAlternative());
}, "asplayer");

// <--[tag]
Expand All @@ -233,8 +220,7 @@ public static void registerTags() {
// Returns the element as a plugin. Note: the value must be a valid plugin.
// -->
PropertyParser.<BukkitElementProperties, PluginTag>registerStaticTag(PluginTag.class, "as_plugin", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), PluginTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "PluginTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), PluginTag.valueOf(object.asString(), attribute.context), "PluginTag", attribute.hasAlternative());
}, "asplugin");

// <--[tag]
Expand All @@ -245,8 +231,7 @@ public static void registerTags() {
// 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());
return ElementTag.handleNull(object.asString(), PolygonTag.valueOf(object.asString(), attribute.context), "PolygonTag", attribute.hasAlternative());
});

// <--[tag]
Expand All @@ -257,8 +242,7 @@ public static void registerTags() {
// Returns the element as a TradeTag. Note: the value must be a valid trade.
// -->
PropertyParser.<BukkitElementProperties, TradeTag>registerStaticTag(TradeTag.class, "as_trade", (attribute, object) -> {
return ElementTag.handleNull(object.asString(), TradeTag.valueOf(object.asString(),
new BukkitTagContext(attribute.getScriptEntry())), "TradeTag", attribute.hasAlternative());
return ElementTag.handleNull(object.asString(), TradeTag.valueOf(object.asString(), attribute.context), "TradeTag", attribute.hasAlternative());
});

// <--[tag]
Expand All @@ -269,8 +253,7 @@ public static void registerTags() {
// 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());
return ElementTag.handleNull(object.asString(), WorldTag.valueOf(object.asString(), attribute.context), "WorldTag", attribute.hasAlternative());
}, "asworld");

// <--[tag]
Expand Down

0 comments on commit 2d7646d

Please sign in to comment.