From e5a4026a2a733248671bd056c8f26718b9644311 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 30 Sep 2023 16:39:01 +0100 Subject: [PATCH] feat: add placeholder for plot size - PlaceholderRegistry and for /plot list entries - fixes #4149 --- Core/src/main/java/com/plotsquared/core/command/ListCmd.java | 1 + .../plotsquared/core/util/placeholders/PlaceholderRegistry.java | 1 + 2 files changed, 2 insertions(+) diff --git a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java index 5ba5d1a00..de7378c2d 100644 --- a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java +++ b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java @@ -517,6 +517,7 @@ public class ListCmd extends SubCommand { } } finalResolver.tag("players", Tag.inserting(builder.asComponent())); + finalResolver.tag("size", Tag.inserting(Component.text(plot.getConnectedPlots().size()))); caption.set(TranslatableCaption.of("info.plot_list_item")); caption.setTagResolvers(finalResolver.build()); } diff --git a/Core/src/main/java/com/plotsquared/core/util/placeholders/PlaceholderRegistry.java b/Core/src/main/java/com/plotsquared/core/util/placeholders/PlaceholderRegistry.java index ed62b8799..cf079156e 100644 --- a/Core/src/main/java/com/plotsquared/core/util/placeholders/PlaceholderRegistry.java +++ b/Core/src/main/java/com/plotsquared/core/util/placeholders/PlaceholderRegistry.java @@ -187,6 +187,7 @@ public final class PlaceholderRegistry { } }); this.createPlaceholder("currentplot_biome", (player, plot) -> plot.getBiomeSynchronous().toString()); + this.createPlaceholder("currentplot_size", (player, plot) -> String.valueOf(plot.getConnectedPlots().size())); } /**