Skip to content

Commit

Permalink
name update to match core
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 29, 2021
1 parent 7af1875 commit 3c6a4a1
Show file tree
Hide file tree
Showing 49 changed files with 525 additions and 525 deletions.
Expand Up @@ -139,7 +139,7 @@ static <T extends AreaContainmentObject> void registerTags(Class<T> 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())) {
Expand Down Expand Up @@ -176,10 +176,10 @@ static <T extends AreaContainmentObject> void registerTags(Class<T> 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;
}
Expand All @@ -194,10 +194,10 @@ static <T extends AreaContainmentObject> void registerTags(Class<T> 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<Location> predicate = (l) -> BukkitScriptEvent.tryMaterial(l.getBlock().getType(), matcher);
return area.getBlocks(predicate);
}
Expand All @@ -218,8 +218,8 @@ static <T extends AreaContainmentObject> void registerTags(Class<T> 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<Location> predicate = (l) -> isSpawnable(l) && BukkitScriptEvent.tryMaterial(l.getBlock().getRelative(0, -1, 0).getType(), matcher);
return area.getBlocks(predicate);
}
Expand All @@ -238,10 +238,10 @@ static <T extends AreaContainmentObject> void registerTags(Class<T> 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]
Expand All @@ -261,10 +261,10 @@ static <T extends AreaContainmentObject> void registerTags(Class<T> 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;
}
Expand Down Expand Up @@ -304,10 +304,10 @@ static <T extends AreaContainmentObject> void registerTags(Class<T> 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;
}
Expand Down
Expand Up @@ -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();
Expand Down
Expand Up @@ -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<String> coords = CoreUtilities.split(attribute.getContext(1), ',');
List<String> coords = CoreUtilities.split(attribute.getParam(), ',');
if (coords.size() < 2) {
attribute.echoError("The tag ChunkTag.add[<#>,<#>] requires two values!");
return null;
Expand All @@ -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<String> coords = CoreUtilities.split(attribute.getContext(1), ',');
List<String> coords = CoreUtilities.split(attribute.getParam(), ',');
if (coords.size() < 2) {
attribute.echoError("The tag ChunkTag.sub[<#>,<#>] requires two values!");
return null;
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -615,15 +615,15 @@ 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;
}
Chunk chunk = object.getChunkForTag(attribute);
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));
Expand Down
Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand All @@ -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);
});

Expand All @@ -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);
});

Expand All @@ -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);
});

Expand All @@ -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;
}
});
Expand Down

0 comments on commit 3c6a4a1

Please sign in to comment.