From 3c6a4a15f4b5430808e89204e533c636e5a7f697 Mon Sep 17 00:00:00 2001 From: Alex 'mcmonkey' Goodwin Date: Thu, 28 Oct 2021 20:21:51 -0700 Subject: [PATCH] name update to match core --- .../objects/AreaContainmentObject.java | 26 +-- .../denizen/objects/BiomeTag.java | 2 +- .../denizen/objects/ChunkTag.java | 18 +- .../denizen/objects/ColorTag.java | 18 +- .../denizen/objects/CuboidTag.java | 82 +++---- .../denizen/objects/EllipsoidTag.java | 16 +- .../denizen/objects/EnchantmentTag.java | 28 +-- .../denizen/objects/EntityTag.java | 48 ++-- .../denizen/objects/InventoryTag.java | 64 +++--- .../denizen/objects/ItemTag.java | 6 +- .../denizen/objects/LocationTag.java | 212 +++++++++--------- .../denizen/objects/MaterialTag.java | 8 +- .../denizenscript/denizen/objects/NPCTag.java | 32 +-- .../denizen/objects/PlayerTag.java | 58 ++--- .../denizen/objects/PolygonTag.java | 24 +- .../denizen/objects/WorldTag.java | 10 +- .../bukkit/BukkitElementProperties.java | 48 ++-- .../bukkit/BukkitScriptProperties.java | 6 +- .../entity/EntityAreaEffectCloud.java | 8 +- .../properties/entity/EntityArmorPose.java | 4 +- .../entity/EntityAttributeBaseValues.java | 16 +- .../properties/entity/EntityHealth.java | 6 +- .../entity/EntityPotionEffects.java | 4 +- .../inventory/InventoryContents.java | 4 +- .../objects/properties/item/ItemBook.java | 8 +- .../objects/properties/item/ItemFlags.java | 2 +- .../objects/properties/item/ItemNBT.java | 6 +- .../objects/properties/item/ItemPotion.java | 2 +- .../commands/world/SchematicCommand.java | 10 +- .../denizen/tags/core/BiomeTagBase.java | 4 +- .../denizen/tags/core/ChunkTagBase.java | 4 +- .../denizen/tags/core/ColorTagBase.java | 4 +- .../denizen/tags/core/CuboidTagBase.java | 4 +- .../denizen/tags/core/CustomColorTagBase.java | 4 +- .../denizen/tags/core/EllipsoidTagBase.java | 4 +- .../denizen/tags/core/EnchantmentTagBase.java | 4 +- .../denizen/tags/core/EntityTagBase.java | 4 +- .../denizen/tags/core/InventoryTagBase.java | 4 +- .../denizen/tags/core/ItemTagBase.java | 4 +- .../denizen/tags/core/LocationTagBase.java | 4 +- .../denizen/tags/core/MaterialTagBase.java | 4 +- .../denizen/tags/core/NPCTagBase.java | 4 +- .../denizen/tags/core/PlayerTagBase.java | 4 +- .../denizen/tags/core/PluginTagBase.java | 4 +- .../denizen/tags/core/PolygonTagBase.java | 4 +- .../denizen/tags/core/ServerTagBase.java | 164 +++++++------- .../denizen/tags/core/TextTagBase.java | 38 ++-- .../denizen/tags/core/TradeTagBase.java | 4 +- .../denizen/tags/core/WorldTagBase.java | 4 +- 49 files changed, 525 insertions(+), 525 deletions(-) diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/AreaContainmentObject.java b/plugin/src/main/java/com/denizenscript/denizen/objects/AreaContainmentObject.java index ebbfa4ea41..b287cf6105 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/AreaContainmentObject.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/AreaContainmentObject.java @@ -139,7 +139,7 @@ static void registerTags(Class type, Objec // Gets a list of all entities currently within the area, with an optional search parameter for the entity. // --> processor.registerTag(ListTag.class, "entities", (attribute, area) -> { - String matcher = attribute.hasContext(1) ? attribute.getContext(1) : null; + String matcher = attribute.hasParam() ? attribute.getParam() : null; ListTag entities = new ListTag(); for (Entity ent : area.getCuboidBoundary().getEntitiesPossiblyWithinForTag()) { if (area.doesContainLocation(ent.getLocation())) { @@ -176,10 +176,10 @@ static void registerTags(Class type, Objec // Returns a boolean indicating whether the specified location is inside this area. // --> processor.registerTag(ElementTag.class, "contains", (attribute, area) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - LocationTag loc = attribute.contextAsType(1, LocationTag.class); + LocationTag loc = attribute.paramAsType(LocationTag.class); if (loc == null) { return null; } @@ -194,10 +194,10 @@ static void registerTags(Class type, Objec // Optionally, specify a material match to only return locations with that block type. // --> processor.registerTag(ListTag.class, "blocks", (attribute, area) -> { - if (attribute.hasContext(1)) { + if (attribute.hasParam()) { NMSHandler.getChunkHelper().changeChunkServerThread(area.getWorld().getWorld()); try { - String matcher = attribute.getContext(1); + String matcher = attribute.getParam(); Predicate predicate = (l) -> BukkitScriptEvent.tryMaterial(l.getBlock().getType(), matcher); return area.getBlocks(predicate); } @@ -218,8 +218,8 @@ static void registerTags(Class type, Objec processor.registerTag(ListTag.class, "spawnable_blocks", (attribute, area) -> { NMSHandler.getChunkHelper().changeChunkServerThread(area.getWorld().getWorld()); try { - if (attribute.hasContext(1)) { - String matcher = attribute.getContext(1); + if (attribute.hasParam()) { + String matcher = attribute.getParam(); Predicate predicate = (l) -> isSpawnable(l) && BukkitScriptEvent.tryMaterial(l.getBlock().getRelative(0, -1, 0).getType(), matcher); return area.getBlocks(predicate); } @@ -238,10 +238,10 @@ static void registerTags(Class type, Objec // Searches the internal flag lists, rather than through all possible blocks. // --> processor.registerTag(ListTag.class, "blocks_flagged", (attribute, area) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return area.getBlocksFlagged(CoreUtilities.toLowerCase(attribute.getContext(1)), attribute); + return area.getBlocksFlagged(CoreUtilities.toLowerCase(attribute.getParam()), attribute); }); // <--[tag] @@ -261,10 +261,10 @@ static void registerTags(Class type, Objec // Returns whether this area is fully inside another cuboid. // --> processor.registerTag(ElementTag.class, "is_within", (attribute, area) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - CuboidTag cub2 = attribute.contextAsType(1, CuboidTag.class); + CuboidTag cub2 = attribute.paramAsType(CuboidTag.class); if (cub2 == null) { return null; } @@ -304,10 +304,10 @@ static void registerTags(Class type, Objec // Returns a copy of the area, with the specified world. // --> processor.registerTag(type, "with_world", (attribute, area) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - WorldTag world = attribute.contextAsType(1, WorldTag.class); + WorldTag world = attribute.paramAsType(WorldTag.class); if (world == null) { return null; } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/BiomeTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/BiomeTag.java index 8c6924f213..e3c1f0af2c 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/BiomeTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/BiomeTag.java @@ -247,7 +247,7 @@ else if (attribute.startsWith("water", 2)) { entityTypes = object.biome.getWaterEntities(); } else { - String type = attribute.hasContext(1) ? CoreUtilities.toLowerCase(attribute.getContext(1)) : "all"; + String type = attribute.hasParam() ? CoreUtilities.toLowerCase(attribute.getParam()) : "all"; switch (type) { case "ambient": entityTypes = object.biome.getAmbientEntities(); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/ChunkTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/ChunkTag.java index 741abc44cd..2ad243fabf 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/ChunkTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/ChunkTag.java @@ -289,11 +289,11 @@ public static void registerTags() { // Returns the chunk with the specified coordinates added to it. // --> tagProcessor.registerTag(ChunkTag.class, "add", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag ChunkTag.add[<#>,<#>] must have a value."); return null; } - List coords = CoreUtilities.split(attribute.getContext(1), ','); + List coords = CoreUtilities.split(attribute.getParam(), ','); if (coords.size() < 2) { attribute.echoError("The tag ChunkTag.add[<#>,<#>] requires two values!"); return null; @@ -316,11 +316,11 @@ public static void registerTags() { // Returns the chunk with the specified coordinates subtracted from it. // --> tagProcessor.registerTag(ChunkTag.class, "sub", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag ChunkTag.add[<#>,<#>] must have a value."); return null; } - List coords = CoreUtilities.split(attribute.getContext(1), ','); + List coords = CoreUtilities.split(attribute.getParam(), ','); if (coords.size() < 2) { attribute.echoError("The tag ChunkTag.sub[<#>,<#>] requires two values!"); return null; @@ -449,7 +449,7 @@ public static void registerTags() { if (chunk == null) { return null; } - ListTag typeFilter = attribute.hasContext(1) ? attribute.contextAsType(1, ListTag.class) : null; + ListTag typeFilter = attribute.hasParam() ? attribute.paramAsType(ListTag.class) : null; try { NMSHandler.getChunkHelper().changeChunkServerThread(object.getBukkitWorld()); for (Entity entity : chunk.getEntities()) { @@ -573,8 +573,8 @@ public static void registerTags() { } int[] heightMap = NMSHandler.getChunkHelper().getHeightMap(chunk); int tolerance = 2; - if (attribute.hasContext(1) && ArgumentHelper.matchesInteger(attribute.getContext(1))) { - tolerance = attribute.getIntContext(1); + if (attribute.hasParam() && ArgumentHelper.matchesInteger(attribute.getParam())) { + tolerance = attribute.getIntParam(); } int x = heightMap[0]; for (int i : heightMap) { @@ -615,7 +615,7 @@ public static void registerTags() { // Searches the internal flag lists, rather than through all possible blocks. // --> tagProcessor.registerTag(ListTag.class, "blocks_flagged", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("ChunkTag.blocks_flagged[...] must have an input value."); return null; } @@ -623,7 +623,7 @@ public static void registerTags() { if (chunk == null) { return null; } - String flagName = CoreUtilities.toLowerCase(attribute.getContext(1)); + String flagName = CoreUtilities.toLowerCase(attribute.getParam()); ListTag blocks = new ListTag(); LocationFlagSearchHelper.getFlaggedLocations(chunk, flagName, (loc) -> { blocks.addObject(new LocationTag(loc)); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/ColorTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/ColorTag.java index c902b0f201..b1aa8a1851 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/ColorTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/ColorTag.java @@ -298,7 +298,7 @@ public static void registerTags() { // Returns a copy of this color object with a different red value (0 to 255). // --> tagProcessor.registerTag(ColorTag.class, "with_red", (attribute, object) -> { - return new ColorTag(object.color.setRed(attribute.getIntContext(1))); + return new ColorTag(object.color.setRed(attribute.getIntParam())); }); // <--[tag] @@ -308,7 +308,7 @@ public static void registerTags() { // Returns a copy of this color object with a different green value (0 to 255). // --> tagProcessor.registerTag(ColorTag.class, "with_green", (attribute, object) -> { - return new ColorTag(object.color.setGreen(attribute.getIntContext(1))); + return new ColorTag(object.color.setGreen(attribute.getIntParam())); }); // <--[tag] @@ -318,7 +318,7 @@ public static void registerTags() { // Returns a copy of this color object with a different blue value (0 to 255). // --> tagProcessor.registerTag(ColorTag.class, "with_blue", (attribute, object) -> { - return new ColorTag(object.color.setBlue(attribute.getIntContext(1))); + return new ColorTag(object.color.setBlue(attribute.getIntParam())); }); // <--[tag] @@ -329,7 +329,7 @@ public static void registerTags() { // --> tagProcessor.registerTag(ColorTag.class, "with_hue", (attribute, object) -> { int[] HSB = object.toHSB(); - HSB[0] = attribute.getIntContext(1); + HSB[0] = attribute.getIntParam(); return fromHSB(HSB); }); @@ -341,7 +341,7 @@ public static void registerTags() { // --> tagProcessor.registerTag(ColorTag.class, "with_saturation", (attribute, object) -> { int[] HSB = object.toHSB(); - HSB[1] = attribute.getIntContext(1); + HSB[1] = attribute.getIntParam(); return fromHSB(HSB); }); @@ -353,7 +353,7 @@ public static void registerTags() { // --> tagProcessor.registerTag(ColorTag.class, "with_brightness", (attribute, object) -> { int[] HSB = object.toHSB(); - HSB[2] = attribute.getIntContext(1); + HSB[2] = attribute.getIntParam(); return fromHSB(HSB); }); @@ -374,16 +374,16 @@ public static void registerTags() { // Returns the color that results if you mix this color with another. // --> tagProcessor.registerTag(ColorTag.class, "mix", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { Debug.echoError("The tag ListTag.insert[...] must have a value."); return null; } - ColorTag mixed_with = attribute.contextAsType(1, ColorTag.class); + ColorTag mixed_with = attribute.paramAsType(ColorTag.class); if (mixed_with != null) { return new ColorTag(object.color.mixColors(mixed_with.getColor())); } else { - Debug.echoError("'" + attribute.getContext(1) + "' is not a valid color!"); + Debug.echoError("'" + attribute.getParam() + "' is not a valid color!"); return null; } }); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/CuboidTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/CuboidTag.java index 52ca756e97..2130b31398 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/CuboidTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/CuboidTag.java @@ -787,11 +787,11 @@ public static void registerTags() { // Returns a list of block locations along the 2D outline of this CuboidTag, at the specified Y level. // --> tagProcessor.registerTag(ListTag.class, "outline_2d", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("CuboidTag.outline_2d[...] tag must have an input."); return null; } - double y = attribute.getDoubleContext(1); + double y = attribute.getDoubleParam(); return cuboid.getOutline2D(y); }); @@ -802,11 +802,11 @@ public static void registerTags() { // Returns whether this cuboid and another intersect. // --> tagProcessor.registerTag(ElementTag.class, "intersects", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.intersects[...] must have a value."); return null; } - CuboidTag cub2 = attribute.contextAsType(1, CuboidTag.class); + CuboidTag cub2 = attribute.paramAsType(CuboidTag.class); if (cub2 != null) { boolean intersects = false; whole_loop: @@ -853,12 +853,12 @@ public static void registerTags() { // Returns a cuboid representing the one component of this cuboid (for cuboids that contain multiple sub-cuboids). // --> tagProcessor.registerTag(CuboidTag.class, "get", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.get[...] must have a value."); return null; } else { - int member = attribute.getIntContext(1); + int member = attribute.getIntParam(); if (member < 1) { member = 1; } @@ -878,12 +878,12 @@ public static void registerTags() { // Returns a modified copy of this cuboid, with the specific sub-cuboid index changed to hold the input cuboid. // --> tagProcessor.registerTag(CuboidTag.class, "set", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.set[...] must have a value."); return null; } else { - CuboidTag subCuboid = attribute.contextAsType(1, CuboidTag.class); + CuboidTag subCuboid = attribute.paramAsType(CuboidTag.class); if (!attribute.startsWith("at", 2)) { attribute.echoError("The tag CuboidTag.set[...] must be followed by an 'at'."); return null; @@ -915,7 +915,7 @@ public static void registerTags() { // Returns a modified copy of this cuboid, with the input cuboid(s) added at the end. // --> tagProcessor.registerTag(CuboidTag.class, "add_member", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.add_member[...] must have a value."); return null; } @@ -943,15 +943,15 @@ public static void registerTags() { if (member > cuboid.pairs.size() + 1) { member = cuboid.pairs.size() + 1; } - if (attribute.getContext(1).startsWith("li@")) { // Old cuboid identity used '|' symbol, so require 'li@' to be a list - for (CuboidTag subCuboid : attribute.contextAsType(1, ListTag.class).filter(CuboidTag.class, attribute.context)) { + if (attribute.getParam().startsWith("li@")) { // Old cuboid identity used '|' symbol, so require 'li@' to be a list + for (CuboidTag subCuboid : attribute.paramAsType(ListTag.class).filter(CuboidTag.class, attribute.context)) { LocationPair pair = subCuboid.pairs.get(0); cuboid.pairs.add(member - 1, new LocationPair(pair.low.clone(), pair.high.clone())); member++; } } else { - CuboidTag subCuboid = attribute.contextAsType(1, CuboidTag.class); + CuboidTag subCuboid = attribute.paramAsType(CuboidTag.class); LocationPair pair = subCuboid.pairs.get(0); cuboid.pairs.add(member - 1, new LocationPair(pair.low.clone(), pair.high.clone())); } @@ -966,12 +966,12 @@ public static void registerTags() { // Returns a modified copy of this cuboid, with member at the input index removed. // --> tagProcessor.registerTag(CuboidTag.class, "remove_member", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.remove_member[...] must have a value."); return null; } cuboid = cuboid.clone(); - int member = attribute.getIntContext(1); + int member = attribute.getIntParam(); if (member < 1) { member = 1; } @@ -990,11 +990,11 @@ public static void registerTags() { // --> tagProcessor.registerTag(LocationTag.class, "center", (attribute, cuboid) -> { LocationPair pair; - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { pair = cuboid.pairs.get(0); } else { - int member = attribute.getIntContext(1); + int member = attribute.getIntParam(); if (member < 1) { member = 1; } @@ -1032,11 +1032,11 @@ public static void registerTags() { // --> tagProcessor.registerTag(LocationTag.class, "size", (attribute, cuboid) -> { LocationPair pair; - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { pair = cuboid.pairs.get(0); } else { - int member = attribute.getIntContext(1); + int member = attribute.getIntParam(); if (member < 1) { member = 1; } @@ -1056,11 +1056,11 @@ public static void registerTags() { // Returns the highest-numbered (maximum) corner location. // --> tagProcessor.registerTag(LocationTag.class, "max", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return cuboid.pairs.get(0).high; } else { - int member = attribute.getIntContext(1); + int member = attribute.getIntParam(); if (member < 1) { member = 1; } @@ -1078,11 +1078,11 @@ public static void registerTags() { // Returns the lowest-numbered (minimum) corner location. // --> tagProcessor.registerTag(LocationTag.class, "min", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return cuboid.pairs.get(0).low; } else { - int member = attribute.getIntContext(1); + int member = attribute.getIntParam(); if (member < 1) { member = 1; } @@ -1101,11 +1101,11 @@ public static void registerTags() { // For example, a cuboid from 5,5,5 to 10,10,10, shifted 100,0,100, would return a cuboid from 105,5,105 to 110,10,110. // --> tagProcessor.registerTag(CuboidTag.class, "shift", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.shift[...] must have a value."); return null; } - LocationTag vector = attribute.contextAsType(1, LocationTag.class); + LocationTag vector = attribute.paramAsType(LocationTag.class); if (vector != null) { return cuboid.shifted(vector); } @@ -1119,15 +1119,15 @@ public static void registerTags() { // Expands the first member of the CuboidTag to contain the given location (or entire cuboid), and returns the expanded cuboid. // --> tagProcessor.registerTag(CuboidTag.class, "include", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.include[...] must have a value."); return null; } - CuboidTag newCuboid = CuboidTag.valueOf(attribute.getContext(1), CoreUtilities.noDebugContext); + CuboidTag newCuboid = CuboidTag.valueOf(attribute.getParam(), CoreUtilities.noDebugContext); if (newCuboid != null) { return cuboid.including(newCuboid.getLow(0)).including(newCuboid.getHigh(0)); } - LocationTag loc = attribute.contextAsType(1, LocationTag.class); + LocationTag loc = attribute.paramAsType(LocationTag.class); if (loc != null) { return cuboid.including(loc); } @@ -1142,11 +1142,11 @@ public static void registerTags() { // --> tagProcessor.registerTag(CuboidTag.class, "include_x", (attribute, cuboid) -> { cuboid = cuboid.clone(); - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.include_x[...] must have a value."); return null; } - double x = attribute.getDoubleContext(1); + double x = attribute.getDoubleParam(); if (x < cuboid.pairs.get(0).low.getX()) { cuboid.pairs.get(0).low = new LocationTag(cuboid.pairs.get(0).low.getWorld(), x, cuboid.pairs.get(0).low.getY(), cuboid.pairs.get(0).low.getZ()); } @@ -1164,11 +1164,11 @@ public static void registerTags() { // --> tagProcessor.registerTag(CuboidTag.class, "include_y", (attribute, cuboid) -> { cuboid = cuboid.clone(); - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.include_y[...] must have a value."); return null; } - double y = attribute.getDoubleContext(1); + double y = attribute.getDoubleParam(); if (y < cuboid.pairs.get(0).low.getY()) { cuboid.pairs.get(0).low = new LocationTag(cuboid.pairs.get(0).low.getWorld(), cuboid.pairs.get(0).low.getX(), y, cuboid.pairs.get(0).low.getZ()); } @@ -1186,11 +1186,11 @@ public static void registerTags() { // --> tagProcessor.registerTag(CuboidTag.class, "include_z", (attribute, cuboid) -> { cuboid = cuboid.clone(); - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.include_z[...] must have a value."); return null; } - double z = attribute.getDoubleContext(1); + double z = attribute.getDoubleParam(); if (z < cuboid.pairs.get(0).low.getZ()) { cuboid.pairs.get(0).low = new LocationTag(cuboid.pairs.get(0).low.getWorld(), cuboid.pairs.get(0).low.getX(), cuboid.pairs.get(0).low.getY(), z); } @@ -1210,11 +1210,11 @@ public static void registerTags() { // Note that this is equivalent to constructing a cuboid with the input value and the original cuboids max value. // --> tagProcessor.registerTag(CuboidTag.class, "with_min", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.with_min[...] must have a value."); return null; } - LocationTag location = attribute.contextAsType(1, LocationTag.class); + LocationTag location = attribute.paramAsType(LocationTag.class); return new CuboidTag(location, cuboid.pairs.get(0).high); }); @@ -1228,11 +1228,11 @@ public static void registerTags() { // Note that this is equivalent to constructing a cuboid with the input value and the original cuboids min value. // --> tagProcessor.registerTag(CuboidTag.class, "with_max", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.with_max[...] must have a value."); return null; } - LocationTag location = attribute.contextAsType(1, LocationTag.class); + LocationTag location = attribute.paramAsType(LocationTag.class); return new CuboidTag(location, cuboid.pairs.get(0).low); }); @@ -1246,17 +1246,17 @@ public static void registerTags() { // Note that you can also specify a single number to expand all coordinates by the same amount (equivalent to specifying a location that is that value on X, Y, and Z). // --> tagProcessor.registerTag(CuboidTag.class, "expand", (attribute, cuboid) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag CuboidTag.expand[...] must have a value."); return null; } Vector expandBy; - if (ArgumentHelper.matchesInteger(attribute.getContext(1))) { - int val = attribute.getIntContext(1); + if (ArgumentHelper.matchesInteger(attribute.getParam())) { + int val = attribute.getIntParam(); expandBy = new Vector(val, val, val); } else { - expandBy = attribute.contextAsType(1, LocationTag.class).toVector(); + expandBy = attribute.paramAsType(LocationTag.class).toVector(); } LocationPair pair = cuboid.pairs.get(0); return new CuboidTag(pair.low.clone().subtract(expandBy), pair.high.clone().add(expandBy)); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/EllipsoidTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/EllipsoidTag.java index 7bd568d4cc..b1292eb23e 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/EllipsoidTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/EllipsoidTag.java @@ -460,11 +460,11 @@ public static void registerTags() { // Returns a copy of this ellipsoid, shifted by the input location. // --> tagProcessor.registerTag(EllipsoidTag.class, "add", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("ellipsoid.add[...] tag must have an input."); return null; } - return new EllipsoidTag(object.center.clone().add(attribute.contextAsType(1, LocationTag.class)), object.size.clone()); + return new EllipsoidTag(object.center.clone().add(attribute.paramAsType(LocationTag.class)), object.size.clone()); }); // <--[tag] @@ -474,11 +474,11 @@ public static void registerTags() { // Returns a copy of this ellipsoid, with the size value adapted to include the specified world location. // --> tagProcessor.registerTag(EllipsoidTag.class, "include", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("ellipsoid.include[...] tag must have an input."); return null; } - LocationTag target = attribute.contextAsType(1, LocationTag.class); + LocationTag target = attribute.paramAsType(LocationTag.class); if (object.contains(target)) { return object; } @@ -524,11 +524,11 @@ else if (projZ >= projX && projZ >= projY) { // Returns a copy of this ellipsoid, set to the specified location. // --> tagProcessor.registerTag(EllipsoidTag.class, "with_location", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("ellipsoid.with_location[...] tag must have an input."); return null; } - return new EllipsoidTag(attribute.contextAsType(1, LocationTag.class), object.size.clone()); + return new EllipsoidTag(attribute.paramAsType(LocationTag.class), object.size.clone()); }); // <--[tag] @@ -538,11 +538,11 @@ else if (projZ >= projX && projZ >= projY) { // Returns a copy of this ellipsoid, set to the specified size. // --> tagProcessor.registerTag(EllipsoidTag.class, "with_size", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("ellipsoid.with_size[...] tag must have an input."); return null; } - return new EllipsoidTag(object.center.clone(), attribute.contextAsType(1, LocationTag.class)); + return new EllipsoidTag(object.center.clone(), attribute.paramAsType(LocationTag.class)); }); // <--[tag] diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/EnchantmentTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/EnchantmentTag.java index 2a65ba266f..f6aec7fe16 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/EnchantmentTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/EnchantmentTag.java @@ -184,10 +184,10 @@ public static void registerTags() { // For vanilla enchantments, uses language translation keys. // --> tagProcessor.registerTag(ElementTag.class, "full_name", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(NMSHandler.enchantmentHelper.getFullName(object.enchantment, attribute.getIntContext(1))); + return new ElementTag(NMSHandler.enchantmentHelper.getFullName(object.enchantment, attribute.getIntParam())); }); // <--[tag] @@ -296,10 +296,10 @@ public static void registerTags() { // Returns whether this enchantment can enchant the given ItemTag (based on material mainly). // --> tagProcessor.registerTag(ElementTag.class, "can_enchant", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(object.enchantment.canEnchantItem(attribute.contextAsType(1, ItemTag.class).getItemStack())); + return new ElementTag(object.enchantment.canEnchantItem(attribute.paramAsType(ItemTag.class).getItemStack())); }); // <--[tag] @@ -309,10 +309,10 @@ public static void registerTags() { // Returns whether this enchantment is compatible with another given enchantment. // --> tagProcessor.registerTag(ElementTag.class, "is_compatible", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(!object.enchantment.conflictsWith(attribute.contextAsType(1, EnchantmentTag.class).enchantment)); + return new ElementTag(!object.enchantment.conflictsWith(attribute.paramAsType(EnchantmentTag.class).enchantment)); }); // <--[tag] @@ -322,10 +322,10 @@ public static void registerTags() { // Returns the minimum cost for this enchantment for the given level. // --> tagProcessor.registerTag(ElementTag.class, "min_cost", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(NMSHandler.enchantmentHelper.getMinCost(object.enchantment, attribute.getIntContext(1))); + return new ElementTag(NMSHandler.enchantmentHelper.getMinCost(object.enchantment, attribute.getIntParam())); }); // <--[tag] @@ -335,10 +335,10 @@ public static void registerTags() { // Returns the maximum cost for this enchantment for the given level. // --> tagProcessor.registerTag(ElementTag.class, "max_cost", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(NMSHandler.enchantmentHelper.getMaxCost(object.enchantment, attribute.getIntContext(1))); + return new ElementTag(NMSHandler.enchantmentHelper.getMaxCost(object.enchantment, attribute.getIntParam())); }); // <--[tag] @@ -350,10 +350,10 @@ public static void registerTags() { // For example, <[my_enchantment].damage_bonus[level=3;type=undead]> // --> tagProcessor.registerTag(ElementTag.class, "damage_bonus", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - MapTag map = attribute.contextAsType(1, MapTag.class); + MapTag map = attribute.paramAsType(MapTag.class); if (map == null) { attribute.echoError("Invalid MapTag input to damage_bonus - not a valid map."); return null; @@ -377,10 +377,10 @@ public static void registerTags() { // For example, <[my_enchantment].damage_protection[level=3;type=undead]> // --> tagProcessor.registerTag(ElementTag.class, "damage_protection", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - MapTag map = attribute.contextAsType(1, MapTag.class); + MapTag map = attribute.paramAsType(MapTag.class); if (map == null) { attribute.echoError("Invalid MapTag input to damage_protection - not a valid map."); return null; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/EntityTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/EntityTag.java index 0a5531deb0..164bfcadb8 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/EntityTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/EntityTag.java @@ -1432,8 +1432,8 @@ else if (mtr.angle == BlockFace.EAST) { // Returns whether the entity can see the specified other entity (has an uninterrupted line-of-sight). // --> registerSpawnedOnlyTag(ElementTag.class, "can_see", (attribute, object) -> { - if (object.isLivingEntity() && attribute.hasContext(1) && EntityTag.matches(attribute.getContext(1))) { - EntityTag toEntity = attribute.contextAsType(1, EntityTag.class); + if (object.isLivingEntity() && attribute.hasParam() && EntityTag.matches(attribute.getParam())) { + EntityTag toEntity = attribute.paramAsType(EntityTag.class); if (toEntity != null && toEntity.isSpawnedOrValidForTag()) { return new ElementTag(object.getLivingEntity().hasLineOfSight(toEntity.getBukkitEntity())); } @@ -1478,7 +1478,7 @@ else if (mtr.angle == BlockFace.EAST) { // This only uses solid blocks, ie it ignores passable blocks like tall-grass. Use <@link tag EntityTag.cursor_on> to include passable blocks. // --> registerSpawnedOnlyTag(LocationTag.class, "cursor_on_solid", (attribute, object) -> { - double range = attribute.getDoubleContext(1); + double range = attribute.getDoubleParam(); if (range <= 0) { range = 200; } @@ -1501,7 +1501,7 @@ else if (mtr.angle == BlockFace.EAST) { // This uses all blocks, ie it includes passable blocks like tall-grass and water. Use <@link tag EntityTag.cursor_on_solid> to include passable blocks. // --> registerSpawnedOnlyTag(LocationTag.class, "cursor_on", (attribute, object) -> { - double range = attribute.getDoubleContext(1); + double range = attribute.getDoubleParam(); if (range <= 0) { range = 200; } @@ -2052,7 +2052,7 @@ else if (object.getBukkitEntity() instanceof ShulkerBullet) { // Optionally, specify a maximum range to find the entity from (defaults to 200). // --> registerSpawnedOnlyTag(EntityFormObject.class, "precise_target", (attribute, object) -> { - int range = attribute.getIntContext(1); + int range = attribute.getIntParam(); if (range < 1) { range = 200; } @@ -2067,7 +2067,7 @@ else if (object.getBukkitEntity() instanceof ShulkerBullet) { // --> if (attribute.startsWith("type", 2) && attribute.hasContext(2)) { attribute.fulfill(1); - String matcher = attribute.getContext(1); + String matcher = attribute.getParam(); requirement = (e) -> !e.equals(object.getBukkitEntity()) && BukkitScriptEvent.tryEntity(new EntityTag(e), matcher); } else { @@ -2088,7 +2088,7 @@ else if (object.getBukkitEntity() instanceof ShulkerBullet) { // Optionally, specify a maximum range to find the target from (defaults to 200). // --> registerSpawnedOnlyTag(LocationTag.class, "precise_target_position", (attribute, object) -> { - int range = attribute.getIntContext(1); + int range = attribute.getIntParam(); if (range < 1) { range = 200; } @@ -2103,7 +2103,7 @@ else if (object.getBukkitEntity() instanceof ShulkerBullet) { // --> if (attribute.startsWith("type", 2) && attribute.hasContext(2)) { attribute.fulfill(1); - String matcher = attribute.getContext(1); + String matcher = attribute.getParam(); requirement = (e) -> !e.equals(object.getBukkitEntity()) && BukkitScriptEvent.tryEntity(new EntityTag(e), matcher); } else { @@ -2405,8 +2405,8 @@ else if (object.getBukkitEntity() instanceof Hanging) { // --> registerSpawnedOnlyTag(ElementTag.class, "weapon_damage", (attribute, object) -> { Entity target = null; - if (attribute.hasContext(1)) { - target = attribute.contextAsType(1, EntityTag.class).getBukkitEntity(); + if (attribute.hasParam()) { + target = attribute.paramAsType(EntityTag.class).getBukkitEntity(); } return new ElementTag(NMSHandler.getEntityHelper().getDamageTo(object.getLivingEntity(), target)); }); @@ -2444,8 +2444,8 @@ else if (object.getBukkitEntity() instanceof Hanging) { if (map == null) { return new ElementTag(false); } - if (attribute.hasContext(1)) { - PlayerTag player = attribute.contextAsType(1, PlayerTag.class); + if (attribute.hasParam()) { + PlayerTag player = attribute.paramAsType(PlayerTag.class); if (player == null) { attribute.echoError("Invalid player for is_disguised tag."); return null; @@ -2471,8 +2471,8 @@ else if (object.getBukkitEntity() instanceof Hanging) { return null; } DisguiseCommand.TrackedDisguise disguise; - if (attribute.hasContext(1)) { - PlayerTag player = attribute.contextAsType(1, PlayerTag.class); + if (attribute.hasParam()) { + PlayerTag player = attribute.paramAsType(PlayerTag.class); if (player == null) { attribute.echoError("Invalid player for is_disguised tag."); return null; @@ -2505,8 +2505,8 @@ else if (object.getBukkitEntity() instanceof Hanging) { return null; } DisguiseCommand.TrackedDisguise disguise; - if (attribute.hasContext(1)) { - PlayerTag player = attribute.contextAsType(1, PlayerTag.class); + if (attribute.hasParam()) { + PlayerTag player = attribute.paramAsType(PlayerTag.class); if (player == null) { attribute.echoError("Invalid player for is_disguised tag."); return null; @@ -2547,10 +2547,10 @@ else if (object.getBukkitEntity() instanceof Hanging) { // Returns whether the entity matches some matcher text, using the system behind <@link language Advanced Script Event Matching>. // --> tagProcessor.registerTag(ElementTag.class, "advanced_matches", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(BukkitScriptEvent.tryEntity(object, attribute.getContext(1))); + return new ElementTag(BukkitScriptEvent.tryEntity(object, attribute.getParam())); }); // <--[tag] @@ -2562,13 +2562,13 @@ else if (object.getBukkitEntity() instanceof Hanging) { // For example, has_equipped[diamond_*] will return true if the entity is wearing at least one piece of diamond armor. // --> registerSpawnedOnlyTag(ElementTag.class, "has_equipped", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } if (!object.isLivingEntity()) { return null; } - String matcher = attribute.getContext(1); + String matcher = attribute.getParam(); for (ItemStack item : object.getLivingEntity().getEquipment().getArmorContents()) { if (BukkitScriptEvent.tryItem(new ItemTag(item), matcher)) { return new ElementTag(true); @@ -2707,7 +2707,7 @@ else if (object.getBukkitEntity() instanceof Hanging) { // Optionally, specify a player. If specified, will return entities attached visible to that player. If not specified, returns entities globally attached. // --> registerSpawnedOnlyTag(ListTag.class, "attached_entities", (attribute, object) -> { - PlayerTag player = attribute.hasContext(1) ? attribute.contextAsType(1, PlayerTag.class) : null; + PlayerTag player = attribute.hasParam() ? attribute.paramAsType(PlayerTag.class) : null; EntityAttachmentHelper.EntityAttachedToMap data = EntityAttachmentHelper.toEntityToData.get(object.getUUID()); ListTag result = new ListTag(); if (data == null) { @@ -2729,7 +2729,7 @@ else if (object.getBukkitEntity() instanceof Hanging) { // Optionally, specify a player. If specified, will return entity attachment visible to that player. If not specified, returns any entity global attachment. // --> registerSpawnedOnlyTag(EntityTag.class, "attached_to", (attribute, object) -> { - PlayerTag player = attribute.hasContext(1) ? attribute.contextAsType(1, PlayerTag.class) : null; + PlayerTag player = attribute.hasParam() ? attribute.paramAsType(PlayerTag.class) : null; EntityAttachmentHelper.PlayerAttachMap data = EntityAttachmentHelper.attachedEntityToData.get(object.getUUID()); if (data == null) { return null; @@ -2749,7 +2749,7 @@ else if (object.getBukkitEntity() instanceof Hanging) { // Optionally, specify a player. If specified, will return entity attachment visible to that player. If not specified, returns any entity global attachment. // --> registerSpawnedOnlyTag(LocationTag.class, "attached_offset", (attribute, object) -> { - PlayerTag player = attribute.hasContext(1) ? attribute.contextAsType(1, PlayerTag.class) : null; + PlayerTag player = attribute.hasParam() ? attribute.paramAsType(PlayerTag.class) : null; EntityAttachmentHelper.PlayerAttachMap data = EntityAttachmentHelper.attachedEntityToData.get(object.getUUID()); if (data == null) { return null; @@ -2850,7 +2850,7 @@ public static void registerSpawnedOnlyTag(Class returnT tagProcessor.registerTag(returnType, name, (attribute, object) -> { if (!object.isSpawnedOrValidForTag()) { if (!attribute.hasAlternative()) { - com.denizenscript.denizen.utilities.debugging.Debug.echoError("Entity is not spawned, but tag '" + attribute.getAttributeWithoutContext(1) + "' requires the entity be spawned, for entity: " + object.debuggable()); + com.denizenscript.denizen.utilities.debugging.Debug.echoError("Entity is not spawned, but tag '" + attribute.getAttributeWithoutParam(1) + "' requires the entity be spawned, for entity: " + object.debuggable()); } return null; } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/InventoryTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/InventoryTag.java index 7392a88df5..e3cb7cf9a5 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/InventoryTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/InventoryTag.java @@ -1163,10 +1163,10 @@ public static void registerTags() { // Returns whether the inventory can fit an item. // --> tagProcessor.registerTag(ElementTag.class, "can_fit", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - List items = attribute.contextAsType(1, ListTag.class).filter(ItemTag.class, attribute.context, !attribute.hasAlternative()); + List items = attribute.paramAsType(ListTag.class).filter(ItemTag.class, attribute.context, !attribute.hasAlternative()); if (items == null || items.isEmpty()) { return null; } @@ -1235,10 +1235,10 @@ public static void registerTags() { // Returns a copy of the InventoryTag with items added. // --> tagProcessor.registerTag(InventoryTag.class, "include", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - List items = ListTag.getListFor(attribute.getContextObject(1), attribute.context).filter(ItemTag.class, attribute.context); + List items = ListTag.getListFor(attribute.getParamObject(), attribute.context).filter(ItemTag.class, attribute.context); InventoryTag dummyInv = new InventoryTag(object.inventory.getType(), AdvancedTextImpl.instance.getTitle(object.inventory)); if (object.inventory.getType() == InventoryType.CHEST) { dummyInv.setSize(object.inventory.getSize()); @@ -1279,10 +1279,10 @@ public static void registerTags() { // Returns a copy of the InventoryTag with all matching items excluded. // --> tagProcessor.registerTag(InventoryTag.class, "exclude_item", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String matcher = attribute.getContext(1); + String matcher = attribute.getParam(); InventoryTag dummyInv = new InventoryTag(object.inventory.getType(), AdvancedTextImpl.instance.getTitle(object.inventory)); if (object.inventory.getType() == InventoryType.CHEST) { dummyInv.setSize(object.inventory.getSize()); @@ -1327,10 +1327,10 @@ public static void registerTags() { tagProcessor.registerTag(InventoryTag.class, "exclude", (attribute, object) -> { Deprecations.inventoryNonMatcherTags.warn(attribute.context); - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - List items = ListTag.getListFor(attribute.getContextObject(1), attribute.context).filter(ItemTag.class, attribute.context); + List items = ListTag.getListFor(attribute.getParamObject(), attribute.context).filter(ItemTag.class, attribute.context); InventoryTag dummyInv = new InventoryTag(object.inventory.getType(), AdvancedTextImpl.instance.getTitle(object.inventory)); if (object.inventory.getType() == InventoryType.CHEST) { dummyInv.setSize(object.inventory.getSize()); @@ -1402,11 +1402,11 @@ public static void registerTags() { // Uses the system behind <@link language Advanced Script Event Matching>. // --> tagProcessor.registerTag(ElementTag.class, "contains_item", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } int qty = 1; - String matcher = attribute.getContext(1); + String matcher = attribute.getParam(); // <--[tag] // @attribute ].quantity[<#>]> @@ -1734,10 +1734,10 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( attribute.fulfill(1); return new ElementTag(found_items >= qty); } - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - ListTag list = attribute.contextAsType(1, ListTag.class); + ListTag list = attribute.paramAsType(ListTag.class); if (list.isEmpty()) { return null; } @@ -1765,10 +1765,10 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( tagProcessor.registerTag(ElementTag.class, "contains_any", (attribute, object) -> { Deprecations.inventoryNonMatcherTags.warn(attribute.context); - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - ListTag list = attribute.contextAsType(1, ListTag.class); + ListTag list = attribute.paramAsType(ListTag.class); if (list.isEmpty()) { return null; } @@ -1813,10 +1813,10 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( // Uses the system behind <@link language Advanced Script Event Matching>. // --> tagProcessor.registerTag(ElementTag.class, "find_item", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String matcher = attribute.getContext(1); + String matcher = attribute.getParam(); for (int i = 0; i < object.inventory.getSize(); i++) { ItemStack item = object.inventory.getItem(i); if (item != null) { @@ -1837,11 +1837,11 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( // Uses the system behind <@link language Advanced Script Event Matching>. // --> tagProcessor.registerTag(ListTag.class, "find_all_items", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } ListTag result = new ListTag(); - String matcher = attribute.getContext(1); + String matcher = attribute.getParam(); for (int i = 0; i < object.inventory.getSize(); i++) { ItemStack item = object.inventory.getItem(i); if (item != null) { @@ -1891,10 +1891,10 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( attribute.fulfill(1); return new ElementTag(slot); } - if (!attribute.hasContext(1) || !ItemTag.matches(attribute.getContext(1))) { + if (!attribute.hasParam() || !ItemTag.matches(attribute.getParam())) { return null; } - ItemTag item = attribute.contextAsType(1, ItemTag.class); + ItemTag item = attribute.paramAsType(ItemTag.class); item.setAmount(1); int slot = -1; for (int i = 0; i < object.inventory.getSize(); i++) { @@ -1912,10 +1912,10 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( tagProcessor.registerTag(ElementTag.class, "find_imperfect", (attribute, object) -> { Deprecations.inventoryNonMatcherTags.warn(attribute.context); - if (!attribute.hasContext(1) || !ItemTag.matches(attribute.getContext(1))) { + if (!attribute.hasParam() || !ItemTag.matches(attribute.getParam())) { return null; } - ItemTag item = attribute.contextAsType(1, ItemTag.class); + ItemTag item = attribute.paramAsType(ItemTag.class); item.setAmount(1); int slot = -1; for (int i = 0; i < object.inventory.getSize(); i++) { @@ -1975,7 +1975,7 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( // Uses the system behind <@link language Advanced Script Event Matching>. // --> tagProcessor.registerTag(ElementTag.class, "quantity_item", (attribute, object) -> { - String matcher = attribute.hasContext(1) ? attribute.getContext(1) : null; + String matcher = attribute.hasParam() ? attribute.getParam() : null; int found_items = 0; for (ItemStack item : object.getContents()) { if (item != null) { @@ -2013,9 +2013,9 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( attribute.fulfill(1); return new ElementTag(object.countByMaterial(material.getMaterial())); } - if (attribute.hasContext(1) && ItemTag.matches(attribute.getContext(1))) { + if (attribute.hasParam() && ItemTag.matches(attribute.getParam())) { return new ElementTag(object.count - (attribute.contextAsType(1, ItemTag.class).getItemStack(), false)); + (attribute.paramAsType(ItemTag.class).getItemStack(), false)); } else { return new ElementTag(object.count(null, false)); @@ -2029,8 +2029,8 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( // Returns the number of itemstacks that match an item if one is specified, or the number of all itemstacks if one is not. // --> tagProcessor.registerTag(ElementTag.class, "stacks", (attribute, object) -> { - if (attribute.hasContext(1) && ItemTag.matches(attribute.getContext(1))) { - return new ElementTag(object.count(attribute.contextAsType(1, ItemTag.class).getItemStack(), true)); + if (attribute.hasParam() && ItemTag.matches(attribute.getParam())) { + return new ElementTag(object.count(attribute.paramAsType(ItemTag.class).getItemStack(), true)); } else { return new ElementTag(object.count(null, true)); @@ -2045,10 +2045,10 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( // If more than what slot is specified, returns a ListTag(ItemTag) of the item in each given slot. // --> tagProcessor.registerTag(ObjectTag.class, "slot", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - ListTag slots = ListTag.getListFor(attribute.getContextObject(1), attribute.context); + ListTag slots = ListTag.getListFor(attribute.getParamObject(), attribute.context); if (slots.isEmpty()) { if (!attribute.hasAlternative()) { Debug.echoError("Cannot get a list of zero slots."); @@ -2056,7 +2056,7 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName( return null; } else if (slots.size() == 1) { - int slot = SlotHelper.nameToIndexFor(attribute.getContext(1), object.getInventory().getHolder()); + int slot = SlotHelper.nameToIndexFor(attribute.getParam(), object.getInventory().getHolder()); if (slot < 0) { slot = 0; } @@ -2288,10 +2288,10 @@ else if ((object.inventory instanceof FurnaceInventory)) { // Returns whether the inventory matches some matcher text, using the system behind <@link language Advanced Script Event Matching>. // --> tagProcessor.registerTag(ElementTag.class, "advanced_matches", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(BukkitScriptEvent.tryInventory(object, attribute.getContext(1))); + return new ElementTag(BukkitScriptEvent.tryInventory(object, attribute.getParam())); }); } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/ItemTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/ItemTag.java index 36d5691b6b..4dc9afae97 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/ItemTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/ItemTag.java @@ -656,7 +656,7 @@ public static void registerTags() { // to limit to just recipes of that type. // --> tagProcessor.registerTag(ListTag.class, "recipe_ids", (attribute, object) -> { - String type = attribute.hasContext(1) ? CoreUtilities.toLowerCase(attribute.getContext(1)) : null; + String type = attribute.hasParam() ? CoreUtilities.toLowerCase(attribute.getParam()) : null; ItemScriptContainer container = object.isItemscript() ? ItemScriptHelper.getItemScriptContainer(object.getItemStack()) : null; ListTag list = new ListTag(); for (Recipe recipe : Bukkit.getRecipesFor(object.getItemStack())) { @@ -699,10 +699,10 @@ else if (container != null) { // Returns whether the item matches some matcher text, using the system behind <@link language Advanced Script Event Matching>. // --> tagProcessor.registerTag(ElementTag.class, "advanced_matches", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(BukkitScriptEvent.tryItem(object, attribute.getContext(1))); + return new ElementTag(BukkitScriptEvent.tryItem(object, attribute.getParam())); }); } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java index f2a44b7f06..a8112a7ae2 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java @@ -940,7 +940,7 @@ public static void registerTags() { // This just moves straight along the Y axis, equivalent to <@link tag LocationTag.add> with input 0,1,0 (or the input value instead of '1'). // --> tagProcessor.registerTag(LocationTag.class, "above", (attribute, object) -> { - return new LocationTag(object.clone().add(0, attribute.hasContext(1) ? attribute.getDoubleContext(1) : 1, 0)); + return new LocationTag(object.clone().add(0, attribute.hasParam() ? attribute.getDoubleParam() : 1, 0)); }); // <--[tag] @@ -951,7 +951,7 @@ public static void registerTags() { // This just moves straight along the Y axis, equivalent to <@link tag LocationTag.sub> with input 0,1,0 (or the input value instead of '1'). // --> tagProcessor.registerTag(LocationTag.class, "below", (attribute, object) -> { - return new LocationTag(object.clone().subtract(0, attribute.hasContext(1) ? attribute.getDoubleContext(1) : 1, 0)); + return new LocationTag(object.clone().subtract(0, attribute.hasParam() ? attribute.getDoubleParam() : 1, 0)); }); // <--[tag] @@ -963,7 +963,7 @@ public static void registerTags() { tagProcessor.registerTag(LocationTag.class, "forward_flat", (attribute, object) -> { Location loc = object.clone(); loc.setPitch(0); - Vector vector = loc.getDirection().multiply(attribute.hasContext(1) ? attribute.getDoubleContext(1) : 1); + Vector vector = loc.getDirection().multiply(attribute.hasParam() ? attribute.getDoubleParam() : 1); return new LocationTag(object.clone().add(vector)); }); @@ -977,7 +977,7 @@ public static void registerTags() { tagProcessor.registerTag(LocationTag.class, "backward_flat", (attribute, object) -> { Location loc = object.clone(); loc.setPitch(0); - Vector vector = loc.getDirection().multiply(attribute.hasContext(1) ? attribute.getDoubleContext(1) : 1); + Vector vector = loc.getDirection().multiply(attribute.hasParam() ? attribute.getDoubleParam() : 1); return new LocationTag(object.clone().subtract(vector)); }); @@ -988,7 +988,7 @@ public static void registerTags() { // Returns the location in front of this location based on pitch and yaw. Optionally specify a number of blocks to go forward. // --> tagProcessor.registerTag(LocationTag.class, "forward", (attribute, object) -> { - Vector vector = object.getDirection().multiply(attribute.hasContext(1) ? attribute.getDoubleContext(1) : 1); + Vector vector = object.getDirection().multiply(attribute.hasParam() ? attribute.getDoubleParam() : 1); return new LocationTag(object.clone().add(vector)); }); @@ -1000,7 +1000,7 @@ public static void registerTags() { // This is equivalent to <@link tag LocationTag.forward> in the opposite direction. // --> tagProcessor.registerTag(LocationTag.class, "backward", (attribute, object) -> { - Vector vector = object.getDirection().multiply(attribute.hasContext(1) ? attribute.getDoubleContext(1) : 1); + Vector vector = object.getDirection().multiply(attribute.hasParam() ? attribute.getDoubleParam() : 1); return new LocationTag(object.clone().subtract(vector)); }); @@ -1014,7 +1014,7 @@ public static void registerTags() { tagProcessor.registerTag(LocationTag.class, "left", (attribute, object) -> { Location loc = object.clone(); loc.setPitch(0); - Vector vector = loc.getDirection().rotateAroundY(Math.PI / 2).multiply(attribute.hasContext(1) ? attribute.getDoubleContext(1) : 1); + Vector vector = loc.getDirection().rotateAroundY(Math.PI / 2).multiply(attribute.hasParam() ? attribute.getDoubleParam() : 1); return new LocationTag(object.clone().add(vector)); }); @@ -1028,7 +1028,7 @@ public static void registerTags() { tagProcessor.registerTag(LocationTag.class, "right", (attribute, object) -> { Location loc = object.clone(); loc.setPitch(0); - Vector vector = loc.getDirection().rotateAroundY(Math.PI / 2).multiply(attribute.hasContext(1) ? attribute.getDoubleContext(1) : 1); + Vector vector = loc.getDirection().rotateAroundY(Math.PI / 2).multiply(attribute.hasParam() ? attribute.getDoubleParam() : 1); return new LocationTag(object.clone().subtract(vector)); }); @@ -1043,7 +1043,7 @@ public static void registerTags() { tagProcessor.registerTag(LocationTag.class, "up", (attribute, object) -> { Location loc = object.clone(); loc.setPitch(loc.getPitch() - 90); - Vector vector = loc.getDirection().multiply(attribute.hasContext(1) ? attribute.getDoubleContext(1) : 1); + Vector vector = loc.getDirection().multiply(attribute.hasParam() ? attribute.getDoubleParam() : 1); return new LocationTag(object.clone().add(vector)); }); @@ -1058,7 +1058,7 @@ public static void registerTags() { tagProcessor.registerTag(LocationTag.class, "down", (attribute, object) -> { Location loc = object.clone(); loc.setPitch(loc.getPitch() - 90); - Vector vector = loc.getDirection().multiply(attribute.hasContext(1) ? attribute.getDoubleContext(1) : 1); + Vector vector = loc.getDirection().multiply(attribute.hasParam() ? attribute.getDoubleParam() : 1); return new LocationTag(object.clone().subtract(vector)); }); @@ -1071,10 +1071,10 @@ public static void registerTags() { // To just get the location relative to this without rotation math, use <@link tag LocationTag.add> instead. // --> tagProcessor.registerTag(LocationTag.class, "relative", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - LocationTag offsetLoc = attribute.contextAsType(1, LocationTag.class); + LocationTag offsetLoc = attribute.paramAsType(LocationTag.class); if (offsetLoc == null) { return null; } @@ -1122,17 +1122,17 @@ public static void registerTags() { // For example, for a location at 0,100,0, ".random_offset[1,2,3]" can return any decimal location within the cuboid from -1,98,-3 to 1,102,3. // --> tagProcessor.registerTag(LocationTag.class, "random_offset", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("LocationTag.random_offset[...] must have an input."); return null; } Vector offsetLimit; - if (ArgumentHelper.matchesDouble(attribute.getContext(1))) { - double val = attribute.getDoubleContext(1); + if (ArgumentHelper.matchesDouble(attribute.getParam())) { + double val = attribute.getDoubleParam(); offsetLimit = new Vector(val, val, val); } else { - LocationTag val = attribute.contextAsType(1, LocationTag.class); + LocationTag val = attribute.paramAsType(LocationTag.class); if (val == null) { return null; } @@ -1332,8 +1332,8 @@ public static void registerTags() { // --> tagProcessor.registerTag(ListTag.class, "drops", (attribute, object) -> { ItemStack inputItem = null; - if (attribute.hasContext(1)) { - inputItem = attribute.contextAsType(1, ItemTag.class).getItemStack(); + if (attribute.hasParam()) { + inputItem = attribute.paramAsType(ItemTag.class).getItemStack(); } ListTag list = new ListTag(); for (ItemStack it : object.getDropsForTag(attribute, inputItem)) { @@ -1505,12 +1505,12 @@ public static void registerTags() { // (eg, 0.12345 .round_to[3] returns "0.123"). // --> tagProcessor.registerTag(LocationTag.class, "round_to", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag LocationTag.round_to[...] must have a value."); return null; } LocationTag result = object.clone(); - int ten = (int) Math.pow(10, attribute.getIntContext(1)); + int ten = (int) Math.pow(10, attribute.getIntParam()); result.setX(((double) Math.round(result.getX() * ten)) / ten); result.setY(((double) Math.round(result.getY() * ten)) / ten); result.setZ(((double) Math.round(result.getZ() * ten)) / ten); @@ -1528,12 +1528,12 @@ public static void registerTags() { // (0.12345 .round_to_precision[0.005] returns "0.125"). // --> tagProcessor.registerTag(LocationTag.class, "round_to_precision", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag LocationTag.round_to_precision[...] must have a value."); return null; } LocationTag result = object.clone(); - float precision = (float) attribute.getDoubleContext(1); + float precision = (float) attribute.getDoubleParam(); result.setX(((double) Math.round(result.getX() * precision)) / precision); result.setY(((double) Math.round(result.getY() * precision)) / precision); result.setZ(((double) Math.round(result.getZ() * precision)) / precision); @@ -1588,7 +1588,7 @@ public static void registerTags() { // Optionally, specify a maximum range to find the location from (defaults to 200). // --> tagProcessor.registerTag(LocationTag.class, "precise_impact_normal", (attribute, object) -> { - double range = attribute.getDoubleContext(1); + double range = attribute.getDoubleParam(); if (range <= 0) { range = 200; } @@ -1607,7 +1607,7 @@ public static void registerTags() { // Optionally, specify a maximum range to find the location from (defaults to 200). // --> tagProcessor.registerTag(LocationTag.class, "precise_cursor_on_block", (attribute, object) -> { - double range = attribute.getDoubleContext(1); + double range = attribute.getDoubleParam(); if (range <= 0) { range = 200; } @@ -1626,7 +1626,7 @@ public static void registerTags() { // Optionally, specify a maximum range to find the location from (defaults to 200). // --> tagProcessor.registerTag(LocationTag.class, "precise_cursor_on", (attribute, object) -> { - double range = attribute.getDoubleContext(1); + double range = attribute.getDoubleParam(); if (range <= 0) { range = 200; } @@ -1645,7 +1645,7 @@ public static void registerTags() { // Optionally, specify a maximum range to find the entity from (defaults to 100). // --> tagProcessor.registerTag(EntityTag.class, "precise_target", (attribute, object) -> { - double range = attribute.getDoubleContext(1); + double range = attribute.getDoubleParam(); if (range <= 0) { range = 100; } @@ -1661,7 +1661,7 @@ public static void registerTags() { if (attribute.startsWith("type", 2) && attribute.hasContext(2)) { attribute.fulfill(1); Set types = new HashSet<>(); - for (String str : attribute.contextAsType(1, ListTag.class)) { + for (String str : attribute.paramAsType(ListTag.class)) { types.add(EntityTag.valueOf(str, attribute.context).getBukkitEntityType()); } result = object.getWorld().rayTrace(object, object.getDirection(), range, FluidCollisionMode.NEVER, true, 0, (e) -> types.contains(e.getType())); @@ -1683,7 +1683,7 @@ public static void registerTags() { // Optionally, specify a maximum range to find the entity from (defaults to 100). // --> tagProcessor.registerTag(LocationTag.class, "precise_target_position", (attribute, object) -> { - double range = attribute.getDoubleContext(1); + double range = attribute.getDoubleParam(); if (range <= 0) { range = 100; } @@ -1699,7 +1699,7 @@ public static void registerTags() { if (attribute.startsWith("type", 2) && attribute.hasContext(2)) { attribute.fulfill(1); Set types = new HashSet<>(); - for (String str : attribute.contextAsType(1, ListTag.class)) { + for (String str : attribute.paramAsType(ListTag.class)) { types.add(EntityTag.valueOf(str, attribute.context).getBukkitEntityType()); } result = object.getWorld().rayTrace(object, object.getDirection(), range, FluidCollisionMode.NEVER, true, 0, (e) -> types.contains(e.getType())); @@ -1720,7 +1720,7 @@ public static void registerTags() { // Finds all locations between this location and another, separated by 1 block-width each. // --> tagProcessor.registerTag(ListTag.class, "points_between", (attribute, object) -> { - LocationTag target = attribute.contextAsType(1, LocationTag.class); + LocationTag target = attribute.paramAsType(LocationTag.class); if (target == null) { return null; } @@ -1759,7 +1759,7 @@ public static void registerTags() { // will include 0,1,0 0,2,0 and so on. // --> tagProcessor.registerTag(ListTag.class, "facing_blocks", (attribute, object) -> { - int range = attribute.getIntContext(1); + int range = attribute.getIntParam(); if (range < 1) { range = 100; } @@ -1785,10 +1785,10 @@ public static void registerTags() { // line of sight. // --> tagProcessor.registerTag(ElementTag.class, "line_of_sight", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - LocationTag location = attribute.contextAsType(1, LocationTag.class); + LocationTag location = attribute.paramAsType(LocationTag.class); if (location != null) { try { NMSHandler.getChunkHelper().changeChunkServerThread(object.getWorld()); @@ -1821,10 +1821,10 @@ public static void registerTags() { return new LocationTag(object.getWorld(), object.getDirection()); } // Get the cardinal direction from this location to another - if (attribute.hasContext(1) && LocationTag.matches(attribute.getContext(1))) { + if (attribute.hasParam() && LocationTag.matches(attribute.getParam())) { // Subtract this location's vector from the other location's vector, // not the other way around - LocationTag target = attribute.contextAsType(1, LocationTag.class); + LocationTag target = attribute.paramAsType(LocationTag.class); EntityHelper entityHelper = NMSHandler.getEntityHelper(); // <--[tag] @@ -1859,7 +1859,7 @@ public static void registerTags() { // --> tagProcessor.registerTag(LocationTag.class, "rotate_yaw", (attribute, object) -> { LocationTag loc = LocationTag.valueOf(object.identify(), attribute.context).clone(); - loc.setYaw(loc.getYaw() + (float) attribute.getDoubleContext(1)); + loc.setYaw(loc.getYaw() + (float) attribute.getDoubleParam()); return loc; }); @@ -1871,7 +1871,7 @@ public static void registerTags() { // --> tagProcessor.registerTag(LocationTag.class, "rotate_pitch", (attribute, object) -> { LocationTag loc = LocationTag.valueOf(object.identify(), attribute.context).clone(); - loc.setPitch(Math.max(-90, Math.min(90, loc.getPitch() + (float) attribute.getDoubleContext(1)))); + loc.setPitch(Math.max(-90, Math.min(90, loc.getPitch() + (float) attribute.getDoubleParam()))); return loc; }); @@ -1883,10 +1883,10 @@ public static void registerTags() { // to the target location. // --> tagProcessor.registerTag(LocationTag.class, "face", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - Location two = attribute.contextAsType(1, LocationTag.class); + Location two = attribute.paramAsType(LocationTag.class); return new LocationTag(NMSHandler.getEntityHelper().faceLocation(object, two)); }); @@ -1897,16 +1897,16 @@ public static void registerTags() { // Returns whether the location's yaw is facing another entity or location, within a limit of 45 degrees of yaw. // --> tagProcessor.registerTag(ElementTag.class, "facing", (attribute, object) -> { - if (attribute.hasContext(1)) { + if (attribute.hasParam()) { // The default number of degrees if there is no degrees attribute int degrees = 45; LocationTag facingLoc; - if (LocationTag.matches(attribute.getContext(1))) { - facingLoc = attribute.contextAsType(1, LocationTag.class); + if (LocationTag.matches(attribute.getParam())) { + facingLoc = attribute.paramAsType(LocationTag.class); } - else if (EntityTag.matches(attribute.getContext(1))) { - facingLoc = attribute.contextAsType(1, EntityTag.class).getLocation(); + else if (EntityTag.matches(attribute.getParam())) { + facingLoc = attribute.paramAsType(EntityTag.class).getLocation(); } else { if (!attribute.hasAlternative()) { @@ -1960,7 +1960,7 @@ else if (EntityTag.matches(attribute.getContext(1))) { // Returns the location with pitch and yaw. // --> tagProcessor.registerTag(LocationTag.class, "with_pose", (attribute, object) -> { - String context = attribute.getContext(1); + String context = attribute.getParam(); float pitch = 0f; float yaw = 0f; if (EntityTag.matches(context)) { @@ -2035,10 +2035,10 @@ else if (yaw < 315) { // Generally used in a format like ]>]>. // --> tagProcessor.registerTag(LocationTag.class, "rotate_around_x", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - double angle = attribute.getDoubleContext(1); + double angle = attribute.getDoubleParam(); double cos = Math.cos(angle); double sin = Math.sin(angle); double y = (object.getY() * cos) - (object.getZ() * sin); @@ -2057,10 +2057,10 @@ else if (yaw < 315) { // Generally used in a format like ]>]>. // --> tagProcessor.registerTag(LocationTag.class, "rotate_around_y", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - double angle = attribute.getDoubleContext(1); + double angle = attribute.getDoubleParam(); double cos = Math.cos(angle); double sin = Math.sin(angle); double x = (object.getX() * cos) + (object.getZ() * sin); @@ -2079,10 +2079,10 @@ else if (yaw < 315) { // Generally used in a format like ]>]>. // --> tagProcessor.registerTag(LocationTag.class, "rotate_around_z", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - double angle = attribute.getDoubleContext(1); + double angle = attribute.getDoubleParam(); double cos = Math.cos(angle); double sin = Math.sin(angle); double x = (object.getX() * cos) - (object.getY() * sin); @@ -2111,15 +2111,15 @@ else if (yaw < 315) { // Note that the returned list will not be in any particular order. // --> tagProcessor.registerTag(ListTag.class, "flood_fill", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - AreaContainmentObject area = CuboidTag.valueOf(attribute.getContext(1), CoreUtilities.noDebugContext); + AreaContainmentObject area = CuboidTag.valueOf(attribute.getParam(), CoreUtilities.noDebugContext); if (area == null) { - area = EllipsoidTag.valueOf(attribute.getContext(1), CoreUtilities.noDebugContext); + area = EllipsoidTag.valueOf(attribute.getParam(), CoreUtilities.noDebugContext); } if (area == null) { - double radius = attribute.getDoubleContext(1); + double radius = attribute.getDoubleParam(); if (radius <= 0) { return null; } @@ -2173,10 +2173,10 @@ else if (yaw < 315) { // Warning: may be extremely slow to process. Use with caution. // --> tagProcessor.registerTag(LocationTag.class, "find_nearest_biome", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - BiomeTag biome = attribute.contextAsType(1, BiomeTag.class); + BiomeTag biome = attribute.paramAsType(BiomeTag.class); if (biome == null) { attribute.echoError("Invalid biome input."); return null; @@ -2198,13 +2198,13 @@ else if (yaw < 315) { // Searches the internal flag lists, rather than through all possible blocks. // --> tagProcessor.registerTag(ListTag.class, "find_blocks_flagged", (attribute, object) -> { - if (!attribute.hasContext(1) || !attribute.startsWith("within", 2) || !attribute.hasContext(2)) { + if (!attribute.hasParam() || !attribute.startsWith("within", 2) || !attribute.hasContext(2)) { attribute.echoError("find_blocks_flagged[...].within[...] tag malformed."); return null; } - String flagName = CoreUtilities.toLowerCase(attribute.getContext(1)); + String flagName = CoreUtilities.toLowerCase(attribute.getParam()); attribute.fulfill(1); - double radius = attribute.getDoubleContext(1); + double radius = attribute.getDoubleParam(); if (!object.isChunkLoadedSafe()) { attribute.echoError("LocationTag trying to read block, but cannot because the chunk is unloaded. Use the 'chunkload' command to ensure the chunk is loaded."); return null; @@ -2248,7 +2248,7 @@ else if (yaw < 315) { // Result list is sorted by closeness (1 = closest, 2 = next closest, ... last = farthest). // --> tagProcessor.registerTag(ListTag.class, "find_entities", (attribute, object) -> { - String matcher = attribute.hasContext(1) ? attribute.getContext(1) : null; + String matcher = attribute.hasParam() ? attribute.getParam() : null; if (!attribute.startsWith("within", 2) || !attribute.hasContext(2)) { return null; } @@ -2277,7 +2277,7 @@ else if (yaw < 315) { // Result list is sorted by closeness (1 = closest, 2 = next closest, ... last = farthest). // --> tagProcessor.registerTag(ListTag.class, "find_blocks", (attribute, object) -> { - String matcher = attribute.hasContext(1) ? attribute.getContext(1) : null; + String matcher = attribute.hasParam() ? attribute.getParam() : null; if (!attribute.startsWith("within", 2) || !attribute.hasContext(2)) { return null; } @@ -2569,10 +2569,10 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Uses a max range of 100 blocks from the start. // --> tagProcessor.registerTag(ListTag.class, "find_path", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - LocationTag two = attribute.contextAsType(1, LocationTag.class); + LocationTag two = attribute.paramAsType(LocationTag.class); if (two == null) { return null; } @@ -2696,11 +2696,11 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns a copy of the location with a changed X value. // --> tagProcessor.registerTag(LocationTag.class, "with_x", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } LocationTag output = object.clone(); - output.setX(attribute.getDoubleContext(1)); + output.setX(attribute.getDoubleParam()); return output; }); @@ -2711,11 +2711,11 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns a copy of the location with a changed Y value. // --> tagProcessor.registerTag(LocationTag.class, "with_y", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } LocationTag output = object.clone(); - output.setY(attribute.getDoubleContext(1)); + output.setY(attribute.getDoubleParam()); return output; }); @@ -2726,11 +2726,11 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns a copy of the location with a changed Z value. // --> tagProcessor.registerTag(LocationTag.class, "with_z", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } LocationTag output = object.clone(); - output.setZ(attribute.getDoubleContext(1)); + output.setZ(attribute.getDoubleParam()); return output; }); @@ -2741,11 +2741,11 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns a copy of the location with a changed yaw value. // --> tagProcessor.registerTag(LocationTag.class, "with_yaw", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } LocationTag output = object.clone(); - output.setYaw((float) attribute.getDoubleContext(1)); + output.setYaw((float) attribute.getDoubleParam()); return output; }); @@ -2756,11 +2756,11 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns a copy of the location with a changed pitch value. // --> tagProcessor.registerTag(LocationTag.class, "with_pitch", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } LocationTag output = object.clone(); - output.setPitch((float) attribute.getDoubleContext(1)); + output.setPitch((float) attribute.getDoubleParam()); return output; }); @@ -2771,11 +2771,11 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns a copy of the location with a changed world value. // --> tagProcessor.registerTag(LocationTag.class, "with_world", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } LocationTag output = object.clone(); - WorldTag world = attribute.contextAsType(1, WorldTag.class); + WorldTag world = attribute.paramAsType(WorldTag.class); output.setWorld(world.getWorld()); return output; }); @@ -2805,10 +2805,10 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns the location with the specified coordinates added to it. // --> tagProcessor.registerTag(LocationTag.class, "add", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String[] ints = attribute.getContext(1).replace("l@", "").split(",", 4); // TODO: Just LocationTag.valueOf? + String[] ints = attribute.getParam().replace("l@", "").split(",", 4); // TODO: Just LocationTag.valueOf? if (ints.length >= 3) { if (ArgumentHelper.matchesDouble(ints[0]) && ArgumentHelper.matchesDouble(ints[1]) @@ -2818,8 +2818,8 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext Double.valueOf(ints[2]))); } } - if (LocationTag.matches(attribute.getContext(1))) { - return object.clone().add(attribute.contextAsType(1, LocationTag.class)); + if (LocationTag.matches(attribute.getParam())) { + return object.clone().add(attribute.paramAsType(LocationTag.class)); } return null; }); @@ -2831,10 +2831,10 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns the location with the specified coordinates subtracted from it. // --> tagProcessor.registerTag(LocationTag.class, "sub", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String[] ints = attribute.getContext(1).replace("l@", "").split(",", 4); // TODO: Just LocationTag.valueOf? + String[] ints = attribute.getParam().replace("l@", "").split(",", 4); // TODO: Just LocationTag.valueOf? if (ints.length == 3 || ints.length == 4) { if (ArgumentHelper.matchesDouble(ints[0]) && ArgumentHelper.matchesDouble(ints[1]) @@ -2844,8 +2844,8 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext Double.valueOf(ints[2]))); } } - if (LocationTag.matches(attribute.getContext(1))) { - return new LocationTag(object.clone().subtract(attribute.contextAsType(1, LocationTag.class))); + if (LocationTag.matches(attribute.getParam())) { + return new LocationTag(object.clone().subtract(attribute.paramAsType(LocationTag.class))); } return null; }); @@ -2857,10 +2857,10 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns the location multiplied by the specified length. // --> tagProcessor.registerTag(LocationTag.class, "mul", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new LocationTag(object.clone().multiply(Double.parseDouble(attribute.getContext(1)))); + return new LocationTag(object.clone().multiply(Double.parseDouble(attribute.getParam()))); }); // <--[tag] @@ -2870,10 +2870,10 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns the location divided by the specified length. // --> tagProcessor.registerTag(LocationTag.class, "div", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new LocationTag(object.clone().multiply(1D / Double.parseDouble(attribute.getContext(1)))); + return new LocationTag(object.clone().multiply(1D / Double.parseDouble(attribute.getParam()))); }); // <--[tag] @@ -2925,11 +2925,11 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns the distance between 2 locations, squared. // --> tagProcessor.registerTag(ElementTag.class, "distance_squared", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - if (LocationTag.matches(attribute.getContext(1))) { - LocationTag toLocation = attribute.contextAsType(1, LocationTag.class); + if (LocationTag.matches(attribute.getParam())) { + LocationTag toLocation = attribute.paramAsType(LocationTag.class); if (!object.getWorldName().equalsIgnoreCase(toLocation.getWorldName())) { if (!attribute.hasAlternative()) { Debug.echoError("Can't measure distance between two different worlds!"); @@ -2948,11 +2948,11 @@ else if (attribute.startsWith("unexplored_structure", 2) && attribute.hasContext // Returns the distance between 2 locations. // --> tagProcessor.registerTag(ElementTag.class, "distance", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - if (LocationTag.matches(attribute.getContext(1))) { - LocationTag toLocation = attribute.contextAsType(1, LocationTag.class); + if (LocationTag.matches(attribute.getParam())) { + LocationTag toLocation = attribute.paramAsType(LocationTag.class); // <--[tag] // @attribute ].horizontal> @@ -3034,23 +3034,23 @@ else if (attribute.startsWith("vertical", 2)) { // Returns whether the location is within the specified area (cuboid, ellipsoid, polygon, ...). // --> tagProcessor.registerTag(ElementTag.class, "is_within", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - if (EllipsoidTag.matches(attribute.getContext(1))) { - EllipsoidTag ellipsoid = attribute.contextAsType(1, EllipsoidTag.class); + if (EllipsoidTag.matches(attribute.getParam())) { + EllipsoidTag ellipsoid = attribute.paramAsType(EllipsoidTag.class); if (ellipsoid != null) { return new ElementTag(ellipsoid.contains(object)); } } - else if (PolygonTag.matches(attribute.getContext(1))) { - PolygonTag polygon = attribute.contextAsType(1, PolygonTag.class); + else if (PolygonTag.matches(attribute.getParam())) { + PolygonTag polygon = attribute.paramAsType(PolygonTag.class); if (polygon != null) { return new ElementTag(polygon.doesContainLocation(object)); } } else { - CuboidTag cuboid = attribute.contextAsType(1, CuboidTag.class); + CuboidTag cuboid = attribute.paramAsType(CuboidTag.class); if (cuboid != null) { return new ElementTag(cuboid.isInsideCuboid(object)); } @@ -3066,11 +3066,11 @@ else if (PolygonTag.matches(attribute.getContext(1))) { // Size input is a vector of x,y,z size. // --> tagProcessor.registerTag(EllipsoidTag.class, "to_ellipsoid", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("to_ellipsoid[...] tag must have input."); return null; } - return new EllipsoidTag(object.clone(), attribute.getContextObject(1).asType(LocationTag.class, attribute.context)); + return new EllipsoidTag(object.clone(), attribute.getParamObject().asType(LocationTag.class, attribute.context)); }); // <--[tag] @@ -3080,11 +3080,11 @@ else if (PolygonTag.matches(attribute.getContext(1))) { // Returns a cuboid from this location to the specified location. // --> tagProcessor.registerTag(CuboidTag.class, "to_cuboid", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("to_cuboid[...] tag must have input."); return null; } - return new CuboidTag(object.clone(), attribute.getContextObject(1).asType(LocationTag.class, attribute.context)); + return new CuboidTag(object.clone(), attribute.getParamObject().asType(LocationTag.class, attribute.context)); }); ///////////////////// @@ -3614,10 +3614,10 @@ else if (material.hasModernData() && material.getModernData() instanceof org.buk // Invalid input may produce odd error messages, as this is passed through the event system as a fake event. // --> tagProcessor.registerTag(ElementTag.class, "is_in", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(BukkitScriptEvent.inCheckInternal(attribute.context, "is_in tag", object, attribute.getContext(1), "is_in tag", "is_in tag")); + return new ElementTag(BukkitScriptEvent.inCheckInternal(attribute.context, "is_in tag", object, attribute.getParam(), "is_in tag", "is_in tag")); }); // <--[tag] diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/MaterialTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/MaterialTag.java index 9f9ccc70a7..a9723a90c0 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/MaterialTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/MaterialTag.java @@ -554,11 +554,11 @@ public static void registerTags() { tagProcessor.registerTag(ElementTag.class, "has_vanilla_data_tag", (attribute, object) -> { Deprecations.materialHasDataPackTag.warn(attribute.context); - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("MaterialTag.has_vanilla_data_tag[...] tag must have an input value."); return null; } - NamespacedKey key = NamespacedKey.minecraft(CoreUtilities.toLowerCase(attribute.getContext(1))); + NamespacedKey key = NamespacedKey.minecraft(CoreUtilities.toLowerCase(attribute.getParam())); Tag tagBlock = Bukkit.getTag("blocks", key, Material.class); Tag tagItem = Bukkit.getTag("items", key, Material.class); return new ElementTag((tagBlock != null && tagBlock.isTagged(object.getMaterial()) || (tagItem != null && tagItem.isTagged(object.getMaterial())))); @@ -571,10 +571,10 @@ public static void registerTags() { // Returns whether the material matches some matcher text, using the system behind <@link language Advanced Script Event Matching>. // --> tagProcessor.registerTag(ElementTag.class, "advanced_matches", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(BukkitScriptEvent.tryMaterial(object, attribute.getContext(1))); + return new ElementTag(BukkitScriptEvent.tryMaterial(object, attribute.getParam())); }); // <--[tag] diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/NPCTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/NPCTag.java index 4255f2425b..378887f3b2 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/NPCTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/NPCTag.java @@ -527,8 +527,8 @@ public static void registerTags() { // Returns whether the NPC has a specified trait. // --> tagProcessor.registerTag(ElementTag.class, "has_trait", (attribute, object) -> { - if (attribute.hasContext(1)) { - Class trait = CitizensAPI.getTraitFactory().getTraitClass(attribute.getContext(1)); + if (attribute.hasParam()) { + Class trait = CitizensAPI.getTraitFactory().getTraitClass(attribute.getParam()); if (trait != null) { return new ElementTag(object.getCitizen().hasTrait(trait)); } @@ -553,14 +553,14 @@ public static void registerTags() { // Returns whether the NPC has a specified trigger. // --> tagProcessor.registerTag(ElementTag.class, "has_trigger", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } if (!object.getCitizen().hasTrait(TriggerTrait.class)) { return new ElementTag(false); } TriggerTrait trait = object.getCitizen().getOrAddTrait(TriggerTrait.class); - return new ElementTag(trait.hasTrigger(attribute.getContext(1))); + return new ElementTag(trait.hasTrigger(attribute.getParam())); }); // <--[tag] @@ -595,13 +595,13 @@ public static void registerTags() { // --> tagProcessor.registerTag(ObjectTag.class, "anchor", (attribute, object) -> { Anchors trait = object.getCitizen().getOrAddTrait(Anchors.class); - if (attribute.hasContext(1)) { - Anchor anchor = trait.getAnchor(attribute.getContext(1)); + if (attribute.hasParam()) { + Anchor anchor = trait.getAnchor(attribute.getParam()); if (anchor != null) { return new LocationTag(anchor.getLocation()); } else { - attribute.echoError("NPC Anchor '" + attribute.getContext(1) + "' is not defined."); + attribute.echoError("NPC Anchor '" + attribute.getParam() + "' is not defined."); return null; } } @@ -627,11 +627,11 @@ else if (attribute.startsWith("list", 2)) { // Returns the specified constant from the NPC. // --> tagProcessor.registerTag(ElementTag.class, "constant", (attribute, object) -> { - if (attribute.hasContext(1)) { + if (attribute.hasParam()) { if (object.getCitizen().hasTrait(ConstantsTrait.class) - && object.getCitizen().getOrAddTrait(ConstantsTrait.class).getConstant(attribute.getContext(1)) != null) { + && object.getCitizen().getOrAddTrait(ConstantsTrait.class).getConstant(attribute.getParam()) != null) { return new ElementTag(object.getCitizen().getOrAddTrait(ConstantsTrait.class) - .getConstant(attribute.getContext(1))); + .getConstant(attribute.getParam())); } else { return null; @@ -647,8 +647,8 @@ else if (attribute.startsWith("list", 2)) { // Returns true if the NPC has the specified pose, otherwise returns false. // --> tagProcessor.registerTag(ElementTag.class, "has_pose", (attribute, object) -> { - if (attribute.hasContext(1)) { - return new ElementTag(object.getCitizen().getOrAddTrait(Poses.class).hasPose(attribute.getContext(1))); + if (attribute.hasParam()) { + return new ElementTag(object.getCitizen().getOrAddTrait(Poses.class).hasPose(attribute.getParam())); } else { return null; @@ -663,8 +663,8 @@ else if (attribute.startsWith("list", 2)) { // possible available world Bukkit knows about. // --> tagProcessor.registerTag(LocationTag.class, "pose", (attribute, object) -> { - if (attribute.hasContext(1)) { - Pose pose = object.getCitizen().getOrAddTrait(Poses.class).getPose(attribute.getContext(1)); + if (attribute.hasParam()) { + Pose pose = object.getCitizen().getOrAddTrait(Poses.class).getPose(attribute.getParam()); return new LocationTag(org.bukkit.Bukkit.getWorlds().get(0), 0, 0, 0, pose.getYaw(), pose.getPitch()); } else { @@ -1199,10 +1199,10 @@ else if (attribute.startsWith("list", 2)) { // Returns the value of a Citizens NPC metadata key. // --> tagProcessor.registerTag(ElementTag.class, "citizens_data", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - Object val = object.getCitizen().data().get(attribute.getContext(1)); + Object val = object.getCitizen().data().get(attribute.getParam()); if (val == null) { return null; } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/PlayerTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/PlayerTag.java index 964015ff2e..c093a9cdc1 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/PlayerTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/PlayerTag.java @@ -659,8 +659,8 @@ public static void registerTags() { // --> tagProcessor.registerTag(ElementTag.class, "chat_history", (attribute, object) -> { int x = 1; - if (attribute.hasContext(1) && ArgumentHelper.matchesInteger(attribute.getContext(1))) { - x = attribute.getIntContext(1); + if (attribute.hasParam() && ArgumentHelper.matchesInteger(attribute.getParam())) { + x = attribute.getIntParam(); } // No playerchathistory? Return null. if (!PlayerTagBase.playerChatHistory.containsKey(object.getUUID())) { @@ -746,7 +746,7 @@ public static void registerTags() { // --> registerOnlineOnlyTag(ObjectTag.class, "target", (attribute, object) -> { double range = 50; - String matcher = attribute.hasContext(1) ? attribute.getContext(1) : null; + String matcher = attribute.hasParam() ? attribute.getParam() : null; // <--[tag] // @attribute )].within[(<#.#>)]> @@ -824,7 +824,7 @@ public static void registerTags() { // Returns the cooldown duration remaining on player's material. // --> tagProcessor.registerTag(DurationTag.class, "item_cooldown", (attribute, object) -> { - MaterialTag mat = new ElementTag(attribute.getContext(1)).asType(MaterialTag.class, attribute.context); + MaterialTag mat = new ElementTag(attribute.getParam()).asType(MaterialTag.class, attribute.context); if (mat != null) { return new DurationTag((long) object.getPlayerEntity().getCooldown(mat.getMaterial())); } @@ -906,14 +906,14 @@ public static void registerTags() { // Handle EntityTag health tags here to allow getting them when the player is offline tagProcessor.registerTag(ElementTag.class, "formatted_health", (attribute, object) -> { - Double maxHealth = attribute.hasContext(1) ? attribute.getDoubleContext(1) : null; + Double maxHealth = attribute.hasParam() ? attribute.getDoubleParam() : null; return EntityHealth.getHealthFormatted(new EntityTag(object.getPlayerEntity()), maxHealth); }); tagProcessor.registerTag(ElementTag.class, "health_percentage", (attribute, object) -> { double maxHealth = object.getPlayerEntity().getMaxHealth(); - if (attribute.hasContext(1)) { - maxHealth = attribute.getIntContext(1); + if (attribute.hasParam()) { + maxHealth = attribute.getIntParam(); } return new ElementTag((object.getPlayerEntity().getHealth() / maxHealth) * 100); }); @@ -944,8 +944,8 @@ public static void registerTags() { Deprecations.entityHealthTags.warn(attribute.context); attribute.fulfill(1); double maxHealth = object.getPlayerEntity().getMaxHealth(); - if (attribute.hasContext(1)) { - maxHealth = attribute.getIntContext(1); + if (attribute.hasParam()) { + maxHealth = attribute.getIntParam(); } return new ElementTag((object.getPlayerEntity().getHealth() / maxHealth) * 100); } @@ -1047,10 +1047,10 @@ else if (ban.getExpiration() == null) { } ListTag list = new ListTag(); WorldTag world = null; - if (attribute.hasContext(1)) { - world = attribute.contextAsType(1, WorldTag.class); + if (attribute.hasParam()) { + world = attribute.paramAsType(WorldTag.class); if (world == null) { - Debug.echoError("Invalid world specified: " + attribute.getContext(1)); + Debug.echoError("Invalid world specified: " + attribute.getParam()); return null; } } @@ -1180,7 +1180,7 @@ else if (attribute.startsWith("source", 2)) { return null; } - String group = attribute.getContext(1); + String group = attribute.getParam(); // <--[tag] // @attribute ].global> @@ -1239,7 +1239,7 @@ else if (Depends.permissions != null) { // (May work with offline players, depending on your permissions system.) // --> tagProcessor.registerTag(ElementTag.class, "has_permission", (attribute, object) -> { - String permission = attribute.getContext(1); + String permission = attribute.getParam(); // <--[tag] // @attribute @@ -1308,15 +1308,15 @@ else if (Depends.permissions != null) { // Works with offline players. // --> tagProcessor.registerTag(ElementTag.class, "statistic", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } Statistic statistic; try { - statistic = Statistic.valueOf(attribute.getContext(1).toUpperCase()); + statistic = Statistic.valueOf(attribute.getParam().toUpperCase()); } catch (IllegalArgumentException ex) { - attribute.echoError("Statistic '" + attribute.getContext(1) + "' does not exist: " + ex.getMessage()); + attribute.echoError("Statistic '" + attribute.getParam() + "' does not exist: " + ex.getMessage()); return null; } @@ -1800,10 +1800,10 @@ else if (attribute.startsWith("percent", 2)) { // Returns whether the player has the chunk loaded on their client. // --> registerOnlineOnlyTag(ElementTag.class, "chunk_loaded", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - ChunkTag chunk = attribute.contextAsType(1, ChunkTag.class); + ChunkTag chunk = attribute.paramAsType(ChunkTag.class); if (chunk == null) { return null; } @@ -1869,8 +1869,8 @@ else if (attribute.startsWith("percent", 2)) { // --> registerOnlineOnlyTag(ElementTag.class, "formatted_food_level", (attribute, object) -> { double maxHunger = object.getPlayerEntity().getMaxHealth(); - if (attribute.hasContext(1)) { - maxHunger = attribute.getIntContext(1); + if (attribute.hasParam()) { + maxHunger = attribute.getIntParam(); } attribute.fulfill(1); int foodLevel = object.getFoodLevel(); @@ -1999,13 +1999,13 @@ else if (foodLevel / maxHunger < 1) { // Returns whether the player has completed the specified advancement. // --> registerOnlineOnlyTag(ElementTag.class, "has_advancement", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - Advancement adv = AdvancementHelper.getAdvancement(attribute.getContext(1)); + Advancement adv = AdvancementHelper.getAdvancement(attribute.getParam()); if (adv == null) { if (!attribute.hasAlternative()) { - Debug.echoError("Advancement '" + attribute.getContext(1) + "' does not exist."); + Debug.echoError("Advancement '" + attribute.getParam() + "' does not exist."); } return null; } @@ -2197,10 +2197,10 @@ else if (foodLevel / maxHunger < 1) { // Returns null if the player doesn't have a fake block at the location. // --> tagProcessor.registerTag(MaterialTag.class, "fake_block", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - LocationTag input = attribute.contextAsType(1, LocationTag.class); + LocationTag input = attribute.paramAsType(LocationTag.class); FakeBlock.FakeBlockMap map = FakeBlock.blocks.get(object.getUUID()); if (map != null) { FakeBlock block = map.byLocation.get(input); @@ -2243,8 +2243,8 @@ else if (foodLevel / maxHunger < 1) { return null; } DisguiseCommand.TrackedDisguise disguise; - if (attribute.hasContext(1)) { - PlayerTag player = attribute.contextAsType(1, PlayerTag.class); + if (attribute.hasParam()) { + PlayerTag player = attribute.paramAsType(PlayerTag.class); if (player == null) { attribute.echoError("Invalid player for is_disguised tag."); return null; @@ -2387,7 +2387,7 @@ public static void registerOnlineOnlyTag(Class returnTy tagProcessor.registerTag(returnType, name, (attribute, object) -> { if (!object.isOnline()) { if (!attribute.hasAlternative()) { - Debug.echoError("Player is not online, but tag '" + attribute.getAttributeWithoutContext(1) + "' requires the player be online, for player: " + object.debuggable()); + Debug.echoError("Player is not online, but tag '" + attribute.getAttributeWithoutParam(1) + "' requires the player be online, for player: " + object.debuggable()); } return null; } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/PolygonTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/PolygonTag.java index a3406c2325..11d68f5a87 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/PolygonTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/PolygonTag.java @@ -588,11 +588,11 @@ public static void registerTags() { // Returns a copy of the polygon, with all coordinates shifted by the given location-vector. // --> tagProcessor.registerTag(PolygonTag.class, "shift", (attribute, polygon) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("PolygonTag.shift[...] tag must have an input."); return null; } - LocationTag shift = attribute.contextAsType(1, LocationTag.class); + LocationTag shift = attribute.paramAsType(LocationTag.class); PolygonTag toReturn = polygon.clone(); toReturn.yMin += shift.getY(); toReturn.yMax += shift.getY(); @@ -615,11 +615,11 @@ public static void registerTags() { // Returns a copy of the polygon, with the specified corner added to the end of the corner list. // --> tagProcessor.registerTag(PolygonTag.class, "with_corner", (attribute, polygon) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("PolygonTag.with_corner[...] tag must have an input."); return null; } - LocationTag corner = attribute.contextAsType(1, LocationTag.class); + LocationTag corner = attribute.paramAsType(LocationTag.class); PolygonTag toReturn = polygon.clone(); Corner added = new Corner(corner.getX(), corner.getZ()); toReturn.corners.add(added); @@ -634,12 +634,12 @@ public static void registerTags() { // Returns a copy of the polygon, with the specified minimum-Y value. // --> tagProcessor.registerTag(PolygonTag.class, "with_y_min", (attribute, polygon) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("PolygonTag.with_y_min[...] tag must have an input."); return null; } PolygonTag toReturn = polygon.clone(); - toReturn.yMin = attribute.getDoubleContext(1); + toReturn.yMin = attribute.getDoubleParam(); return toReturn; }); @@ -650,12 +650,12 @@ public static void registerTags() { // Returns a copy of the polygon, with the specified maximum-Y value. // --> tagProcessor.registerTag(PolygonTag.class, "with_y_max", (attribute, polygon) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("PolygonTag.with_y_max[...] tag must have an input."); return null; } PolygonTag toReturn = polygon.clone(); - toReturn.yMax = attribute.getDoubleContext(1); + toReturn.yMax = attribute.getDoubleParam(); return toReturn; }); @@ -666,12 +666,12 @@ public static void registerTags() { // Returns a copy of the polygon, with the specified Y value included as part of the Y range (expanding the Y-min or Y-max as needed). // --> tagProcessor.registerTag(PolygonTag.class, "include_y", (attribute, polygon) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("PolygonTag.include_y[...] tag must have an input."); return null; } PolygonTag toReturn = polygon.clone(); - double y = attribute.getDoubleContext(1); + double y = attribute.getDoubleParam(); toReturn.yMin = Math.min(y, toReturn.yMin); toReturn.yMax = Math.max(y, toReturn.yMax); return toReturn; @@ -684,11 +684,11 @@ public static void registerTags() { // Returns a list of locations along the 2D outline of this polygon, at the specified Y level (roughly a block-width of separation between each). // --> tagProcessor.registerTag(ListTag.class, "outline_2d", (attribute, polygon) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("PolygonTag.outline_2d[...] tag must have an input."); return null; } - double y = attribute.getDoubleContext(1); + double y = attribute.getDoubleParam(); ListTag output = new ListTag(); polygon.addOutline2D(y, output); return output; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/WorldTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/WorldTag.java index f24a30d13e..c234697f37 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/WorldTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/WorldTag.java @@ -244,7 +244,7 @@ public static void registerTags() { // --> registerTag(ListTag.class, "entities", (attribute, object) -> { ListTag entities = new ListTag(); - String matcher = attribute.hasContext(1) ? attribute.getContext(1) : null; + String matcher = attribute.hasParam() ? attribute.getParam() : null; for (Entity entity : object.getEntitiesForTag()) { EntityTag current = new EntityTag(entity); if (matcher == null || BukkitScriptEvent.tryEntity(current, matcher)) { @@ -763,11 +763,11 @@ else if (time >= 12500) { // Note that the name is case-sensitive... so "doFireTick" is correct, but "dofiretick" is not. // --> registerTag(ElementTag.class, "gamerule", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("The tag 'worldtag.gamerule[...]' must have an input value."); return null; } - GameRule rule = GameRule.getByName(attribute.getContext(1)); + GameRule rule = GameRule.getByName(attribute.getParam()); Object result = object.getWorld().getGameRuleValue(rule); return new ElementTag(result == null ? "null" : result.toString()); }); @@ -854,10 +854,10 @@ else if (time >= 12500) { // Returns whether the world matches some matcher text, using the system behind <@link language Advanced Script Event Matching>. // --> registerTag(ElementTag.class, "advanced_matches", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(BukkitScriptEvent.tryWorld(object, attribute.getContext(1))); + return new ElementTag(BukkitScriptEvent.tryWorld(object, attribute.getParam())); }); } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementProperties.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementProperties.java index f8d4bb4425..7f9a573ccf 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementProperties.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementProperties.java @@ -280,12 +280,12 @@ public static void registerTags() { // Returns the text re-formatted according to a format script. // --> PropertyParser.registerTag(ElementTag.class, "format", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - FormatScriptContainer format = ScriptRegistry.getScriptContainer(attribute.getContext(1)); + FormatScriptContainer format = ScriptRegistry.getScriptContainer(attribute.getParam()); if (format == null) { - attribute.echoError("Could not find format script matching '" + attribute.getContext(1) + "'"); + attribute.echoError("Could not find format script matching '" + attribute.getParam() + "'"); return null; } else { @@ -308,7 +308,7 @@ public static void registerTags() { // This will transfer colors over to new lines as well. // --> PropertyParser.registerStaticTag(ElementTag.class, "split_lines_by_width", (attribute, object) -> { - int width = attribute.getIntContext(1); + int width = attribute.getIntParam(); return new ElementTag(TextWidthHelper.splitLines(object.asString(), width)); }); @@ -376,8 +376,8 @@ public static void registerTags() { // --> PropertyParser.registerStaticTag(ElementTag.class, "parse_color", (attribute, object) -> { char prefix = '&'; - if (attribute.hasContext(1)) { - prefix = attribute.getContext(1).charAt(0); + if (attribute.hasParam()) { + prefix = attribute.getParam().charAt(0); } String parsed = ChatColor.translateAlternateColorCodes(prefix, object.asString()); parsed = replaceEssentialsHexColors(prefix, parsed); @@ -461,10 +461,10 @@ public static void registerTags() { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> PropertyParser.registerTag(ElementTag.class, "on_hover", (attribute, object) -> { // non-static due to hacked sub-tag - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String hoverText = attribute.getContext(1); + String hoverText = attribute.getParam(); String type = "SHOW_TEXT"; // <--[tag] @@ -497,10 +497,10 @@ public static void registerTags() { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> PropertyParser.registerTag(ElementTag.class, "on_click", (attribute, object) -> { // non-static due to hacked sub-tag - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String clickText = attribute.getContext(1); + String clickText = attribute.getParam(); String type = "RUN_COMMAND"; // <--[tag] @@ -530,10 +530,10 @@ public static void registerTags() { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> PropertyParser.registerStaticTag(ElementTag.class, "with_insertion", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String insertionText = attribute.getContext(1); + String insertionText = attribute.getParam(); return new ElementTag(ChatColor.COLOR_CHAR + "[insertion=" + FormattedTextHelper.escape(insertionText) + "]" + object.asString() + ChatColor.COLOR_CHAR + "[/insertion]"); }); @@ -641,10 +641,10 @@ public static void registerTags() { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> PropertyParser.registerStaticTag(ElementTag.class, "custom_color", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(ChatColor.COLOR_CHAR + "[color=f]" + CustomColorTagBase.getColor(attribute.getContext(1), attribute.context) + object.asString() + ChatColor.COLOR_CHAR + "[reset=color]"); + return new ElementTag(ChatColor.COLOR_CHAR + "[color=f]" + CustomColorTagBase.getColor(attribute.getParam(), attribute.context) + object.asString() + ChatColor.COLOR_CHAR + "[reset=color]"); }); // <--[tag] @@ -657,10 +657,10 @@ public static void registerTags() { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> PropertyParser.registerStaticTag(ElementTag.class, "color", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String colorName = attribute.getContext(1); + String colorName = attribute.getParam(); String colorOut = null; if (colorName.length() == 1) { ChatColor color = ChatColor.getByChar(colorName.charAt(0)); @@ -706,10 +706,10 @@ else if (colorName.startsWith("co@")) { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> PropertyParser.registerStaticTag(ElementTag.class, "font", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String fontName = attribute.getContext(1); + String fontName = attribute.getParam(); return new ElementTag(ChatColor.COLOR_CHAR + "[font=" + fontName + "]" + object.asString() + ChatColor.COLOR_CHAR + "[reset=font]"); }); @@ -725,8 +725,8 @@ else if (colorName.startsWith("co@")) { PropertyParser.registerStaticTag(ElementTag.class, "rainbow", (attribute, object) -> { String str = object.asString(); String pattern = "4c6e2ab319d5"; - if (attribute.hasContext(1)) { - pattern = attribute.getContext(1); + if (attribute.hasParam()) { + pattern = attribute.getParam(); } StringBuilder output = new StringBuilder(str.length() * 3); for (int i = 0; i < str.length(); i++) { @@ -759,8 +759,8 @@ else if (colorName.startsWith("co@")) { float hue = HSB[0] / 255f; str = ChatColor.stripColor(str); int length = str.length(); - if (attribute.hasContext(1)) { - length = attribute.getIntContext(1); + if (attribute.hasParam()) { + length = attribute.getIntParam(); } float increment = 1.0f / length; StringBuilder output = new StringBuilder(str.length() * 8); @@ -784,14 +784,14 @@ else if (colorName.startsWith("co@")) { // Or: // --> PropertyParser.registerStaticTag(ElementTag.class, "color_gradient", (attribute, object) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } String str = ChatColor.stripColor(object.asString()); if (str.length() == 0) { return new ElementTag(""); } - MapTag inputMap = attribute.contextAsType(1, MapTag.class); + MapTag inputMap = attribute.paramAsType(MapTag.class); if (inputMap == null) { return null; } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitScriptProperties.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitScriptProperties.java index b77a4569fd..06eb41a023 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitScriptProperties.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitScriptProperties.java @@ -48,7 +48,7 @@ public static void registerTags() { // using the attached player available in the script entry. Not having a valid player will result in 'null'. // --> PropertyParser.registerTag(ElementTag.class, "cooled_down", (attribute, script) -> { - PlayerTag player = (attribute.hasContext(1) ? attribute.contextAsType(1, PlayerTag.class) + PlayerTag player = (attribute.hasParam() ? attribute.paramAsType(PlayerTag.class) : ((BukkitScriptEntryData) attribute.getScriptEntry().entryData).getPlayer()); if (player != null && player.isValid()) { return new ElementTag(CooldownCommand.checkCooldown(player, script.script.getContainer().getName())); @@ -65,7 +65,7 @@ public static void registerTags() { // Returns the time left for the player to cooldown for the script. // --> PropertyParser.registerTag(DurationTag.class, "cooldown", (attribute, script) -> { - PlayerTag player = (attribute.hasContext(1) ? attribute.contextAsType(1, PlayerTag.class) + PlayerTag player = (attribute.hasParam() ? attribute.paramAsType(PlayerTag.class) : ((BukkitScriptEntryData) attribute.getScriptEntry().entryData).getPlayer()); return CooldownCommand.getCooldownDuration(player, script.script.getName()); }); @@ -78,7 +78,7 @@ public static void registerTags() { // Must be an INTERACT script. // --> PropertyParser.registerTag(ElementTag.class, "step", (attribute, script) -> { - PlayerTag player = attribute.hasContext(1) ? attribute.contextAsType(1, PlayerTag.class) : ((BukkitScriptEntryData) attribute.getScriptEntry().entryData).getPlayer(); + PlayerTag player = attribute.hasParam() ? attribute.paramAsType(PlayerTag.class) : ((BukkitScriptEntryData) attribute.getScriptEntry().entryData).getPlayer(); if (player != null && player.isValid()) { return new ElementTag(InteractScriptHelper.getCurrentStep(player, script.script.getContainer().getName())); } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityAreaEffectCloud.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityAreaEffectCloud.java index 446e67ec3d..5810cde41b 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityAreaEffectCloud.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityAreaEffectCloud.java @@ -251,8 +251,8 @@ public ObjectTag getObjectAttribute(Attribute attribute) { // If no effect is specified, returns whether it has any custom effect. // --> if (attribute.startsWith("has_custom_effect")) { - if (attribute.hasContext(1)) { - PotionEffectType effectType = PotionEffectType.getByName(attribute.getContext(1)); + if (attribute.hasParam()) { + PotionEffectType effectType = PotionEffectType.getByName(attribute.getParam()); for (PotionEffect effect : getHelper().getCustomEffects()) { if (effect.getType().equals(effectType)) { return new ElementTag(true).getObjectAttribute(attribute.fulfill(1)); @@ -291,7 +291,7 @@ public ObjectTag getObjectAttribute(Attribute attribute) { // --> if (attribute.startsWith("custom_effects")) { List effects = getHelper().getCustomEffects(); - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { ListTag list = new ListTag(); for (PotionEffect effect : effects) { list.add(effect.getType().getName() + "," + @@ -302,7 +302,7 @@ public ObjectTag getObjectAttribute(Attribute attribute) { } return list.getObjectAttribute(attribute.fulfill(1)); } - int val = attribute.getIntContext(1) - 1; + int val = attribute.getIntParam() - 1; if (val < 0 || val >= effects.size()) { return null; } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityArmorPose.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityArmorPose.java index 0acd3fb333..93c91e22e8 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityArmorPose.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityArmorPose.java @@ -114,10 +114,10 @@ public static void registerTags() { // --> PropertyParser.registerTag(LocationTag.class, "armor_pose", (attribute, entity) -> { Deprecations.entityArmorPose.warn(attribute.context); - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String name = attribute.getContext(1); + String name = attribute.getParam(); PosePart posePart = PosePart.fromName(name); if (posePart == null) { attribute.echoError("Invalid pose part specified: " + name); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityAttributeBaseValues.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityAttributeBaseValues.java index 80c9c3335c..ffc809f1f4 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityAttributeBaseValues.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityAttributeBaseValues.java @@ -84,9 +84,9 @@ public ObjectTag getObjectAttribute(Attribute attribute) { // Valid attribute names are listed at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/Attribute.html> // See also <@link language attribute modifiers>. // --> - if (attribute.startsWith("has_attribute") && attribute.hasContext(1)) { + if (attribute.startsWith("has_attribute") && attribute.hasParam()) { AttributeInstance instance = ((Attributable) entity.getBukkitEntity()).getAttribute( - org.bukkit.attribute.Attribute.valueOf(attribute.getContext(1).toUpperCase())); + org.bukkit.attribute.Attribute.valueOf(attribute.getParam().toUpperCase())); return new ElementTag(instance != null).getObjectAttribute(attribute.fulfill(1)); } @@ -101,8 +101,8 @@ public ObjectTag getObjectAttribute(Attribute attribute) { // Valid attribute names are listed at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/Attribute.html> // See also <@link language attribute modifiers>. // --> - if (attribute.startsWith("attribute_value") && attribute.hasContext(1)) { - org.bukkit.attribute.Attribute attr = org.bukkit.attribute.Attribute.valueOf(attribute.getContext(1).toUpperCase()); + if (attribute.startsWith("attribute_value") && attribute.hasParam()) { + org.bukkit.attribute.Attribute attr = org.bukkit.attribute.Attribute.valueOf(attribute.getParam().toUpperCase()); AttributeInstance instance = ((Attributable) entity.getBukkitEntity()).getAttribute(attr); if (instance == null) { attribute.echoError("Attribute " + attr.name() + " is not applicable to entity of type " + entity.getBukkitEntity().getType().name()); @@ -122,8 +122,8 @@ public ObjectTag getObjectAttribute(Attribute attribute) { // Valid attribute names are listed at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/Attribute.html> // See also <@link language attribute modifiers>. // --> - if (attribute.startsWith("attribute_base_value") && attribute.hasContext(1)) { - org.bukkit.attribute.Attribute attr = org.bukkit.attribute.Attribute.valueOf(attribute.getContext(1).toUpperCase()); + if (attribute.startsWith("attribute_base_value") && attribute.hasParam()) { + org.bukkit.attribute.Attribute attr = org.bukkit.attribute.Attribute.valueOf(attribute.getParam().toUpperCase()); AttributeInstance instance = ((Attributable) entity.getBukkitEntity()).getAttribute(attr); if (instance == null) { attribute.echoError("Attribute " + attr.name() + " is not applicable to entity of type " + entity.getBukkitEntity().getType().name()); @@ -143,8 +143,8 @@ public ObjectTag getObjectAttribute(Attribute attribute) { // Valid attribute names are listed at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/Attribute.html> // See also <@link language attribute modifiers>. // --> - if (attribute.startsWith("attribute_default_value") && attribute.hasContext(1)) { - org.bukkit.attribute.Attribute attr = org.bukkit.attribute.Attribute.valueOf(attribute.getContext(1).toUpperCase()); + if (attribute.startsWith("attribute_default_value") && attribute.hasParam()) { + org.bukkit.attribute.Attribute attr = org.bukkit.attribute.Attribute.valueOf(attribute.getParam().toUpperCase()); AttributeInstance instance = ((Attributable) entity.getBukkitEntity()).getAttribute(attr); if (instance == null) { attribute.echoError("Attribute " + attr.name() + " is not applicable to entity of type " + entity.getBukkitEntity().getType().name()); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityHealth.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityHealth.java index 16b83373a0..53669c38a3 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityHealth.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityHealth.java @@ -90,7 +90,7 @@ public ObjectTag getObjectAttribute(Attribute attribute) { // May be 'dying', 'seriously wounded', 'injured', 'scraped', or 'healthy'. // --> if (attribute.startsWith("formatted_health")) { - return getHealthFormatted(entity, attribute.hasContext(1) ? attribute.getDoubleContext(1) : null); + return getHealthFormatted(entity, attribute.hasParam() ? attribute.getDoubleParam() : null); } if (attribute.startsWith("health.formatted")) { Deprecations.entityHealthTags.warn(attribute.context); @@ -125,8 +125,8 @@ public ObjectTag getObjectAttribute(Attribute attribute) { // --> if (attribute.startsWith("health_percentage")) { double maxHealth = entity.getLivingEntity().getMaxHealth(); - if (attribute.hasContext(1)) { - maxHealth = attribute.getIntContext(1); + if (attribute.hasParam()) { + maxHealth = attribute.getIntParam(); } return new ElementTag((entity.getLivingEntity().getHealth() / maxHealth) * 100) .getObjectAttribute(attribute.fulfill(1)); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityPotionEffects.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityPotionEffects.java index 4ae73f8f51..7d646ff42f 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityPotionEffects.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityPotionEffects.java @@ -111,8 +111,8 @@ public ObjectTag getObjectAttribute(Attribute attribute) { // --> if (attribute.startsWith("has_effect")) { boolean returnElement = false; - if (attribute.hasContext(1)) { - PotionEffectType effectType = PotionEffectType.getByName(attribute.getContext(1)); + if (attribute.hasParam()) { + PotionEffectType effectType = PotionEffectType.getByName(attribute.getParam()); for (org.bukkit.potion.PotionEffect effect : getEffectsList()) { if (effect.getType().equals(effectType)) { returnElement = true; diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/inventory/InventoryContents.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/inventory/InventoryContents.java index b0be9ea4e3..127e5d33e3 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/inventory/InventoryContents.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/inventory/InventoryContents.java @@ -166,10 +166,10 @@ public static void registerTags() { if (attribute.startsWith("with_lore", 2)) { attribute.fulfill(1); // Must specify lore to check - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String lore = attribute.getContext(1); + String lore = attribute.getParam(); attribute.fulfill(1); // <--[tag] diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemBook.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemBook.java index 05dff17539..bab230c6fd 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemBook.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemBook.java @@ -134,13 +134,13 @@ public ObjectTag getObjectAttribute(Attribute attribute) { return new ElementTag(bookInfo.getPageCount()) .getObjectAttribute(attribute.fulfill(1)); } - if ((attribute.startsWith("page") || attribute.startsWith("get_page")) && attribute.hasContext(1)) { - return new ElementTag(FormattedTextHelper.stringify(bookInfo.spigot().getPage(attribute.getIntContext(1)), ChatColor.BLACK)) + if ((attribute.startsWith("page") || attribute.startsWith("get_page")) && attribute.hasParam()) { + return new ElementTag(FormattedTextHelper.stringify(bookInfo.spigot().getPage(attribute.getIntParam()), ChatColor.BLACK)) .getObjectAttribute(attribute.fulfill(1)); } - if ((attribute.startsWith("raw_page") || attribute.startsWith("get_raw_page")) && attribute.hasContext(1)) { + if ((attribute.startsWith("raw_page") || attribute.startsWith("get_raw_page")) && attribute.hasParam()) { Deprecations.bookItemRawTags.warn(attribute.context); - return new ElementTag(ComponentSerializer.toString(bookInfo.spigot().getPage(attribute.getIntContext(1)))) + return new ElementTag(ComponentSerializer.toString(bookInfo.spigot().getPage(attribute.getIntParam()))) .getObjectAttribute(attribute.fulfill(1)); } if (attribute.startsWith("pages")) { diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemFlags.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemFlags.java index a892ba7feb..5f0aab83f0 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemFlags.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemFlags.java @@ -63,7 +63,7 @@ public ObjectTag getObjectAttribute(Attribute attribute) { ItemTag item = new ItemTag(this.item.getItemStack().clone()); FlagCommand.FlagActionProvider provider = new FlagCommand.FlagActionProvider(); provider.tracker = item.getFlagTracker(); - DataAction action = DataActionHelper.parse(provider, attribute.getContext(1), attribute.context); + DataAction action = DataActionHelper.parse(provider, attribute.getParam(), attribute.context); // <--[tag] // @attribute ].duration[]> diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemNBT.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemNBT.java index f4ba44a6fd..d8f5a27315 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemNBT.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemNBT.java @@ -53,7 +53,7 @@ public ObjectTag getObjectAttribute(Attribute attribute) { if (attribute.startsWith("has_nbt")) { Deprecations.itemNbt.warn(attribute.context); - return new ElementTag(CustomNBT.hasCustomNBT(item.getItemStack(), attribute.getContext(1), CustomNBT.KEY_DENIZEN)) + return new ElementTag(CustomNBT.hasCustomNBT(item.getItemStack(), attribute.getParam(), CustomNBT.KEY_DENIZEN)) .getObjectAttribute(attribute.fulfill(1)); } @@ -65,14 +65,14 @@ public ObjectTag getObjectAttribute(Attribute attribute) { if (attribute.matches("nbt")) { Deprecations.itemNbt.warn(attribute.context); - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { ListTag list = getNBTDataList(); if (list == null) { return null; } return list.getObjectAttribute(attribute.fulfill(1)); } - String res = CustomNBT.getCustomNBT(item.getItemStack(), attribute.getContext(1), CustomNBT.KEY_DENIZEN); + String res = CustomNBT.getCustomNBT(item.getItemStack(), attribute.getParam(), CustomNBT.KEY_DENIZEN); if (res == null) { return null; } diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemPotion.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemPotion.java index c99263fc96..94ed8ed57a 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemPotion.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/item/ItemPotion.java @@ -195,7 +195,7 @@ public ObjectTag getObjectAttribute(Attribute attribute) { if (attribute.startsWith("potion_effect")) { PotionMeta meta = ((PotionMeta) item.getItemMeta()); - int potN = attribute.hasContext(1) ? attribute.getIntContext(1) - 1 : 0; + int potN = attribute.hasParam() ? attribute.getIntParam() - 1 : 0; if (potN < 0 || potN > meta.getCustomEffects().size()) { return null; } diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/SchematicCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/SchematicCommand.java index 30bf00737f..3309a1c034 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/SchematicCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/SchematicCommand.java @@ -562,7 +562,7 @@ public void schematicTags(ReplaceableTagEvent event) { return; } Attribute attribute = event.getAttributes(); - String id = attribute.hasContext(1) ? attribute.getContext(1).toUpperCase() : null; + String id = attribute.hasParam() ? attribute.getParam().toUpperCase() : null; attribute = attribute.fulfill(1); // <--[tag] @@ -645,8 +645,8 @@ public void schematicTags(ReplaceableTagEvent event) { // An input location of 0,0,0 corresponds to the minimum corner of the schematic. // --> if (attribute.startsWith("block")) { - if (attribute.hasContext(1) && LocationTag.matches(attribute.getContext(1))) { - LocationTag location = attribute.contextAsType(1, LocationTag.class); + if (attribute.hasParam() && LocationTag.matches(attribute.getParam())) { + LocationTag location = attribute.paramAsType(LocationTag.class); FullBlockData block = set.blockAt(location.getX(), location.getY(), location.getZ()); event.setReplaced(new MaterialTag(block.data) .getAttribute(attribute.fulfill(1))); @@ -684,8 +684,8 @@ public void schematicTags(ReplaceableTagEvent event) { // @description // Returns a cuboid of where the schematic would be if it was pasted at an origin. // --> - if (attribute.startsWith("cuboid") && attribute.hasContext(1)) { - LocationTag origin = attribute.contextAsType(1, LocationTag.class); + if (attribute.startsWith("cuboid") && attribute.hasParam()) { + LocationTag origin = attribute.paramAsType(LocationTag.class); event.setReplaced(set.getCuboid(origin) .getAttribute(attribute.fulfill(1))); return; diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/BiomeTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/BiomeTagBase.java index f78ec3404b..567a0d5ab9 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/BiomeTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/BiomeTagBase.java @@ -15,11 +15,11 @@ public BiomeTagBase() { // Refer to <@link objecttype BiomeTag>. // --> TagManager.registerStaticTagBaseHandler(BiomeTag.class, "biome", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Biome tag base must have input."); return null; } - return BiomeTag.valueOf(attribute.getContext(1), attribute.context); + return BiomeTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/ChunkTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/ChunkTagBase.java index f856df76b7..abcd4c6af2 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/ChunkTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/ChunkTagBase.java @@ -15,11 +15,11 @@ public ChunkTagBase() { // Refer to <@link objecttype ChunkTag>. // --> TagManager.registerStaticTagBaseHandler(ChunkTag.class, "chunk", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Chunk tag base must have input."); return null; } - return ChunkTag.valueOf(attribute.getContext(1), attribute.context); + return ChunkTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/ColorTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/ColorTagBase.java index 5466ae36ac..6dc4c7746f 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/ColorTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/ColorTagBase.java @@ -15,11 +15,11 @@ public ColorTagBase() { // Refer to <@link objecttype ColorTag>. // --> TagManager.registerStaticTagBaseHandler(ColorTag.class, "color", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Color tag base must have input."); return null; } - return ColorTag.valueOf(attribute.getContext(1), attribute.context); + return ColorTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/CuboidTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/CuboidTagBase.java index 6df082bbd6..fbd18b9c79 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/CuboidTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/CuboidTagBase.java @@ -15,11 +15,11 @@ public CuboidTagBase() { // Refer to <@link objecttype CuboidTag>. // --> TagManager.registerTagHandler(CuboidTag.class, "cuboid", (attribute) -> { // non-static due to notes - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Cuboid tag base must have input."); return null; } - return CuboidTag.valueOf(attribute.getContext(1), attribute.context); + return CuboidTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/CustomColorTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/CustomColorTagBase.java index 947c7f7bf6..0635b7e716 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/CustomColorTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/CustomColorTagBase.java @@ -47,10 +47,10 @@ public CustomColorTagBase() { // Default color names are 'base', 'emphasis', 'warning', 'error'. // --> TagManager.registerStaticTagBaseHandler(ElementTag.class, "&", attribute -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(getColor(attribute.getContext(1), attribute.context)); + return new ElementTag(getColor(attribute.getParam(), attribute.context)); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/EllipsoidTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/EllipsoidTagBase.java index f268091b00..2d047e91d8 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/EllipsoidTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/EllipsoidTagBase.java @@ -15,11 +15,11 @@ public EllipsoidTagBase() { // Refer to <@link objecttype EllipsoidTag>. // --> TagManager.registerTagHandler(EllipsoidTag.class, "ellipsoid", (attribute) -> { // non-static due to notes - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Ellipsoid tag base must have input."); return null; } - return EllipsoidTag.valueOf(attribute.getContext(1), attribute.context); + return EllipsoidTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/EnchantmentTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/EnchantmentTagBase.java index 943cf40e7a..a2ad5d4cbf 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/EnchantmentTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/EnchantmentTagBase.java @@ -15,11 +15,11 @@ public EnchantmentTagBase() { // Refer to <@link objecttype EnchantmentTag>. // --> TagManager.registerStaticTagBaseHandler(EnchantmentTag.class, "enchantment", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Enchantment tag base must have input."); return null; } - return EnchantmentTag.valueOf(attribute.getContext(1), attribute.context); + return EnchantmentTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/EntityTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/EntityTagBase.java index f26b294019..0668007df0 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/EntityTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/EntityTagBase.java @@ -15,11 +15,11 @@ public EntityTagBase() { // Refer to <@link objecttype EntityTag>. // --> TagManager.registerTagHandler(EntityTag.class, "entity", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Entity tag base must have input."); return null; } - return EntityTag.valueOf(attribute.getContext(1), attribute.context); + return EntityTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/InventoryTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/InventoryTagBase.java index 7ee899fb7a..9138de286e 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/InventoryTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/InventoryTagBase.java @@ -15,11 +15,11 @@ public InventoryTagBase() { // Refer to <@link objecttype InventoryTag>. // --> TagManager.registerTagHandler(InventoryTag.class, "inventory", (attribute) -> { // non-static due to notes - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Inventory tag base must have input."); return null; } - return InventoryTag.valueOf(attribute.getContext(1), attribute.context); + return InventoryTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/ItemTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/ItemTagBase.java index 197e59ccbb..e9c6e6c406 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/ItemTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/ItemTagBase.java @@ -15,11 +15,11 @@ public ItemTagBase() { // Refer to <@link objecttype ItemTag>. // --> TagManager.registerTagHandler(ItemTag.class, "item", (attribute) -> { // non-static as item scripts can contain tags - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Item tag base must have input."); return null; } - return ItemTag.valueOf(attribute.getContext(1), attribute.context); + return ItemTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/LocationTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/LocationTagBase.java index 86c590e61d..3f119d3b0f 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/LocationTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/LocationTagBase.java @@ -15,11 +15,11 @@ public LocationTagBase() { // Refer to <@link objecttype LocationTag>. // --> TagManager.registerTagHandler(LocationTag.class, "location", (attribute) -> { // non-static due to notes - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Location tag base must have input."); return null; } - return LocationTag.valueOf(attribute.getContext(1), attribute.context); + return LocationTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/MaterialTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/MaterialTagBase.java index 0f0f36e342..45e7848b80 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/MaterialTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/MaterialTagBase.java @@ -15,11 +15,11 @@ public MaterialTagBase() { // Refer to <@link objecttype MaterialTag>. // --> TagManager.registerStaticTagBaseHandler(MaterialTag.class, "material", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Material tag base must have input."); return null; } - return MaterialTag.valueOf(attribute.getContext(1), attribute.context); + return MaterialTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/NPCTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/NPCTagBase.java index 3780433cbf..78dd6a03bc 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/NPCTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/NPCTagBase.java @@ -40,7 +40,7 @@ public NPCTagBase() { if (Depends.citizens != null) { Bukkit.getServer().getPluginManager().registerEvents(this, Denizen.getInstance()); TagManager.registerTagHandler(NPCTag.class, "npc", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { NPCTag npc = ((BukkitTagContext) attribute.context).npc; if (npc != null) { return npc; @@ -50,7 +50,7 @@ public NPCTagBase() { return null; } } - return NPCTag.valueOf(attribute.getContext(1), attribute.context); + return NPCTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/PlayerTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/PlayerTagBase.java index 1e792c8cef..72433531c8 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/PlayerTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/PlayerTagBase.java @@ -27,7 +27,7 @@ public PlayerTagBase() { // --> Bukkit.getServer().getPluginManager().registerEvents(this, Denizen.getInstance()); TagManager.registerTagHandler(PlayerTag.class, "player", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { PlayerTag player = ((BukkitTagContext) attribute.context).player; if (player != null) { return player; @@ -37,7 +37,7 @@ public PlayerTagBase() { return null; } } - return PlayerTag.valueOf(attribute.getContext(1), attribute.context); + return PlayerTag.valueOf(attribute.getParam(), attribute.context); }); } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/PluginTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/PluginTagBase.java index b93e8ca9d3..9c5664d4f2 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/PluginTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/PluginTagBase.java @@ -15,11 +15,11 @@ public PluginTagBase() { // Refer to <@link objecttype PluginTag>. // --> TagManager.registerStaticTagBaseHandler(PluginTag.class, "plugin", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Plugin tag base must have input."); return null; } - return PluginTag.valueOf(attribute.getContext(1), attribute.context); + return PluginTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/PolygonTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/PolygonTagBase.java index cf90510e99..1686fd4d2a 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/PolygonTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/PolygonTagBase.java @@ -15,11 +15,11 @@ public PolygonTagBase() { // Refer to <@link objecttype PolygonTag>. // --> TagManager.registerTagHandler(PolygonTag.class, "polygon", (attribute) -> { // non-static due to notes - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Polygon tag base must have input."); return null; } - return PolygonTag.valueOf(attribute.getContext(1), attribute.context); + return PolygonTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/ServerTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/ServerTagBase.java index fd9d61a0bd..6ced854f13 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/ServerTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/ServerTagBase.java @@ -106,8 +106,8 @@ public void serverTag(ReplaceableTagEvent event) { // @description // Returns the amount of money, formatted according to the server's economy. // --> - if (attribute.startsWith("format") && attribute.hasContext(1)) { - double amount = attribute.getDoubleContext(1); + if (attribute.startsWith("format") && attribute.hasParam()) { + double amount = attribute.getDoubleParam(); event.setReplacedObject(new ElementTag(Depends.economy.format(amount)) .getObjectAttribute(attribute.fulfill(1))); return; @@ -120,8 +120,8 @@ public void serverTag(ReplaceableTagEvent event) { // @description // Returns the server's economy currency name (automatically singular or plural based on input value). // --> - if (attribute.startsWith("currency_name") && attribute.hasContext(1)) { - double amount = attribute.getDoubleContext(1); + if (attribute.startsWith("currency_name") && attribute.hasParam()) { + double amount = attribute.getDoubleParam(); event.setReplacedObject(new ElementTag(amount == 1 ? Depends.economy.currencyNameSingular() : Depends.economy.currencyNamePlural()) .getObjectAttribute(attribute.fulfill(1))); return; @@ -161,8 +161,8 @@ public void serverTag(ReplaceableTagEvent event) { // @description // Returns the slot ID number for an input slot (see <@link language Slot Inputs>). // --> - if (attribute.startsWith("slot_id") && attribute.hasContext(1)) { - int slotId = SlotHelper.nameToIndex(attribute.getContext(1), null); + if (attribute.startsWith("slot_id") && attribute.hasParam()) { + int slotId = SlotHelper.nameToIndex(attribute.getParam(), null); if (slotId != -1) { event.setReplacedObject(new ElementTag(slotId).getObjectAttribute(attribute.fulfill(1))); } @@ -175,10 +175,10 @@ public void serverTag(ReplaceableTagEvent event) { // @description // Returns the ItemTag resultant from parsing Bukkit item serialization data (under subkey "item"). // --> - if (attribute.startsWith("parse_bukkit_item") && attribute.hasContext(1)) { + if (attribute.startsWith("parse_bukkit_item") && attribute.hasParam()) { YamlConfiguration config = new YamlConfiguration(); try { - config.loadFromString(attribute.getContext(1)); + config.loadFromString(attribute.getParam()); ItemStack item = config.getItemStack("item"); if (item != null) { event.setReplacedObject(new ItemTag(item).getObjectAttribute(attribute.fulfill(1))); @@ -202,7 +202,7 @@ public void serverTag(ReplaceableTagEvent event) { // --> if (attribute.startsWith("recipe_ids") || attribute.startsWith("list_recipe_ids")) { listDeprecateWarn(attribute); - String type = attribute.hasContext(1) ? CoreUtilities.toLowerCase(attribute.getContext(1)) : null; + String type = attribute.hasParam() ? CoreUtilities.toLowerCase(attribute.getParam()) : null; ListTag list = new ListTag(); Iterator recipeIterator = Bukkit.recipeIterator(); while (recipeIterator.hasNext()) { @@ -225,8 +225,8 @@ public void serverTag(ReplaceableTagEvent event) { // For furnace-style recipes, this will return a list with only 1 item. // For shaped recipes, this will include 'air' for slots that are part of the shape but don't require an item. // --> - if (attribute.startsWith("recipe_items") && attribute.hasContext(1)) { - NamespacedKey key = Utilities.parseNamespacedKey(attribute.getContext(1)); + if (attribute.startsWith("recipe_items") && attribute.hasParam()) { + NamespacedKey key = Utilities.parseNamespacedKey(attribute.getParam()); Recipe recipe = NMSHandler.getItemHelper().getRecipeById(key); if (recipe == null) { return; @@ -270,8 +270,8 @@ else if (recipe instanceof CookingRecipe) { // @description // Returns the shape of a shaped recipe, like '2x2' or '3x3'. // --> - if (attribute.startsWith("recipe_shape") && attribute.hasContext(1)) { - NamespacedKey key = Utilities.parseNamespacedKey(attribute.getContext(1)); + if (attribute.startsWith("recipe_shape") && attribute.hasParam()) { + NamespacedKey key = Utilities.parseNamespacedKey(attribute.getParam()); Recipe recipe = NMSHandler.getItemHelper().getRecipeById(key); if (!(recipe instanceof ShapedRecipe)) { return; @@ -288,8 +288,8 @@ else if (recipe instanceof CookingRecipe) { // Returns the type of recipe that the given recipe ID is. // Will be one of FURNACE, BLASTING, SHAPED, SHAPELESS, SMOKING, CAMPFIRE, STONECUTTING. // --> - if (attribute.startsWith("recipe_type") && attribute.hasContext(1)) { - NamespacedKey key = Utilities.parseNamespacedKey(attribute.getContext(1)); + if (attribute.startsWith("recipe_type") && attribute.hasParam()) { + NamespacedKey key = Utilities.parseNamespacedKey(attribute.getParam()); Recipe recipe = NMSHandler.getItemHelper().getRecipeById(key); if (recipe == null) { return; @@ -304,8 +304,8 @@ else if (recipe instanceof CookingRecipe) { // @description // Returns the item that a recipe will create when crafted. // --> - if (attribute.startsWith("recipe_result") && attribute.hasContext(1)) { - NamespacedKey key = Utilities.parseNamespacedKey(attribute.getContext(1)); + if (attribute.startsWith("recipe_result") && attribute.hasParam()) { + NamespacedKey key = Utilities.parseNamespacedKey(attribute.getParam()); Recipe recipe = NMSHandler.getItemHelper().getRecipeById(key); if (recipe == null) { return; @@ -332,8 +332,8 @@ else if (recipe instanceof CookingRecipe) { if (attribute.startsWith("scoreboard")) { Scoreboard board; String name = "main"; - if (attribute.hasContext(1)) { - name = attribute.getContext(1); + if (attribute.hasParam()) { + name = attribute.getParam(); board = ScoreboardHelper.getScoreboard(name); } else { @@ -371,10 +371,10 @@ else if (recipe instanceof CookingRecipe) { event.setReplacedObject((list).getObjectAttribute(attribute.fulfill(1))); } - if (attribute.startsWith("objective") && attribute.hasContext(1)) { - Objective objective = board.getObjective(attribute.getContext(1)); + if (attribute.startsWith("objective") && attribute.hasParam()) { + Objective objective = board.getObjective(attribute.getParam()); if (objective == null) { - attribute.echoError("Scoreboard objective '" + attribute.getContext(1) + "' does not exist."); + attribute.echoError("Scoreboard objective '" + attribute.getParam() + "' does not exist."); return; } attribute = attribute.fulfill(1); @@ -432,10 +432,10 @@ else if (recipe instanceof CookingRecipe) { event.setReplacedObject(result.getObjectAttribute(attribute.fulfill(1))); } - if (attribute.startsWith("team") && attribute.hasContext(1)) { - Team team = board.getTeam(attribute.getContext(1)); + if (attribute.startsWith("team") && attribute.hasParam()) { + Team team = board.getTeam(attribute.getParam()); if (team == null) { - attribute.echoError("Scoreboard team '" + attribute.getContext(1) + "' does not exist."); + attribute.echoError("Scoreboard team '" + attribute.getParam() + "' does not exist."); return; } attribute = attribute.fulfill(1); @@ -462,7 +462,7 @@ else if (recipe instanceof CookingRecipe) { // Returns whether the object is a valid object (non-null), as well as not an ElementTag. // --> if (attribute.startsWith("object_is_valid")) { - ObjectTag o = ObjectFetcher.pickObjectFor(attribute.getContext(1), new BukkitTagContext(null, null, null, false, null)); + ObjectTag o = ObjectFetcher.pickObjectFor(attribute.getParam(), new BukkitTagContext(null, null, null, false, null)); event.setReplacedObject(new ElementTag(!(o == null || o instanceof ElementTag)).getObjectAttribute(attribute.fulfill(1))); return; } @@ -955,8 +955,8 @@ else if (recipe instanceof CookingRecipe) { Debug.echoError("list_statistics is deprecated: use statistic_types"); } Statistic.Type type = null; - if (attribute.hasContext(1)) { - type = Statistic.Type.valueOf(attribute.getContext(1).toUpperCase()); + if (attribute.hasParam()) { + type = Statistic.Type.valueOf(attribute.getParam().toUpperCase()); } ListTag statisticTypes = new ListTag(); for (Statistic stat : Statistic.values()) { @@ -994,8 +994,8 @@ else if (recipe instanceof CookingRecipe) { if (attribute.startsWith("notes") || attribute.startsWith("list_notables") || attribute.startsWith("notables")) { listDeprecateWarn(attribute); ListTag allNotables = new ListTag(); - if (attribute.hasContext(1)) { - String type = CoreUtilities.toLowerCase(attribute.getContext(1)); + if (attribute.hasParam()) { + String type = CoreUtilities.toLowerCase(attribute.getParam()); for (Map.Entry typeClass : NoteManager.namesToTypes.entrySet()) { if (type.equals(CoreUtilities.toLowerCase(typeClass.getKey()))) { for (Object notable : NoteManager.getAllType(typeClass.getValue())) { @@ -1022,33 +1022,33 @@ else if (recipe instanceof CookingRecipe) { // Returns UNTYPED, ITEM, ENTITY, or BLOCK. // Refer also to <@link tag server.statistic_types>. // --> - if (attribute.startsWith("statistic_type") && attribute.hasContext(1)) { + if (attribute.startsWith("statistic_type") && attribute.hasParam()) { Statistic statistic; try { - statistic = Statistic.valueOf(attribute.getContext(1).toUpperCase()); + statistic = Statistic.valueOf(attribute.getParam().toUpperCase()); } catch (IllegalArgumentException ex) { - attribute.echoError("Statistic '" + attribute.getContext(1) + "' does not exist: " + ex.getMessage()); + attribute.echoError("Statistic '" + attribute.getParam() + "' does not exist: " + ex.getMessage()); return; } event.setReplacedObject(new ElementTag(statistic.getType().name()).getObjectAttribute(attribute.fulfill(1))); } - if (attribute.startsWith("enchantment_max_level") && attribute.hasContext(1)) { + if (attribute.startsWith("enchantment_max_level") && attribute.hasParam()) { Deprecations.echantmentTagUpdate.warn(attribute.context); - EnchantmentTag ench = EnchantmentTag.valueOf(attribute.getContext(1), attribute.context); + EnchantmentTag ench = EnchantmentTag.valueOf(attribute.getParam(), attribute.context); if (ench == null) { - attribute.echoError("Enchantment '" + attribute.getContext(1) + "' does not exist."); + attribute.echoError("Enchantment '" + attribute.getParam() + "' does not exist."); return; } event.setReplacedObject(new ElementTag(ench.enchantment.getMaxLevel()).getObjectAttribute(attribute.fulfill(1))); } - if (attribute.startsWith("enchantment_start_level") && attribute.hasContext(1)) { + if (attribute.startsWith("enchantment_start_level") && attribute.hasParam()) { Deprecations.echantmentTagUpdate.warn(attribute.context); - EnchantmentTag ench = EnchantmentTag.valueOf(attribute.getContext(1), attribute.context); + EnchantmentTag ench = EnchantmentTag.valueOf(attribute.getParam(), attribute.context); if (ench == null) { - attribute.echoError("Enchantment '" + attribute.getContext(1) + "' does not exist."); + attribute.echoError("Enchantment '" + attribute.getParam() + "' does not exist."); return; } event.setReplacedObject(new ElementTag(ench.enchantment.getStartLevel()).getObjectAttribute(attribute.fulfill(1))); @@ -1247,10 +1247,10 @@ else if (recipe instanceof CookingRecipe) { // @description // Returns a list of NPCs with a certain name. // --> - if ((attribute.startsWith("npcs_named") || attribute.startsWith("list_npcs_named")) && Depends.citizens != null && attribute.hasContext(1)) { + if ((attribute.startsWith("npcs_named") || attribute.startsWith("list_npcs_named")) && Depends.citizens != null && attribute.hasParam()) { listDeprecateWarn(attribute); ListTag npcs = new ListTag(); - String name = attribute.getContext(1); + String name = attribute.getParam(); for (NPC npc : CitizensAPI.getNPCRegistry()) { if (CoreUtilities.equalsIgnoreCase(npc.getName(), name)) { npcs.addObject(new NPCTag(npc)); @@ -1266,8 +1266,8 @@ else if (recipe instanceof CookingRecipe) { // @description // Returns true if the specified file exists. The starting path is /plugins/Denizen. // --> - if (attribute.startsWith("has_file") && attribute.hasContext(1)) { - File f = new File(Denizen.getInstance().getDataFolder(), attribute.getContext(1)); + if (attribute.startsWith("has_file") && attribute.hasParam()) { + File f = new File(Denizen.getInstance().getDataFolder(), attribute.getParam()); try { if (!Utilities.canReadFile(f)) { Debug.echoError("Cannot read from that file path due to security settings in Denizen/config.yml."); @@ -1288,8 +1288,8 @@ else if (recipe instanceof CookingRecipe) { // @description // Returns a list of all files (and directories) in the specified directory. The starting path is /plugins/Denizen. // --> - if (attribute.startsWith("list_files") && attribute.hasContext(1)) { - File folder = new File(Denizen.getInstance().getDataFolder(), attribute.getContext(1)); + if (attribute.startsWith("list_files") && attribute.hasParam()) { + File folder = new File(Denizen.getInstance().getDataFolder(), attribute.getParam()); try { if (!Utilities.canReadFile(folder)) { Debug.echoError("Cannot read from that file path due to security settings in Denizen/config.yml."); @@ -1441,7 +1441,7 @@ else if (recipe instanceof CookingRecipe) { return; } - String group = attribute.getContext(1); + String group = attribute.getParam(); if (!Arrays.asList(Depends.permissions.getGroups()).contains(group)) { attribute.echoError("Invalid group! '" + (group != null ? group : "") + "' could not be found."); @@ -1482,7 +1482,7 @@ else if (recipe instanceof CookingRecipe) { return; } - String group = attribute.getContext(1); + String group = attribute.getParam(); if (!Arrays.asList(Depends.permissions.getGroups()).contains(group)) { attribute.echoError("Invalid group! '" + (group != null ? group : "") + "' could not be found."); @@ -1560,9 +1560,9 @@ else if (recipe instanceof CookingRecipe) { // EG, in a group of 'bo', 'bob', and 'bobby'... input 'bob' returns player object for 'bob', // input 'bobb' returns player object for 'bobby', and input 'b' returns player object for 'bo'. // --> - if (attribute.startsWith("match_player") && attribute.hasContext(1)) { + if (attribute.startsWith("match_player") && attribute.hasParam()) { Player matchPlayer = null; - String matchInput = CoreUtilities.toLowerCase(attribute.getContext(1)); + String matchInput = CoreUtilities.toLowerCase(attribute.getParam()); if (matchInput.isEmpty()) { return; } @@ -1595,9 +1595,9 @@ else if (nameLow.contains(matchInput)) { // input 'bobb' returns player object for 'bobby', and input 'b' returns player object for 'bo'. // When both an online player and an offline player match the name search, the online player will be returned. // --> - if (attribute.startsWith("match_offline_player") && attribute.hasContext(1)) { + if (attribute.startsWith("match_offline_player") && attribute.hasParam()) { PlayerTag matchPlayer = null; - String matchInput = CoreUtilities.toLowerCase(attribute.getContext(1)); + String matchInput = CoreUtilities.toLowerCase(attribute.getParam()); if (matchInput.isEmpty()) { return; } @@ -1634,9 +1634,9 @@ else if (nameLow.startsWith(matchInput) && (newMatch.isOnline() == matchPlayer.i // Returns a list of all NPCs assigned to a specified script. // --> if ((attribute.startsWith("npcs_assigned") || attribute.startsWith("list_npcs_assigned")) && Depends.citizens != null - && attribute.hasContext(1)) { + && attribute.hasParam()) { listDeprecateWarn(attribute); - ScriptTag script = attribute.contextAsType(1, ScriptTag.class); + ScriptTag script = attribute.paramAsType(ScriptTag.class); if (script == null || !(script.getContainer() instanceof AssignmentScriptContainer)) { attribute.echoError("Invalid script specified."); } @@ -1660,9 +1660,9 @@ else if (nameLow.startsWith(matchInput) && (newMatch.isOnline() == matchPlayer.i // Returns a list of all online players with a specified flag set. // --> if ((attribute.startsWith("online_players_flagged") || attribute.startsWith("list_online_players_flagged")) - && attribute.hasContext(1)) { + && attribute.hasParam()) { listDeprecateWarn(attribute); - String flag = attribute.getContext(1); + String flag = attribute.getParam(); ListTag players = new ListTag(); for (Player player : Bukkit.getOnlinePlayers()) { PlayerTag plTag = new PlayerTag(player); @@ -1682,9 +1682,9 @@ else if (nameLow.startsWith(matchInput) && (newMatch.isOnline() == matchPlayer.i // Warning: this will cause the player flag cache to temporarily fill with ALL historical playerdata. // --> if ((attribute.startsWith("players_flagged") || attribute.startsWith("list_players_flagged")) - && attribute.hasContext(1)) { + && attribute.hasParam()) { listDeprecateWarn(attribute); - String flag = attribute.getContext(1); + String flag = attribute.getParam(); ListTag players = new ListTag(); for (Map.Entry entry : PlayerTag.getAllPlayers().entrySet()) { PlayerTag plTag = new PlayerTag(entry.getValue()); @@ -1703,9 +1703,9 @@ else if (nameLow.startsWith(matchInput) && (newMatch.isOnline() == matchPlayer.i // Returns a list of all spawned NPCs with a specified flag set. // --> if ((attribute.startsWith("spawned_npcs_flagged") || attribute.startsWith("list_spawned_npcs_flagged")) && Depends.citizens != null - && attribute.hasContext(1)) { + && attribute.hasParam()) { listDeprecateWarn(attribute); - String flag = attribute.getContext(1); + String flag = attribute.getParam(); ListTag npcs = new ListTag(); for (NPC npc : CitizensAPI.getNPCRegistry()) { NPCTag dNpc = new NPCTag(npc); @@ -1724,9 +1724,9 @@ else if (nameLow.startsWith(matchInput) && (newMatch.isOnline() == matchPlayer.i // Returns a list of all NPCs with a specified flag set. // --> if ((attribute.startsWith("npcs_flagged") || attribute.startsWith("list_npcs_flagged")) && Depends.citizens != null - && attribute.hasContext(1)) { + && attribute.hasParam()) { listDeprecateWarn(attribute); - String flag = attribute.getContext(1); + String flag = attribute.getParam(); ListTag npcs = new ListTag(); for (NPC npc : CitizensAPI.getNPCRegistry()) { NPCTag dNpc = new NPCTag(npc); @@ -1763,10 +1763,10 @@ else if (nameLow.startsWith(matchInput) && (newMatch.isOnline() == matchPlayer.i listDeprecateWarn(attribute); ListTag npcs = new ListTag(); NPCRegistry registry = CitizensAPI.getNPCRegistry(); - if (attribute.hasContext(1)) { - registry = NPCTag.getRegistryByName(attribute.getContext(1)); + if (attribute.hasParam()) { + registry = NPCTag.getRegistryByName(attribute.getParam()); if (registry == null) { - attribute.echoError("NPC Registry '" + attribute.getContext(1) + "' does not exist."); + attribute.echoError("NPC Registry '" + attribute.getParam() + "' does not exist."); return; } } @@ -1896,9 +1896,9 @@ else if (nameLow.startsWith(matchInput) && (newMatch.isOnline() == matchPlayer.i // @description // Returns whether the given ip address is banned. // --> - if (attribute.startsWith("is_banned") && attribute.hasContext(1)) { + if (attribute.startsWith("is_banned") && attribute.hasParam()) { // BanList contains an isBanned method that doesn't check expiration time - BanEntry ban = Bukkit.getBanList(BanList.Type.IP).getBanEntry(attribute.getContext(1)); + BanEntry ban = Bukkit.getBanList(BanList.Type.IP).getBanEntry(attribute.getParam()); if (ban == null) { event.setReplacedObject(new ElementTag(false).getObjectAttribute(attribute.fulfill(1))); @@ -1913,8 +1913,8 @@ else if (ban.getExpiration() == null) { return; } - if (attribute.startsWith("ban_info") && attribute.hasContext(1)) { - BanEntry ban = Bukkit.getBanList(BanList.Type.IP).getBanEntry(attribute.getContext(1)); + if (attribute.startsWith("ban_info") && attribute.hasParam()) { + BanEntry ban = Bukkit.getBanList(BanList.Type.IP).getBanEntry(attribute.getParam()); attribute.fulfill(1); if (ban == null || (ban.getExpiration() != null && ban.getExpiration().before(new Date()))) { return; @@ -2052,22 +2052,22 @@ else if (attribute.startsWith("source")) { return; } else if (attribute.startsWith("entity_is_spawned") - && attribute.hasContext(1)) { + && attribute.hasParam()) { Deprecations.isValidTag.warn(attribute.context); - EntityTag ent = EntityTag.valueOf(attribute.getContext(1), new BukkitTagContext(null, null, null, false, null)); + EntityTag ent = EntityTag.valueOf(attribute.getParam(), new BukkitTagContext(null, null, null, false, null)); event.setReplacedObject(new ElementTag((ent != null && ent.isUnique() && ent.isSpawnedOrValidForTag()) ? "true" : "false") .getObjectAttribute(attribute.fulfill(1))); } else if (attribute.startsWith("player_is_valid") - && attribute.hasContext(1)) { + && attribute.hasParam()) { Deprecations.isValidTag.warn(attribute.context); - event.setReplacedObject(new ElementTag(PlayerTag.playerNameIsValid(attribute.getContext(1))) + event.setReplacedObject(new ElementTag(PlayerTag.playerNameIsValid(attribute.getParam())) .getObjectAttribute(attribute.fulfill(1))); } else if (attribute.startsWith("npc_is_valid") - && attribute.hasContext(1)) { + && attribute.hasParam()) { Deprecations.isValidTag.warn(attribute.context); - NPCTag npc = NPCTag.valueOf(attribute.getContext(1), new BukkitTagContext(null, null, null, false, null)); + NPCTag npc = NPCTag.valueOf(attribute.getParam(), new BukkitTagContext(null, null, null, false, null)); event.setReplacedObject(new ElementTag((npc != null && npc.isValid())) .getObjectAttribute(attribute.fulfill(1))); } @@ -2089,8 +2089,8 @@ else if (attribute.startsWith("current_bossbars")) { // @description // Returns a list of players that should be able to see the given bossbar ID from <@link command bossbar>. // --> - else if (attribute.startsWith("bossbar_viewers") && attribute.hasContext(1)) { - BossBar bar = BossBarCommand.bossBarMap.get(CoreUtilities.toLowerCase(attribute.getContext(1))); + else if (attribute.startsWith("bossbar_viewers") && attribute.hasParam()) { + BossBar bar = BossBarCommand.bossBarMap.get(CoreUtilities.toLowerCase(attribute.getParam())); if (bar != null) { ListTag list = new ListTag(); for (Player player : bar.getPlayers()) { @@ -2173,10 +2173,10 @@ else if (attribute.startsWith("vanilla_tags")) { // Returns a list of materials referred to by the specified vanilla tag. See also <@link url https://minecraft.fandom.com/wiki/Tag>. // --> else if (attribute.startsWith("vanilla_tagged_materials")) { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return; } - HashSet materials = VanillaTagHelper.tagsByKey.get(CoreUtilities.toLowerCase(attribute.getContext(1))); + HashSet materials = VanillaTagHelper.tagsByKey.get(CoreUtilities.toLowerCase(attribute.getParam())); if (materials == null) { return; } @@ -2195,9 +2195,9 @@ else if (attribute.startsWith("vanilla_tagged_materials")) { // Can specify by ScriptEvent name ("PlayerBreaksBlock"), or by full Bukkit class name ("org.bukkit.event.block.BlockBreakEvent"). // This is a primarily a dev tool and is not necessarily useful to most players or scripts. // --> - else if ((attribute.matches("plugins_handling_event") || attribute.matches("list_plugins_handling_event")) && attribute.hasContext(1)) { + else if ((attribute.matches("plugins_handling_event") || attribute.matches("list_plugins_handling_event")) && attribute.hasParam()) { listDeprecateWarn(attribute); - String eventName = attribute.getContext(1); + String eventName = attribute.getParam(); if (CoreUtilities.contains(eventName, '.')) { try { Class clazz = Class.forName(eventName, false, ServerTagBase.class.getClassLoader()); @@ -2247,8 +2247,8 @@ else if ((attribute.matches("plugins_handling_event") || attribute.matches("list // // For example: ;location=]> // --> - else if (attribute.startsWith("generate_loot_table") && attribute.hasContext(1)) { - MapTag map = attribute.contextAsType(1, MapTag.class); + else if (attribute.startsWith("generate_loot_table") && attribute.hasParam()) { + MapTag map = attribute.paramAsType(MapTag.class); ObjectTag idObj = map.getObject("id"); ObjectTag locationObj = map.getObject("location"); if (idObj == null || locationObj == null) { diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java index a13bbc85aa..08a341e2dd 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java @@ -226,7 +226,7 @@ else if (lower.equals("&hrt")) { // @description // Returns the Unicode character specified. e.g. <&chr[2665]> returns a heart. // --> - TagManager.registerStaticTagBaseHandler(ElementTag.class, "&chr", (attribute) -> new ElementTag(String.valueOf((char) Integer.parseInt(attribute.getContext(1), 16)))); + TagManager.registerStaticTagBaseHandler(ElementTag.class, "&chr", (attribute) -> new ElementTag(String.valueOf((char) Integer.parseInt(attribute.getParam(), 16)))); // <--[tag] // @attribute @@ -254,10 +254,10 @@ else if (lower.equals("&hrt")) { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> TagManager.registerTagHandler(ElementTag.class, "&hover", (attribute) -> { // Cannot be static due to hacked sub-tag - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String hoverText = attribute.getContext(1); + String hoverText = attribute.getParam(); // <--[tag] // @attribute <&hover[].type[]> @@ -290,10 +290,10 @@ else if (lower.equals("&hrt")) { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> TagManager.registerTagHandler(ElementTag.class, "&click", (attribute) -> { // Cannot be static due to hacked sub-tag - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String clickText = attribute.getContext(1); + String clickText = attribute.getParam(); // <--[tag] // @attribute <&click[].type[]> @@ -323,10 +323,10 @@ else if (lower.equals("&hrt")) { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> TagManager.registerStaticTagBaseHandler(ElementTag.class, "&insertion", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String insertText = attribute.getContext(1); + String insertText = attribute.getParam(); return new ElementTag(ChatColor.COLOR_CHAR + "[insertion=" + FormattedTextHelper.escape(insertText) + "]"); }); @@ -372,10 +372,10 @@ else if (lower.equals("&hrt")) { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> TagManager.registerStaticTagBaseHandler(ElementTag.class, "&keybind", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String keybindText = attribute.getContext(1); + String keybindText = attribute.getParam(); return new ElementTag(ChatColor.COLOR_CHAR + "[keybind=" + FormattedTextHelper.escape(keybindText) + "]"); }); @@ -387,10 +387,10 @@ else if (lower.equals("&hrt")) { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> TagManager.registerStaticTagBaseHandler(ElementTag.class, "&selector", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String selectorText = attribute.getContext(1); + String selectorText = attribute.getParam(); return new ElementTag(ChatColor.COLOR_CHAR + "[selector=" + FormattedTextHelper.escape(selectorText) + "]"); }); @@ -404,10 +404,10 @@ else if (lower.equals("&hrt")) { // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> TagManager.registerTagHandler(ElementTag.class, "&translate", (attribute) -> { // Cannot be static due to hacked sub-tag - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String translateText = attribute.getContext(1); + String translateText = attribute.getParam(); // <--[tag] // @attribute <&translate[].with[|...]> @@ -441,10 +441,10 @@ else if (lower.equals("&hrt")) { // // --> TagManager.registerStaticTagBaseHandler(ElementTag.class, "&score", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - ListTag scoreList = attribute.contextAsType(1, ListTag.class); + ListTag scoreList = attribute.paramAsType(ListTag.class); if (scoreList.size() < 2) { return null; } @@ -463,10 +463,10 @@ else if (lower.equals("&hrt")) { // The ColorTag input option can be used for dynamic color effects, such as automatic rainbows. // --> TagManager.registerStaticTagBaseHandler(ElementTag.class, "&color", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - String colorName = attribute.getContext(1); + String colorName = attribute.getParam(); String colorOut = null; if (colorName.length() == 1) { ChatColor color = ChatColor.getByChar(colorName.charAt(0)); @@ -504,10 +504,10 @@ else if (colorName.startsWith("co@") || colorName.lastIndexOf(',') > colorName.i // Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>. // --> TagManager.registerStaticTagBaseHandler(ElementTag.class, "&font", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { return null; } - return new ElementTag(ChatColor.COLOR_CHAR + "[font=" + attribute.getContext(1) + "]"); + return new ElementTag(ChatColor.COLOR_CHAR + "[font=" + attribute.getParam() + "]"); }); // <--[tag] diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/TradeTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/TradeTagBase.java index 856dd078ce..238ec7fd9c 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/TradeTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/TradeTagBase.java @@ -15,11 +15,11 @@ public TradeTagBase() { // Refer to <@link objecttype TradeTag>. // --> TagManager.registerStaticTagBaseHandler(TradeTag.class, "trade", (attribute) -> { - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("Trade tag base must have input."); return null; } - return TradeTag.valueOf(attribute.getContext(1), attribute.context); + return TradeTag.valueOf(attribute.getParam(), attribute.context); }); } } diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/WorldTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/WorldTagBase.java index e12d5b5658..4254ae32e5 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/WorldTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/WorldTagBase.java @@ -15,11 +15,11 @@ public WorldTagBase() { // Refer to <@link objecttype WorldTag>. // --> TagManager.registerTagHandler(WorldTag.class, "world", (attribute) -> { // non-static as worlds can be dynamically loaded - if (!attribute.hasContext(1)) { + if (!attribute.hasParam()) { attribute.echoError("World tag base must have input."); return null; } - return WorldTag.valueOf(attribute.getContext(1), attribute.context); + return WorldTag.valueOf(attribute.getParam(), attribute.context); }); } }