Skip to content

Commit

Permalink
update some old 'list_' style tags and also meta improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 14, 2020
1 parent 1bb8603 commit 9cbeb12
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
Expand Up @@ -469,6 +469,7 @@ public void run() {
@Override
public void run() {
Debug.outputThisTick = 0;
Debug.errorDuplicatePrevention = false;
DenizenCore.tick(50); // Sadly, minecraft has no delta timing, so a tick is always 50ms.
}
}, 1, 1);
Expand Down
Expand Up @@ -378,7 +378,7 @@ public static void registerTags() {
});

// <--[tag]
// @attribute <ChunkTag.entities[<entity>|...]>
// @attribute <ChunkTag.entities[(<entity>|...)]>
// @returns ListTag(EntityTag)
// @description
// Returns a list of entities in the chunk.
Expand Down
Expand Up @@ -1349,29 +1349,29 @@ public static void registerTags() {
});

// <--[tag]
// @attribute <CuboidTag.list_players>
// @attribute <CuboidTag.players>
// @returns ListTag(PlayerTag)
// @description
// Gets a list of all players currently within the CuboidTag.
// -->
registerTag("list_players", (attribute, cuboid) -> {
registerTag("players", (attribute, cuboid) -> {
ArrayList<PlayerTag> players = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers()) {
if (cuboid.isInsideCuboid(player.getLocation())) {
players.add(PlayerTag.mirrorBukkitPlayer(player));
}
}
return new ListTag(players);
});
}, "list_players");

// <--[tag]
// @attribute <CuboidTag.list_npcs>
// @attribute <CuboidTag.npcs>
// @returns ListTag(NPCTag)
// @description
// Gets a list of all NPCs currently within the CuboidTag.
// -->
if (Depends.citizens != null) {
registerTag("list_npcs", (attribute, cuboid) -> {
registerTag("_npcs", (attribute, cuboid) -> {
ArrayList<NPCTag> npcs = new ArrayList<>();
for (NPC npc : CitizensAPI.getNPCRegistry()) {
NPCTag dnpc = NPCTag.mirrorCitizensNPC(npc);
Expand All @@ -1380,17 +1380,17 @@ public static void registerTags() {
}
}
return new ListTag(npcs);
});
}, "list_npcs");
}

// <--[tag]
// @attribute <CuboidTag.list_entities[<entity>|...]>
// @attribute <CuboidTag.entities[(<entity>|...)]>
// @returns ListTag(EntityTag)
// @description
// Gets a list of all entities currently within the CuboidTag, with
// an optional search parameter for the entity type.
// -->
registerTag("list_entities", (attribute, cuboid) -> {
registerTag("entities", (attribute, cuboid) -> {
ArrayList<EntityTag> entities = new ArrayList<>();
ListTag types = new ListTag();
if (attribute.hasContext(1)) {
Expand All @@ -1413,32 +1413,32 @@ public static void registerTags() {
}
}
return new ListTag(entities);
});
}, "list_entities");

// <--[tag]
// @attribute <CuboidTag.list_living_entities>
// @attribute <CuboidTag.living_entities>
// @returns ListTag(EntityTag)
// @description
// Gets a list of all living entities currently within the CuboidTag.
// This includes Players, mobs, NPCs, etc., but excludes dropped items, experience orbs, etc.
// -->
registerTag("list_living_entities", (attribute, cuboid) -> {
registerTag("living_entities", (attribute, cuboid) -> {
ArrayList<EntityTag> entities = new ArrayList<>();
for (Entity ent : cuboid.getWorld().getLivingEntities()) {
if (cuboid.isInsideCuboid(ent.getLocation()) && !EntityTag.isCitizensNPC(ent)) {
entities.add(new EntityTag(ent));
}
}
return new ListTag(entities);
});
}, "list_living_entities");

// <--[tag]
// @attribute <CuboidTag.list_chunks>
// @attribute <CuboidTag.chunks>
// @returns ListTag(ChunkTag)
// @description
// Gets a list of all chunks entirely within the CuboidTag (ignoring the Y axis).
// -->
registerTag("list_chunks", (attribute, cuboid) -> {
registerTag("chunks", (attribute, cuboid) -> {
ListTag chunks = new ListTag();
for (LocationPair pair : cuboid.pairs) {
int minY = pair.low.getBlockY();
Expand All @@ -1463,15 +1463,15 @@ public static void registerTags() {
}
}
return chunks.deduplicate();
});
}, "list_chunks");

// <--[tag]
// @attribute <CuboidTag.list_partial_chunks>
// @attribute <CuboidTag.partial_chunks>
// @returns ListTag(ChunkTag)
// @description
// Gets a list of all chunks partially or entirely within the CuboidTag.
// -->
registerTag("list_partial_chunks", (attribute, cuboid) -> {
registerTag("partial_chunks", (attribute, cuboid) -> {
ListTag chunks = new ListTag();
for (LocationPair pair : cuboid.pairs) {
ChunkTag minChunk = new ChunkTag(pair.low);
Expand All @@ -1483,7 +1483,7 @@ public static void registerTags() {
}
}
return chunks;
});
}, "list_partial_chunks");

// <--[tag]
// @attribute <CuboidTag.notable_name>
Expand Down
Expand Up @@ -1978,7 +1978,7 @@ else if (yaw < 315) {
double radius = attribute.getDoubleContext(3);

// <--[tag]
// @attribute <LocationTag.find.blocks[<block>|...].within[<#>]>
// @attribute <LocationTag.find.blocks[(<material>|...)].within[<#>]>
// @returns ListTag
// @description
// Returns a list of matching blocks within a radius.
Expand Down Expand Up @@ -2048,7 +2048,7 @@ public int compare(LocationTag loc1, LocationTag loc2) {
}

// <--[tag]
// @attribute <LocationTag.find.surface_blocks[<block>|...].within[<#.#>]>
// @attribute <LocationTag.find.surface_blocks[(<material>|...)].within[<#.#>]>
// @returns ListTag
// @description
// Returns a list of matching surface blocks within a radius.
Expand Down Expand Up @@ -2167,7 +2167,7 @@ public int compare(NPCTag npc1, NPCTag npc2) {
}

// <--[tag]
// @attribute <LocationTag.find.entities[<entity>|...].within[<#.#>]>
// @attribute <LocationTag.find.entities[(<entity>|...)].within[<#.#>]>
// @returns ListTag
// @description
// Returns a list of entities within a radius, with an optional search parameter for the entity type.
Expand Down
Expand Up @@ -218,7 +218,7 @@ public static void registerTags() {
/////////////////

// <--[tag]
// @attribute <WorldTag.entities[<entity>|...]>
// @attribute <WorldTag.entities[(<entity>|...)]>
// @returns ListTag(EntityTag)
// @description
// Returns a list of entities in this world.
Expand Down

0 comments on commit 9cbeb12

Please sign in to comment.