implements CommandCaller, OfflinePlotPlayer,
Collections.synchronizedSet(new HashSet<>());
private static final Map converters = new HashMap<>();
+ private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
private final LockRepository lockRepository = new LockRepository();
private final PlotAreaManager plotAreaManager;
private final EventDispatcher eventDispatcher;
@@ -866,9 +868,9 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer,
final int fadeIn, final int stay, final int fadeOut,
final @NonNull Template... replacements
) {
- final Component titleComponent = MiniMessage.get().parse(title.getComponent(this), replacements);
+ final Component titleComponent = MINI_MESSAGE.deserialize(title.getComponent(this), TemplateResolver.templates(replacements));
final Component subtitleComponent =
- MiniMessage.get().parse(subtitle.getComponent(this), replacements);
+ MINI_MESSAGE.deserialize(subtitle.getComponent(this), TemplateResolver.templates(replacements));
final Title.Times times = Title.Times.of(
Duration.of(Settings.Titles.TITLES_FADE_IN * 50L, ChronoUnit.MILLIS),
Duration.of(Settings.Titles.TITLES_STAY * 50L, ChronoUnit.MILLIS),
@@ -906,7 +908,7 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer,
.replace("", TranslatableCaption.of("core.prefix").getComponent(this));
- final Component component = MiniMessage.get().parse(message, replacements);
+ final Component component = MINI_MESSAGE.deserialize(message, TemplateResolver.templates(replacements));
getAudience().sendActionBar(component);
}
@@ -932,7 +934,7 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer,
.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&')
.replace("", TranslatableCaption.of("core.prefix").getComponent(this));
// Parse the message
- final Component component = MiniMessage.get().parse(message, replacements);
+ final Component component = MINI_MESSAGE.deserialize(message, TemplateResolver.templates(replacements));
if (!Objects.equal(component, this.getMeta("lastMessage"))
|| System.currentTimeMillis() - this.getMeta("lastMessageTime") > 5000) {
setMeta("lastMessage", component);
diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java
index db5e58e4b..1aa7765f8 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java
@@ -40,7 +40,6 @@ import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.Result;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.generator.ClassicPlotWorld;
-import com.plotsquared.core.generator.HybridPlotWorld;
import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.location.BlockLoc;
import com.plotsquared.core.location.Direction;
@@ -80,6 +79,7 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.minimessage.template.TemplateResolver;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
@@ -449,7 +449,7 @@ public class Plot {
* that could alter the de facto owner of the plot.
*
* @return The plot owner of this particular (sub-)plot
- * as stored in the database, if one exists. Else, null.
+ * as stored in the database, if one exists. Else, null.
*/
public @Nullable UUID getOwnerAbs() {
return this.owner;
@@ -1201,12 +1201,12 @@ public class Plot {
*
* @return array of entity counts
* @see RegionManager#countEntities(Plot)
- * 0 = Entity
- * 1 = Animal
- * 2 = Monster
- * 3 = Mob
- * 4 = Boat
- * 5 = Misc
+ * 0 = Entity
+ * 1 = Animal
+ * 2 = Monster
+ * 3 = Mob
+ * 4 = Boat
+ * 5 = Misc
*/
public int[] countEntities() {
int[] count = new int[6];
@@ -1564,7 +1564,7 @@ public class Plot {
x = bot.getX() + loc.getX();
z = bot.getZ() + loc.getZ();
}
- if (loc.getY() == Integer.MIN_VALUE) {
+ if (loc.getY() == Integer.MIN_VALUE) {
if (isLoaded()) {
this.worldUtil.getHighestBlock(
plot.getWorldName(),
@@ -1707,7 +1707,7 @@ public class Plot {
updateWorldBorder();
}
this.getPlotModificationManager().setSign(player.getName());
- player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("plot", this.getId().toString()));
+ player.sendMessage(TranslatableCaption.of("working.claimed"), Template.template("plot", this.getId().toString()));
if (teleport) {
if (!auto && Settings.Teleport.ON_CLAIM) {
teleportPlayer(player, TeleportCause.COMMAND_CLAIM, result -> {
@@ -2575,8 +2575,8 @@ public class Plot {
return;
}
Caption caption = TranslatableCaption.of("debug.plot_debug");
- Template plotTemplate = Template.of("plot", this.toString());
- Template messageTemplate = Template.of("message", message);
+ Template plotTemplate = Template.template("plot", this.toString());
+ Template messageTemplate = Template.template("message", message);
for (final PlotPlayer> player : players) {
if (isOwner(player.getUUID()) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_DEBUG_OTHER)) {
player.sendMessage(caption, plotTemplate, messageTemplate);
@@ -2609,7 +2609,7 @@ public class Plot {
if (result == Result.DENY) {
player.sendMessage(
TranslatableCaption.of("events.event_denied"),
- Template.of("value", "Teleport")
+ Template.template("value", "Teleport")
);
resultConsumer.accept(false);
return;
@@ -2624,7 +2624,7 @@ public class Plot {
}
player.sendMessage(
TranslatableCaption.of("teleport.teleport_in_seconds"),
- Template.of("amount", String.valueOf(Settings.Teleport.DELAY))
+ Template.template("amount", String.valueOf(Settings.Teleport.DELAY))
);
final String name = player.getName();
TaskManager.addToTeleportQueue(name);
@@ -2845,13 +2845,12 @@ public class Plot {
} else {
value = flag.toString();
}
- Component snip = MINI_MESSAGE.parse(
+ Component snip = MINI_MESSAGE.deserialize(
prefix + CaptionUtility.format(
player,
- TranslatableCaption.of("info.plot_flag_list").getComponent(player)
- ),
- Template.of("flag", flag.getName()),
- Template.of("value", CaptionUtility.formatRaw(player, value.toString()))
+ TranslatableCaption.of("info.plot_flag_list").getComponent(player)),
+ TemplateResolver.templates(Template.template("flag", flag.getName()),
+ Template.template("value", CaptionUtility.formatRaw(player, value.toString())))
);
flagBuilder.append(snip);
prefix = ", ";
@@ -2869,51 +2868,51 @@ public class Plot {
} else {
owner = PlayerManager.getPlayerList(this.getOwners(), player);
}
- Template headerTemplate = Template.of(
+ Template headerTemplate = Template.template(
"header",
TranslatableCaption.of("info.plot_info_header").getComponent(player)
);
- Template footerTemplate = Template.of(
+ Template footerTemplate = Template.template(
"footer",
TranslatableCaption.of("info.plot_info_footer").getComponent(player)
);
Template areaTemplate;
if (this.getArea() != null) {
areaTemplate =
- Template.of(
+ Template.template(
"area",
this.getArea().getWorldName() + (this.getArea().getId() == null
? ""
: "(" + this.getArea().getId() + ")")
);
} else {
- areaTemplate = Template.of("area", TranslatableCaption.of("info.none").getComponent(player));
+ areaTemplate = Template.template("area", TranslatableCaption.of("info.none").getComponent(player));
}
long creationDate = Long.parseLong(String.valueOf(timestamp));
SimpleDateFormat sdf = new SimpleDateFormat(Settings.Timeformat.DATE_FORMAT);
sdf.setTimeZone(TimeZone.getTimeZone(Settings.Timeformat.TIME_ZONE));
String newDate = sdf.format(creationDate);
- Template idTemplate = Template.of("id", this.getId().toString());
- Template aliasTemplate = Template.of("alias", alias);
- Template numTemplate = Template.of("num", String.valueOf(num));
- Template descTemplate = Template.of("desc", description);
- Template biomeTemplate = Template.of("biome", biome.toString().toLowerCase());
- Template ownerTemplate = Template.of("owner", owner);
- Template membersTemplate = Template.of("members", members);
- Template playerTemplate = Template.of("player", player.getName());
- Template trustedTemplate = Template.of("trusted", trusted);
- Template helpersTemplate = Template.of("helpers", members);
- Template deniedTemplate = Template.of("denied", denied);
- Template seenTemplate = Template.of("seen", seen);
- Template flagsTemplate = Template.of("flags", flags);
- Template creationTemplate = Template.of("creationdate", newDate);
- Template buildTemplate = Template.of("build", String.valueOf(build));
+ Template idTemplate = Template.template("id", this.getId().toString());
+ Template aliasTemplate = Template.template("alias", alias);
+ Template numTemplate = Template.template("num", String.valueOf(num));
+ Template descTemplate = Template.template("desc", description);
+ Template biomeTemplate = Template.template("biome", biome.toString().toLowerCase());
+ Template ownerTemplate = Template.template("owner", owner);
+ Template membersTemplate = Template.template("members", members);
+ Template playerTemplate = Template.template("player", player.getName());
+ Template trustedTemplate = Template.template("trusted", trusted);
+ Template helpersTemplate = Template.template("helpers", members);
+ Template deniedTemplate = Template.template("denied", denied);
+ Template seenTemplate = Template.template("seen", seen);
+ Template flagsTemplate = Template.template("flags", flags);
+ Template creationTemplate = Template.template("creationdate", newDate);
+ Template buildTemplate = Template.template("build", String.valueOf(build));
if (iInfo.getComponent(player).contains("")) {
TaskManager.runTaskAsync(() -> {
Template ratingTemplate;
if (Settings.Ratings.USE_LIKES) {
- ratingTemplate = Template.of(
+ ratingTemplate = Template.template(
"rating",
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
);
@@ -2931,13 +2930,13 @@ public class Plot {
.append(String.format("%.1f", ratings[i]));
prefix = ",";
}
- ratingTemplate = Template.of("rating", rating.toString());
+ ratingTemplate = Template.template("rating", rating.toString());
} else {
double rating = this.getAverageRating();
if (Double.isFinite(rating)) {
- ratingTemplate = Template.of("rating", String.format("%.1f", rating) + '/' + max);
+ ratingTemplate = Template.template("rating", String.format("%.1f", rating) + '/' + max);
} else {
- ratingTemplate = Template.of(
+ ratingTemplate = Template.template(
"rating",
TranslatableCaption.of("info.none").getComponent(player)
);
@@ -2945,9 +2944,35 @@ public class Plot {
}
}
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
- .parse(
+ .deserialize(
iInfo.getComponent(player),
- headerTemplate,
+ TemplateResolver.templates(headerTemplate,
+ areaTemplate,
+ idTemplate,
+ aliasTemplate,
+ numTemplate,
+ descTemplate,
+ biomeTemplate,
+ ownerTemplate,
+ membersTemplate,
+ playerTemplate,
+ trustedTemplate,
+ helpersTemplate,
+ deniedTemplate,
+ seenTemplate,
+ flagsTemplate,
+ buildTemplate,
+ ratingTemplate,
+ creationTemplate,
+ footerTemplate)
+ ))));
+ });
+ return;
+ }
+ future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
+ .deserialize(
+ iInfo.getComponent(player),
+ TemplateResolver.templates(headerTemplate,
areaTemplate,
idTemplate,
aliasTemplate,
@@ -2963,33 +2988,7 @@ public class Plot {
seenTemplate,
flagsTemplate,
buildTemplate,
- ratingTemplate,
- creationTemplate,
- footerTemplate
- ))));
- });
- return;
- }
- future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
- .parse(
- iInfo.getComponent(player),
- headerTemplate,
- areaTemplate,
- idTemplate,
- aliasTemplate,
- numTemplate,
- descTemplate,
- biomeTemplate,
- ownerTemplate,
- membersTemplate,
- playerTemplate,
- trustedTemplate,
- helpersTemplate,
- deniedTemplate,
- seenTemplate,
- flagsTemplate,
- buildTemplate,
- footerTemplate
+ footerTemplate)
))));
}
);
diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
index 8b5f7c069..2e0a2471d 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
@@ -71,6 +71,7 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.minimessage.template.TemplateResolver;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
@@ -411,7 +412,7 @@ public abstract class PlotArea {
this.getFlagContainer().addAll(parseFlags(flags));
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.area_flags"),
- Template.of("flags", flags.toString())
+ Template.template("flags", flags.toString())
);
this.spawnEggs = config.getBoolean("event.spawn.egg");
@@ -432,7 +433,7 @@ public abstract class PlotArea {
this.getRoadFlagContainer().addAll(parseFlags(roadflags));
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.road_flags"),
- Template.of("flags", roadflags.toString())
+ Template.template("flags", roadflags.toString())
);
loadConfiguration(config);
@@ -450,14 +451,14 @@ public abstract class PlotArea {
} else {
value = flag.toString();
}
- Component snip = MINI_MESSAGE.parse(
+ Component snip = MINI_MESSAGE.deserialize(
prefix + CaptionUtility
.format(
ConsolePlayer.getConsole(),
TranslatableCaption.of("info.plot_flag_list").getComponent(LocaleHolder.console())
),
- Template.of("flag", flag.getName()),
- Template.of("value", CaptionUtility.formatRaw(ConsolePlayer.getConsole(), value.toString()))
+ TemplateResolver.templates(Template.template("flag", flag.getName()),
+ Template.template("value", CaptionUtility.formatRaw(ConsolePlayer.getConsole(), value.toString())))
);
if (flagsComponent != null) {
flagsComponent.append(snip);
@@ -1305,8 +1306,8 @@ public abstract class PlotArea {
*
* @return the legacy sign material.
* @deprecated Use {@link #signMaterial()}. This method is used for 1.13 only and
- * will be removed without replacement in favor of {@link #signMaterial()}
- * once we remove the support for 1.13.
+ * will be removed without replacement in favor of {@link #signMaterial()}
+ * once we remove the support for 1.13.
*/
@Deprecated(forRemoval = true)
public String getLegacySignMaterial() {
diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java
index 59d0bb3ef..4460fdfa3 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java
@@ -387,7 +387,7 @@ public final class PlotModificationManager {
Caption[] lines = new Caption[]{TranslatableCaption.of("signs.owner_sign_line_1"), TranslatableCaption.of(
"signs.owner_sign_line_2"),
TranslatableCaption.of("signs.owner_sign_line_3"), TranslatableCaption.of("signs.owner_sign_line_4")};
- PlotSquared.platform().worldUtil().setSign(location, lines, Template.of("id", id), Template.of("owner", name));
+ PlotSquared.platform().worldUtil().setSign(location, lines, Template.template("id", id), Template.template("owner", name));
}
}
@@ -497,7 +497,7 @@ public final class PlotModificationManager {
if (player != null) {
player.sendMessage(
TranslatableCaption.of("events.event_denied"),
- Template.of("value", "Auto merge on claim")
+ Template.template("value", "Auto merge on claim")
);
}
return;
diff --git a/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java b/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java
index adfc4df75..295a695ad 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java
@@ -77,8 +77,8 @@ public class CommentManager {
player.sendTitle(
StaticCaption.of(""),
TranslatableCaption.of("comment.inbox_notification"),
- Template.of("amount", Integer.toString(total)),
- Template.of("command", "/plot inbox")
+ Template.template("amount", Integer.toString(total)),
+ Template.template("command", "/plot inbox")
);
}
}
diff --git a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java
index 2e63a2ef0..e1a894028 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java
@@ -152,14 +152,14 @@ public class ExpireManager {
current.getCenter(pp::teleport);
metaDataAccess.remove();
Caption msg = TranslatableCaption.of("expiry.expired_options_clicky");
- Template numTemplate = Template.of("num", String.valueOf(num));
- Template areIsTemplate = Template.of("are_or_is", (num > 1 ? "plots are" : "plot is"));
- Template list_cmd = Template.of("list_cmd", "/plot list expired");
- Template plot = Template.of("plot", current.toString());
- Template cmd_del = Template.of("cmd_del", "/plot delete");
- Template cmd_keep_1d = Template.of("cmd_keep_1d", "/plot flag set keep 1d");
- Template cmd_keep = Template.of("cmd_keep", "/plot flag set keep true");
- Template cmd_no_show_expir = Template.of("cmd_no_show_expir", "/plot toggle clear-confirmation");
+ Template numTemplate = Template.template("num", String.valueOf(num));
+ Template areIsTemplate = Template.template("are_or_is", (num > 1 ? "plots are" : "plot is"));
+ Template list_cmd = Template.template("list_cmd", "/plot list expired");
+ Template plot = Template.template("plot", current.toString());
+ Template cmd_del = Template.template("cmd_del", "/plot delete");
+ Template cmd_keep_1d = Template.template("cmd_keep_1d", "/plot flag set keep 1d");
+ Template cmd_keep = Template.template("cmd_keep", "/plot flag set keep true");
+ Template cmd_no_show_expir = Template.template("cmd_no_show_expir", "/plot toggle clear-confirmation");
pp.sendMessage(
msg,
numTemplate,
diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java
index c5ba0004d..981784460 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/DenyTeleportFlag.java
@@ -89,7 +89,7 @@ public class DenyTeleportFlag extends PlotFlag {
this,
input,
TranslatableCaption.of("invalid.not_a_number"),
- Template.of("value", input)
+ Template.template("value", input)
);
}
if (parsed < 1) {
@@ -57,7 +57,7 @@ public class FeedFlag extends TimedFlag {
this,
input,
TranslatableCaption.of("invalid.number_not_positive"),
- Template.of("value", String.valueOf(parsed))
+ Template.template("value", String.valueOf(parsed))
);
}
return parsed;
diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java
index 12399c667..4047c45d1 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/HealFlag.java
@@ -49,7 +49,7 @@ public class HealFlag extends TimedFlag {
this,
input,
TranslatableCaption.of("invalid.not_a_number"),
- Template.of("value", input)
+ Template.template("value", input)
);
}
if (parsed < 1) {
@@ -57,7 +57,7 @@ public class HealFlag extends TimedFlag {
this,
input,
TranslatableCaption.of("invalid.number_not_positive"),
- Template.of("value", String.valueOf(parsed))
+ Template.template("value", String.valueOf(parsed))
);
}
return parsed;
diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java
index c7bb199ba..3573cb501 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/TitlesFlag.java
@@ -54,7 +54,7 @@ public class TitlesFlag extends PlotFlag
this,
input,
TranslatableCaption.of("flags.flag_error_enum"),
- Template.of("list", "none, true, false")
+ Template.template("list", "none, true, false")
);
}
return flagOf(titlesFlagValue);
diff --git a/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java b/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java
index ac30f0b63..f6cc40d34 100644
--- a/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java
+++ b/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java
@@ -39,23 +39,20 @@ import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
public abstract class QueueCoordinator {
+ private final AtomicBoolean enqueued = new AtomicBoolean();
private boolean forceSync = false;
@Nullable
private Object chunkObject;
- private final AtomicBoolean enqueued = new AtomicBoolean();
-
@Inject
private GlobalBlockQueue blockQueue;
@@ -205,8 +202,8 @@ public abstract class QueueCoordinator {
* @param biome biome
* @return success or not
* @deprecated Biomes now take XYZ, see {@link #setBiome(int, int, int, BiomeType)}
- *
- * Scheduled for removal once we drop the support for versions not supporting 3D biomes.
+ *
+ * Scheduled for removal once we drop the support for versions not supporting 3D biomes.
*/
@Deprecated(forRemoval = true)
public abstract boolean setBiome(int x, int z, @NonNull BiomeType biome);
diff --git a/Core/src/main/java/com/plotsquared/core/queue/subscriber/DefaultProgressSubscriber.java b/Core/src/main/java/com/plotsquared/core/queue/subscriber/DefaultProgressSubscriber.java
index 10ee06c33..e4d2c462a 100644
--- a/Core/src/main/java/com/plotsquared/core/queue/subscriber/DefaultProgressSubscriber.java
+++ b/Core/src/main/java/com/plotsquared/core/queue/subscriber/DefaultProgressSubscriber.java
@@ -120,7 +120,7 @@ public class DefaultProgressSubscriber implements ProgressSubscriber {
}
actor.sendMessage(
caption,
- Template.of("progress", String.format("%.2f", this.progress.doubleValue() * 100))
+ Template.template("progress", String.format("%.2f", this.progress.doubleValue() * 100))
);
}, interval), wait);
}
diff --git a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java
index 28f46249d..275a00dd6 100644
--- a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java
+++ b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java
@@ -213,7 +213,7 @@ public enum CommonSetupSteps implements SetupStep {
}
if (PlotSquared.platform().worldUtil().isWorld(argument)) {
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(argument)) {
- plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_taken"), Template.of("value", argument));
+ plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_taken"), Template.template("value", argument));
return this;
}
plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_apply_plotsquared"));
diff --git a/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java b/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java
index 8ff2a944b..81241d58b 100644
--- a/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java
+++ b/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java
@@ -84,10 +84,10 @@ public class SettingsNodeStep implements SetupStep {
public void announce(PlotPlayer> plotPlayer) {
plotPlayer.sendMessage(
TranslatableCaption.of("setup.setup_step"),
- Template.of("step", String.valueOf(this.getId() + 1)),
- Template.of("description", this.configurationNode.getDescription().getComponent(plotPlayer)),
- Template.of("type", this.configurationNode.getType().getType()),
- Template.of("value", String.valueOf(this.configurationNode.getDefaultValue()))
+ Template.template("step", String.valueOf(this.getId() + 1)),
+ Template.template("description", this.configurationNode.getDescription().getComponent(plotPlayer)),
+ Template.template("type", this.configurationNode.getType().getType()),
+ Template.template("value", String.valueOf(this.configurationNode.getDefaultValue()))
);
}
diff --git a/Core/src/main/java/com/plotsquared/core/synchronization/LockRepository.java b/Core/src/main/java/com/plotsquared/core/synchronization/LockRepository.java
index 12b63d3b2..e027a525a 100644
--- a/Core/src/main/java/com/plotsquared/core/synchronization/LockRepository.java
+++ b/Core/src/main/java/com/plotsquared/core/synchronization/LockRepository.java
@@ -71,9 +71,9 @@ public final class LockRepository {
* @param runnable Action to run when the lock is available
*/
public void useLock(final @NonNull LockKey key, final @NonNull Runnable runnable) {
- try (LockAccess ignored = lock(key)) {
- runnable.run();
- }
+ try (LockAccess ignored = lock(key)) {
+ runnable.run();
+ }
}
/**
diff --git a/Core/src/main/java/com/plotsquared/core/util/BlockUtil.java b/Core/src/main/java/com/plotsquared/core/util/BlockUtil.java
index 9210ddb7e..8d7e14750 100644
--- a/Core/src/main/java/com/plotsquared/core/util/BlockUtil.java
+++ b/Core/src/main/java/com/plotsquared/core/util/BlockUtil.java
@@ -84,7 +84,7 @@ public final class BlockUtil {
*
* @param id String or integer ID
* @return Parsed block state, or {@code null} if none
- * could be parsed
+ * could be parsed
*/
public static @Nullable BlockState get(final @NonNull String id) {
if (id.length() == 1 && id.charAt(0) == '*') {
@@ -136,7 +136,7 @@ public final class BlockUtil {
*
* @param map Serialized block state
* @return Deserialized block state, or {@code null} if the map is
- * not a properly serialized block state
+ * not a properly serialized block state
*/
public static @Nullable BlockState deserialize(final @NonNull Map map) {
if (map.containsKey("material")) {
diff --git a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java
index 7173ecdcb..56fc17ec6 100644
--- a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java
+++ b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java
@@ -380,7 +380,7 @@ public class EventDispatcher {
if (notifyPerms) {
player.sendMessage(
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
- Template.of("flag", PlaceFlag.getFlagName(UseFlag.class))
+ Template.template("flag", PlaceFlag.getFlagName(UseFlag.class))
);
}
return false;
@@ -447,7 +447,7 @@ public class EventDispatcher {
if (notifyPerms) {
player.sendMessage(
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
- Template.of("flag", PlotFlag.getFlagName(MobPlaceFlag.class)
+ Template.template("flag", PlotFlag.getFlagName(MobPlaceFlag.class)
+ '/' + PlotFlag.getFlagName(PlaceFlag.class))
);
}
@@ -483,7 +483,7 @@ public class EventDispatcher {
if (notifyPerms) {
player.sendMessage(
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
- Template.of("flag", PlotFlag.getFlagName(MiscPlaceFlag.class)
+ Template.template("flag", PlotFlag.getFlagName(MiscPlaceFlag.class)
+ '/' + PlotFlag.getFlagName(PlaceFlag.class))
);
}
diff --git a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java
index 5fdb8d316..1abe776fd 100644
--- a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java
+++ b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java
@@ -119,8 +119,8 @@ public final class LegacyConverter {
this.setString(section, key, bucket);
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
- Template.of("value1", block),
- Template.of("value2", bucket.toString())
+ Template.template("value1", block),
+ Template.template("value2", bucket.toString())
);
}
@@ -135,8 +135,8 @@ public final class LegacyConverter {
ConsolePlayer.getConsole()
.sendMessage(
TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
- Template.of("value1", plotBlockArrayString(blocks)),
- Template.of("value2", bucket.toString())
+ Template.template("value1", plotBlockArrayString(blocks)),
+ Template.template("value2", bucket.toString())
);
}
diff --git a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java
index 0321ee164..b270948ff 100644
--- a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java
+++ b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java
@@ -91,7 +91,7 @@ public class PatternUtil {
} catch (InputParseException e) {
throw new Command.CommandException(
TranslatableCaption.of("invalid.not_valid_block"),
- Template.of("value", e.getMessage())
+ Template.template("value", e.getMessage())
);
}
}
diff --git a/Core/src/main/java/com/plotsquared/core/util/Permissions.java b/Core/src/main/java/com/plotsquared/core/util/Permissions.java
index 6fbc434b0..7732a11a1 100644
--- a/Core/src/main/java/com/plotsquared/core/util/Permissions.java
+++ b/Core/src/main/java/com/plotsquared/core/util/Permissions.java
@@ -95,7 +95,7 @@ public class Permissions {
if (notify) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
- Template.of("node", permission)
+ Template.template("node", permission)
);
}
return false;
diff --git a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
index f6bb1e10f..8025c89db 100644
--- a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
+++ b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
@@ -38,6 +38,7 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.minimessage.template.TemplateResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -149,9 +150,11 @@ public abstract class PlayerManager
, T> {
TextComponent.Builder list = Component.text();
for (int x = 0; x < users.size(); x++) {
if (x + 1 == uuids.size()) {
- list.append(MINI_MESSAGE.parse(c, Template.of("user", users.get(x))));
+ list.append(MINI_MESSAGE.deserialize(c,
+ TemplateResolver.templates(Template.template("user", users.get(x)))));
} else {
- list.append(MINI_MESSAGE.parse(c + ", ", Template.of("user", users.get(x))));
+ list.append(MINI_MESSAGE.deserialize(c + ", ",
+ TemplateResolver.templates(Template.template("user", users.get(x)))));
}
}
return list.asComponent();
diff --git a/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java b/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java
index 33e623055..c32091847 100644
--- a/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java
+++ b/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java
@@ -38,7 +38,6 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.uuid.UUIDMapping;
import org.checkerframework.checker.nullness.qual.NonNull;
-import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -116,7 +115,6 @@ public final class TabCompletions {
* @param input Command input
* @param existing Players that should not be included in completions
* @return List of completions
- *
* @deprecated In favor {@link #completeAddedPlayers(PlotPlayer, Plot, String, List)}
*/
@Deprecated(forRemoval = true)
diff --git a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java
index d0c3d1652..52fc18bca 100644
--- a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java
+++ b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java
@@ -91,7 +91,7 @@ public abstract class WorldUtil {
*
* @param worldName World name
* @return {@code true} if there exists a world with the given world name,
- * {@code false} if not
+ * {@code false} if not
*/
public abstract boolean isWorld(@NonNull String worldName);
diff --git a/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpObject.java b/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpObject.java
index 24d7c466d..a794f292d 100644
--- a/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpObject.java
+++ b/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpObject.java
@@ -33,6 +33,7 @@ import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringMan;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.minimessage.template.TemplateResolver;
public class HelpObject {
@@ -41,13 +42,15 @@ public class HelpObject {
private final String rendered;
public HelpObject(final Command command, final String label, final PlotPlayer> audience) {
- rendered = MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
+ rendered = MINI_MESSAGE.serialize(MINI_MESSAGE.deserialize(
TranslatableCaption.of("help.help_item").getComponent(audience),
- Template.of("usage", command.getUsage().replace("{label}", label)),
- Template.of("alias", command.getAliases().isEmpty() ? "" : StringMan.join(command.getAliases(), " | ")),
- Templates.of(audience, "desc", command.getDescription()),
- Template.of("arguments", buildArgumentList(command.getRequiredArguments())),
- Template.of("label", label)
+ TemplateResolver.templates(
+ Template.template("usage", command.getUsage().replace("{label}", label)),
+ Template.template("alias", command.getAliases().isEmpty() ? "" : StringMan.join(command.getAliases(), " | ")),
+ Templates.template(audience, "desc", command.getDescription()),
+ Template.template("arguments", buildArgumentList(command.getRequiredArguments())),
+ Template.template("label", label)
+ )
));
}
diff --git a/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpPage.java b/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpPage.java
index a5f23fccf..701e5d6ae 100644
--- a/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpPage.java
+++ b/Core/src/main/java/com/plotsquared/core/util/helpmenu/HelpPage.java
@@ -32,6 +32,7 @@ import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringMan;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.minimessage.template.TemplateResolver;
import java.util.ArrayList;
import java.util.List;
@@ -46,27 +47,28 @@ public class HelpPage {
public HelpPage(CommandCategory category, int currentPage, int maxPages) {
this.helpObjects = new ArrayList<>();
- this.catTemplate = Template.of("category", category == null ? "ALL" : category.name());
- this.curTemplate = Template.of("current", String.valueOf(currentPage + 1));
- this.maxTemplate = Template.of("max", String.valueOf(maxPages + 1));
+ this.catTemplate = Template.template("category", category == null ? "ALL" : category.name());
+ this.curTemplate = Template.template("current", String.valueOf(currentPage + 1));
+ this.maxTemplate = Template.template("max", String.valueOf(maxPages + 1));
}
public void render(PlotPlayer> player) {
if (this.helpObjects.size() < 1) {
player.sendMessage(TranslatableCaption.of("help.no_permission"));
} else {
- Template header = Template.of("header", TranslatableCaption.of("help.help_header").getComponent(player));
- Template page_header = Template.of(
+ Template header = Template.template("header", TranslatableCaption.of("help.help_header").getComponent(player));
+ Template page_header = Template.template(
"page_header",
- MINI_MESSAGE.parse(
+ MINI_MESSAGE.deserialize(
TranslatableCaption.of("help.help_page_header").getComponent(player),
- catTemplate,
- curTemplate,
- maxTemplate
+ TemplateResolver.templates(
+ catTemplate,
+ curTemplate,
+ maxTemplate)
)
);
- Template help_objects = Template.of("help_objects", StringMan.join(this.helpObjects, "\n"));
- Template footer = Template.of("footer", TranslatableCaption.of("help.help_footer").getComponent(player));
+ Template help_objects = Template.template("help_objects", StringMan.join(this.helpObjects, "\n"));
+ Template footer = Template.template("footer", TranslatableCaption.of("help.help_footer").getComponent(player));
player.sendMessage(
StaticCaption.of("\n\n\n