From 9de1ea82324e61baed1ea00d5a562783db36ca7c Mon Sep 17 00:00:00 2001 From: SirYwell Date: Sat, 10 Feb 2024 18:50:37 +0100 Subject: [PATCH] add world-specific variant --- .../bukkit/placeholder/PAPIPlaceholders.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/PAPIPlaceholders.java b/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/PAPIPlaceholders.java index 5274961a6..2e8a03f3f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/PAPIPlaceholders.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/PAPIPlaceholders.java @@ -20,6 +20,8 @@ package com.plotsquared.bukkit.placeholder; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.flag.implementations.DoneFlag; +import com.plotsquared.core.util.query.PlotQuery; import me.clip.placeholderapi.PlaceholderAPIPlugin; import me.clip.placeholderapi.expansion.PlaceholderExpansion; import org.bukkit.entity.Player; @@ -83,6 +85,20 @@ public class PAPIPlaceholders extends PlaceholderExpansion { return String.valueOf(pl.getPlotCount(identifier)); } + if (identifier.startsWith("base_plot_count_")) { + identifier = identifier.substring("base_plot_count_".length()); + if (identifier.isEmpty()) { + return ""; + } + + return String.valueOf(PlotQuery.newQuery() + .ownedBy(pl) + .inWorld(identifier) + .whereBasePlot() + .thatPasses(plot -> !DoneFlag.isDone(plot)) + .count()); + } + // PlotSquared placeholders return PlotSquared.platform().placeholderRegistry().getPlaceholderValue(identifier, pl); }