From 26c55a318fac673f629faef3f0e7379893ced0d5 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 2 Oct 2023 20:37:00 +0100 Subject: [PATCH] feat: add placeholder for plot size (#4181) --- 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())); } /**