From 2c2314e95cc4c9a3ffb94ffd504ccbe434d3ca7b Mon Sep 17 00:00:00 2001 From: Bernhard Date: Wed, 25 May 2022 10:18:10 +0200 Subject: [PATCH] refactor: return `info.server` for `%plotsquared_currentplot_owner%` if plot is a server plot (#3640) --- .../core/util/placeholders/PlaceholderRegistry.java | 4 ++++ 1 file changed, 4 insertions(+) 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 f832061f5..8d6341cf9 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 @@ -38,6 +38,7 @@ import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.flag.GlobalFlagContainer; import com.plotsquared.core.plot.flag.PlotFlag; +import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.PlayerManager; import net.kyori.adventure.text.Component; @@ -110,6 +111,9 @@ public final class PlaceholderRegistry { return plot.getAlias(); }); this.createPlaceholder("currentplot_owner", (player, plot) -> { + if (plot.getFlag(ServerPlotFlag.class)){ + return legacyComponent(TranslatableCaption.of("info.server"), player); + } final UUID plotOwner = plot.getOwnerAbs(); if (plotOwner == null) { return legacyComponent(TranslatableCaption.of("generic.generic_unowned"), player);