implements CommandCaller, OfflinePlotPlayer,
*/
public void sendTitle(
final @NonNull Caption title, final @NonNull Caption subtitle,
- final @NonNull Template... replacements
+ final @NonNull TagResolver... replacements
) {
sendTitle(
title,
@@ -869,11 +870,11 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer,
public void sendTitle(
final @NonNull Caption title, final @NonNull Caption subtitle,
final int fadeIn, final int stay, final int fadeOut,
- final @NonNull Template... replacements
+ final @NonNull TagResolver... replacements
) {
- final Component titleComponent = MiniMessage.get().parse(title.getComponent(this), replacements);
+ final Component titleComponent = MiniMessage.miniMessage().deserialize(title.getComponent(this), replacements);
final Component subtitleComponent =
- MiniMessage.get().parse(subtitle.getComponent(this), replacements);
+ MiniMessage.miniMessage().deserialize(subtitle.getComponent(this), 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),
@@ -891,7 +892,7 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer,
*/
public void sendActionBar(
final @NonNull Caption caption,
- final @NonNull Template... replacements
+ final @NonNull TagResolver... replacements
) {
String message;
try {
@@ -911,14 +912,14 @@ 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 = MiniMessage.miniMessage().deserialize(message, replacements);
getAudience().sendActionBar(component);
}
@Override
public void sendMessage(
final @NonNull Caption caption,
- final @NonNull Template... replacements
+ final @NonNull TagResolver... replacements
) {
String message;
try {
@@ -937,7 +938,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 = MiniMessage.miniMessage().deserialize(message, 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 ff707953a..18917da24 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java
@@ -77,9 +77,11 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.biome.BiomeType;
import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.ComponentLike;
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.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
@@ -464,7 +466,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;
@@ -1733,7 +1735,10 @@ public class Plot {
area.addPlot(this);
updateWorldBorder();
}
- player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("plot", this.getId().toString()));
+ player.sendMessage(
+ TranslatableCaption.of("working.claimed"),
+ TagResolver.resolver("plot", Tag.inserting(Component.text(this.getId().toString())))
+ );
if (teleport) {
if (!auto && Settings.Teleport.ON_CLAIM) {
teleportPlayer(player, TeleportCause.COMMAND_CLAIM, result -> {
@@ -2602,11 +2607,13 @@ public class Plot {
return;
}
Caption caption = TranslatableCaption.of("debug.plot_debug");
- Template plotTemplate = Template.of("plot", this.toString());
- Template messageTemplate = Template.of("message", message);
+ TagResolver resolver = TagResolver.builder()
+ .tag("plot", Tag.inserting(Component.text(toString())))
+ .tag("message", Tag.inserting(Component.text(message)))
+ .build();
for (final PlotPlayer> player : players) {
if (isOwner(player.getUUID()) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_DEBUG_OTHER)) {
- player.sendMessage(caption, plotTemplate, messageTemplate);
+ player.sendMessage(caption, resolver);
}
}
} catch (final Exception ignored) {
@@ -2636,7 +2643,7 @@ public class Plot {
if (result == Result.DENY) {
player.sendMessage(
TranslatableCaption.of("events.event_denied"),
- Template.of("value", "Teleport")
+ TagResolver.resolver("value", Tag.inserting(Component.text("Teleport")))
);
resultConsumer.accept(false);
return;
@@ -2651,7 +2658,7 @@ public class Plot {
}
player.sendMessage(
TranslatableCaption.of("teleport.teleport_in_seconds"),
- Template.of("amount", String.valueOf(Settings.Teleport.DELAY))
+ TagResolver.resolver("amount", Tag.inserting(Component.text(Settings.Teleport.DELAY)))
);
final String name = player.getName();
TaskManager.addToTeleportQueue(name);
@@ -2827,41 +2834,44 @@ public class Plot {
public CompletableFuture
format(final Caption iInfo, PlotPlayer> player, final boolean full) {
final CompletableFuture
future = new CompletableFuture<>();
int num = this.getConnectedPlots().size();
- String alias = !this.getAlias().isEmpty() ? this.getAlias() : TranslatableCaption.of("info.none").getComponent(player);
+ ComponentLike alias = !this.getAlias().isEmpty() ?
+ Component.text(this.getAlias()) :
+ TranslatableCaption.of("info.none").toComponent(player);
Location bot = this.getCorners()[0];
PlotSquared.platform().worldUtil().getBiome(
Objects.requireNonNull(this.getWorldName()),
bot.getX(),
bot.getZ(),
biome -> {
- Component trusted = PlayerManager.getPlayerList(this.getTrusted(), player);
- Component members = PlayerManager.getPlayerList(this.getMembers(), player);
- Component denied = PlayerManager.getPlayerList(this.getDenied(), player);
- String seen;
+ ComponentLike trusted = PlayerManager.getPlayerList(this.getTrusted(), player);
+ ComponentLike members = PlayerManager.getPlayerList(this.getMembers(), player);
+ ComponentLike denied = PlayerManager.getPlayerList(this.getDenied(), player);
+ ComponentLike seen;
if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) {
if (this.isOnline()) {
- seen = TranslatableCaption.of("info.now").getComponent(player);
+ seen = TranslatableCaption.of("info.now").toComponent(player);
} else {
int time = (int) (ExpireManager.IMP.getAge(this, false) / 1000);
if (time != 0) {
- seen = TimeUtil.secToTime(time);
+ seen = Component.text(TimeUtil.secToTime(time));
} else {
- seen = TranslatableCaption.of("info.unknown").getComponent(player);
+ seen = TranslatableCaption.of("info.unknown").toComponent(player);
}
}
} else {
- seen = TranslatableCaption.of("info.never").getComponent(player);
+ seen = TranslatableCaption.of("info.never").toComponent(player);
}
- String description = this.getFlag(DescriptionFlag.class);
- if (description.isEmpty()) {
- description = TranslatableCaption.of("info.plot_no_description").getComponent(player);
+ ComponentLike description = TranslatableCaption.of("info.plot_no_description").toComponent(player);
+ String descriptionValue = this.getFlag(DescriptionFlag.class);
+ if (!descriptionValue.isEmpty()) {
+ description = Component.text(descriptionValue);
}
- Component flags;
+ ComponentLike flags;
Collection> flagCollection = this.getApplicableFlags(true);
if (flagCollection.isEmpty()) {
- flags = MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(player));
+ flags = TranslatableCaption.of("info.none").toComponent(player);
} else {
TextComponent.Builder flagBuilder = Component.text();
String prefix = "";
@@ -2872,13 +2882,18 @@ 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()))
+ TagResolver.builder()
+ .tag("flag", Tag.inserting(Component.text(flag.getName())))
+ .tag("value", Tag.inserting(Component.text(CaptionUtility.formatRaw(
+ player,
+ value.toString()
+ ))))
+ .build()
);
flagBuilder.append(snip);
prefix = ", ";
@@ -2890,67 +2905,57 @@ public class Plot {
if (this.getOwner() == null) {
owner = Component.text("unowned");
} else if (this.getOwner().equals(DBFunc.SERVER)) {
- owner = Component.text(MINI_MESSAGE.stripTokens(TranslatableCaption
+ owner = Component.text(MINI_MESSAGE.stripTags(TranslatableCaption
.of("info.server")
.getComponent(player)));
} else {
owner = PlayerManager.getPlayerList(this.getOwners(), player);
}
- Template headerTemplate = Template.of(
- "header",
- TranslatableCaption.of("info.plot_info_header").getComponent(player)
- );
- Template footerTemplate = Template.of(
- "footer",
- TranslatableCaption.of("info.plot_info_footer").getComponent(player)
- );
- Template areaTemplate;
+ TagResolver.Builder tagBuilder = TagResolver.builder();
+ tagBuilder.tag("header", Tag.inserting(TranslatableCaption.of("info.plot_info_header").toComponent(player)));
+ tagBuilder.tag("footer", Tag.inserting(TranslatableCaption.of("info.plot_info_footer").toComponent(player)));
+ TextComponent.Builder areaComponent = Component.text();
if (this.getArea() != null) {
- areaTemplate =
- Template.of(
- "area",
- this.getArea().getWorldName() + (this.getArea().getId() == null
- ? ""
- : "(" + this.getArea().getId() + ")")
- );
+ areaComponent.append(Component.text(getArea().getWorldName()));
+ if (getArea().getId() != null) {
+ areaComponent.append(Component.text("("))
+ .append(Component.text(getArea().getId()))
+ .append(Component.text(")"));
+ }
} else {
- areaTemplate = Template.of("area", TranslatableCaption.of("info.none").getComponent(player));
+ areaComponent.append(TranslatableCaption.of("info.none").toComponent(player));
}
+ tagBuilder.tag("area", Tag.inserting(areaComponent));
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 sizeTemplate = Template.of("size", String.valueOf(getConnectedPlots().size()));
+ tagBuilder.tag("id", Tag.inserting(Component.text(getId().toString())));
+ tagBuilder.tag("alias", Tag.inserting(alias));
+ tagBuilder.tag("num", Tag.inserting(Component.text(num)));
+ tagBuilder.tag("desc", Tag.inserting(description));
+ tagBuilder.tag("biome", Tag.inserting(Component.text(biome.toString().toLowerCase())));
+ tagBuilder.tag("owner", Tag.inserting(owner));
+ tagBuilder.tag("members", Tag.inserting(members));
+ tagBuilder.tag("player", Tag.inserting(Component.text(player.getName())));
+ tagBuilder.tag("trusted", Tag.inserting(trusted));
+ tagBuilder.tag("denied", Tag.inserting(denied));
+ tagBuilder.tag("seen", Tag.inserting(seen));
+ tagBuilder.tag("flags", Tag.inserting(flags));
+ tagBuilder.tag("creationdate", Tag.inserting(Component.text(newDate)));
+ tagBuilder.tag("build", Tag.inserting(Component.text(build)));
+ tagBuilder.tag("size", Tag.inserting(Component.text(getConnectedPlots().size())));
String component = iInfo.getComponent(player);
if (component.contains("") || component.contains("")) {
TaskManager.runTaskAsync(() -> {
- Template ratingTemplate;
- Template likesTemplate;
if (Settings.Ratings.USE_LIKES) {
- ratingTemplate = Template.of(
- "rating",
+ tagBuilder.tag("rating", Tag.inserting(Component.text(
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
- );
- likesTemplate = Template.of(
- "likes",
+ )));
+ tagBuilder.tag("likes", Tag.inserting(Component.text(
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
- );
+ )));
} else {
int max = 10;
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
@@ -2965,70 +2970,34 @@ public class Plot {
.append(String.format("%.1f", ratings[i]));
prefix = ",";
}
- ratingTemplate = Template.of("rating", rating.toString());
+ tagBuilder.tag("rating", Tag.inserting(Component.text(rating.toString())));
} else {
double rating = this.getAverageRating();
if (Double.isFinite(rating)) {
- ratingTemplate = Template.of("rating", String.format("%.1f", rating) + '/' + max);
- } else {
- ratingTemplate = Template.of(
+ tagBuilder.tag(
"rating",
- TranslatableCaption.of("info.none").getComponent(player)
+ Tag.inserting(Component.text(String.format("%.1f", rating) + '/' + max))
+ );
+ } else {
+ tagBuilder.tag(
+ "rating", Tag.inserting(TranslatableCaption.of("info.none").toComponent(player))
);
}
}
- likesTemplate = Template.of("likes", "N/A");
+ tagBuilder.tag("likes", Tag.inserting(Component.text("N/A")));
}
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
- .parse(
+ .deserialize(
iInfo.getComponent(player),
- headerTemplate,
- areaTemplate,
- idTemplate,
- aliasTemplate,
- numTemplate,
- descTemplate,
- biomeTemplate,
- ownerTemplate,
- membersTemplate,
- playerTemplate,
- trustedTemplate,
- helpersTemplate,
- deniedTemplate,
- seenTemplate,
- flagsTemplate,
- buildTemplate,
- ratingTemplate,
- creationTemplate,
- sizeTemplate,
- likesTemplate,
- footerTemplate
+ tagBuilder.build()
))));
});
return;
}
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
- .parse(
+ .deserialize(
iInfo.getComponent(player),
- headerTemplate,
- areaTemplate,
- idTemplate,
- aliasTemplate,
- numTemplate,
- descTemplate,
- biomeTemplate,
- ownerTemplate,
- membersTemplate,
- playerTemplate,
- trustedTemplate,
- helpersTemplate,
- deniedTemplate,
- seenTemplate,
- flagsTemplate,
- buildTemplate,
- creationTemplate,
- sizeTemplate,
- footerTemplate
+ tagBuilder.build()
))));
}
);
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 a45451aeb..afca97b00 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
@@ -66,12 +66,15 @@ import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes;
import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.ComponentLike;
import net.kyori.adventure.text.minimessage.MiniMessage;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
+import org.jetbrains.annotations.NotNull;
import java.text.DecimalFormat;
import java.util.ArrayList;
@@ -91,7 +94,7 @@ import java.util.function.Consumer;
/**
* @author Jesse Boyd, Alexander Söderberg
*/
-public abstract class PlotArea {
+public abstract class PlotArea implements ComponentLike {
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotArea.class.getSimpleName());
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
@@ -412,7 +415,7 @@ public abstract class PlotArea {
this.getFlagContainer().addAll(parseFlags(flags));
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.area_flags"),
- Template.of("flags", flags.toString())
+ TagResolver.resolver("flags", Tag.inserting(Component.text(flags.toString())))
);
this.spawnEggs = config.getBoolean("event.spawn.egg");
@@ -434,7 +437,7 @@ public abstract class PlotArea {
this.getRoadFlagContainer().addAll(parseFlags(roadflags));
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.road_flags"),
- Template.of("flags", roadflags.toString())
+ TagResolver.resolver("flags", Tag.inserting(Component.text(roadflags.toString())))
);
loadConfiguration(config);
@@ -527,6 +530,11 @@ public abstract class PlotArea {
}
}
+ @Override
+ public @NotNull Component asComponent() {
+ return Component.text(toString());
+ }
+
@Override
public int hashCode() {
if (this.hash != 0) {
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 68052f02c..a2eabf04b 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java
@@ -52,7 +52,9 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
@@ -394,7 +396,10 @@ 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, TagResolver.builder()
+ .tag("id", Tag.inserting(Component.text(id)))
+ .tag("owner", Tag.inserting(Component.text(name)))
+ .build());
}
}
@@ -504,7 +509,7 @@ public final class PlotModificationManager {
if (player != null) {
player.sendMessage(
TranslatableCaption.of("events.event_denied"),
- Template.of("value", "Auto merge on claim")
+ TagResolver.resolver("value", Tag.inserting(Component.text("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 c15656847..b8b37cfdb 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
@@ -36,7 +36,9 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.task.TaskTime;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import java.util.Collection;
import java.util.HashMap;
@@ -75,8 +77,10 @@ public class CommentManager {
player.sendTitle(
StaticCaption.of(""),
TranslatableCaption.of("comment.inbox_notification"),
- Template.of("amount", Integer.toString(total)),
- Template.of("command", "/plot inbox")
+ TagResolver.builder()
+ .tag("amount", Tag.inserting(Component.text(total)))
+ .tag("command", Tag.inserting(Component.text("/plot inbox")))
+ .build()
);
}
}
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 69c635e2b..5df0c16ff 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
@@ -27,7 +27,6 @@ package com.plotsquared.core.plot.expiration;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.caption.Caption;
-import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.PlotFlagAddEvent;
@@ -51,7 +50,9 @@ import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.task.TaskTime;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayDeque;
@@ -152,25 +153,17 @@ 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");
- pp.sendMessage(
- msg,
- numTemplate,
- areIsTemplate,
- list_cmd,
- plot,
- cmd_del,
- cmd_keep_1d,
- cmd_keep,
- cmd_no_show_expir
- );
+ TagResolver resolver = TagResolver.builder()
+ .tag("num", Tag.inserting(Component.text(num)))
+ .tag("are_or_is", Tag.inserting(Component.text(num > 1 ? "plots are" : "plot is")))
+ .tag("list_cmd", Tag.preProcessParsed("/plot list expired"))
+ .tag("plot", Tag.inserting(Component.text(current.toString())))
+ .tag("cmd_del", Tag.preProcessParsed("/plot delete"))
+ .tag("cmd_keep_1d", Tag.preProcessParsed("/plot flag set keep 1d"))
+ .tag("cmd_keep", Tag.preProcessParsed("/plot flag set keep true"))
+ .tag("cmd_no_show_expir", Tag.preProcessParsed("/plot toggle clear-confirmation"))
+ .build();
+ pp.sendMessage(msg, resolver);
return;
} else {
iter.remove();
@@ -436,7 +429,7 @@ public class ExpireManager {
if (player != null) {
player.sendMessage(
TranslatableCaption.of("trusted.plot_removed_user"),
- Templates.of("plot", plot.toString())
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
);
}
}
@@ -445,7 +438,7 @@ public class ExpireManager {
if (player != null) {
player.sendMessage(
TranslatableCaption.of("trusted.plot_removed_user"),
- Templates.of("plot", plot.toString())
+ TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
);
}
}
diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/FlagParseException.java b/Core/src/main/java/com/plotsquared/core/plot/flag/FlagParseException.java
index bb32f77d9..f94d50f09 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/flag/FlagParseException.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/flag/FlagParseException.java
@@ -26,14 +26,14 @@
package com.plotsquared.core.plot.flag;
import com.plotsquared.core.configuration.caption.Caption;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
public class FlagParseException extends Exception {
private final PlotFlag, ?> flag;
private final String value;
private final Caption errorMessage;
- private final Template[] templates;
+ private final TagResolver[] tagResolvers;
/**
* Construct a new flag parse exception to indicate that an attempt to parse a plot
@@ -46,7 +46,7 @@ public class FlagParseException extends Exception {
*/
public FlagParseException(
final PlotFlag, ?> flag, final String value,
- final Caption errorMessage, final Template... args
+ final Caption errorMessage, final TagResolver... args
) {
super(String.format("Failed to parse flag of type '%s'. Value '%s' was not accepted.",
flag.getName(), value
@@ -54,7 +54,7 @@ public class FlagParseException extends Exception {
this.flag = flag;
this.value = value;
this.errorMessage = errorMessage;
- this.templates = args;
+ this.tagResolvers = args;
}
/**
@@ -89,8 +89,8 @@ public class FlagParseException extends Exception {
*
* @return Message templates.
*/
- public Template[] getTemplates() {
- return templates;
+ public TagResolver[] getTagResolvers() {
+ return tagResolvers;
}
}
diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/PlotFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/PlotFlag.java
index a7678e756..a922fcafd 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/flag/PlotFlag.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/flag/PlotFlag.java
@@ -27,11 +27,11 @@ package com.plotsquared.core.plot.flag;
import com.google.common.base.Preconditions;
import com.plotsquared.core.configuration.caption.Caption;
+import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection;
import java.util.Collections;
-import java.util.Objects;
/**
* A plot flag is any property that can be assigned
@@ -91,6 +91,16 @@ public abstract class PlotFlag> {
return flagName.toString();
}
+ /**
+ * Gets the flag name as a Kyori {@link Component}
+ *
+ * @see #getFlagName(Class)
+ * @since TODO
+ */
+ public static > Component getFlagNameComponent(Class flagClass) {
+ return Component.text(getFlagName(flagClass));
+ }
+
/**
* Get the flag value
*
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 5ac7d1b56..9fb676ae8 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
@@ -30,7 +30,9 @@ import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.FlagParseException;
import com.plotsquared.core.plot.flag.PlotFlag;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -89,7 +91,10 @@ public class DenyTeleportFlag extends PlotFlag {
@@ -49,7 +51,7 @@ public class FeedFlag extends TimedFlag {
this,
input,
TranslatableCaption.of("invalid.not_a_number"),
- Template.of("value", input)
+ TagResolver.resolver("value", Tag.inserting(Component.text(input)))
);
}
if (parsed < 1) {
@@ -57,7 +59,7 @@ public class FeedFlag extends TimedFlag {
this,
input,
TranslatableCaption.of("invalid.number_not_positive"),
- Template.of("value", String.valueOf(parsed))
+ TagResolver.resolver("value", Tag.inserting(Component.text(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 809512776..d89deacee 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
@@ -28,7 +28,9 @@ package com.plotsquared.core.plot.flag.implementations;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.plot.flag.FlagParseException;
import com.plotsquared.core.plot.flag.types.TimedFlag;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
public class HealFlag extends TimedFlag {
@@ -49,7 +51,7 @@ public class HealFlag extends TimedFlag {
this,
input,
TranslatableCaption.of("invalid.not_a_number"),
- Template.of("value", input)
+ TagResolver.resolver("value", Tag.inserting(Component.text(input)))
);
}
if (parsed < 1) {
@@ -57,7 +59,7 @@ public class HealFlag extends TimedFlag {
this,
input,
TranslatableCaption.of("invalid.number_not_positive"),
- Template.of("value", String.valueOf(parsed))
+ TagResolver.resolver("value", Tag.inserting(Component.text(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 03e6834b1..573c32c06 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
@@ -28,7 +28,9 @@ package com.plotsquared.core.plot.flag.implementations;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.plot.flag.FlagParseException;
import com.plotsquared.core.plot.flag.PlotFlag;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -54,7 +56,7 @@ public class TitlesFlag extends PlotFlag
this,
input,
TranslatableCaption.of("flags.flag_error_enum"),
- Template.of("list", "none, true, false")
+ TagResolver.resolver("list", Tag.inserting(Component.text("none, true, false")))
);
}
return flagOf(titlesFlagValue);
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 d72472723..a90e330c7 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
@@ -37,7 +37,9 @@ import com.plotsquared.core.queue.ChunkCoordinator;
import com.plotsquared.core.util.task.PlotSquaredTask;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.task.TaskTime;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nullable;
@@ -120,7 +122,10 @@ public class DefaultProgressSubscriber implements ProgressSubscriber {
}
actor.sendMessage(
caption,
- Template.of("progress", String.format("%.2f", this.progress.doubleValue() * 100))
+ TagResolver.resolver(
+ "progress",
+ Tag.inserting(Component.text(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 40ec3f2b4..cf90e540c 100644
--- a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java
+++ b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java
@@ -39,7 +39,9 @@ import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -213,7 +215,10 @@ 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"),
+ TagResolver.resolver("value", Tag.inserting(Component.text(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 f9f04d29e..d01f73ffb 100644
--- a/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java
+++ b/Core/src/main/java/com/plotsquared/core/setup/SettingsNodeStep.java
@@ -31,7 +31,9 @@ import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.TabCompletions;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -84,10 +86,15 @@ 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()))
+ TagResolver.builder()
+ .tag("step", Tag.inserting(Component.text(this.getId() + 1)))
+ .tag(
+ "description",
+ Tag.inserting(this.configurationNode.getDescription().toComponent(plotPlayer))
+ )
+ .tag("type", Tag.inserting(Component.text(this.configurationNode.getType().getType())))
+ .tag("value", Tag.inserting(Component.text(this.configurationNode.getDefaultValue().toString())))
+ .build()
);
}
diff --git a/Core/src/main/java/com/plotsquared/core/util/ComponentHelper.java b/Core/src/main/java/com/plotsquared/core/util/ComponentHelper.java
new file mode 100644
index 000000000..8168e9483
--- /dev/null
+++ b/Core/src/main/java/com/plotsquared/core/util/ComponentHelper.java
@@ -0,0 +1,72 @@
+/*
+ * _____ _ _ _____ _
+ * | __ \| | | | / ____| | |
+ * | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
+ * | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
+ * | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
+ * |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
+ * | |
+ * |_|
+ * PlotSquared plot management system for Minecraft
+ * Copyright (C) 2014 - 2022 IntellectualSites
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package com.plotsquared.core.util;
+
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.ComponentLike;
+import net.kyori.adventure.text.TextComponent;
+
+import java.util.Collection;
+
+/**
+ * A utility class for modifying components.
+ *
+ * @since TODO
+ */
+public class ComponentHelper {
+
+ /**
+ * Joins multiple {@link Component}s into one final {@link ComponentLike}
+ *
+ * @param components The components to join
+ * @param delimiter The delimiter to use between the components
+ * @return The joined components
+ * @since TODO
+ */
+ public static ComponentLike join(Collection extends ComponentLike> components, Component delimiter) {
+ return join(components.toArray(ComponentLike[]::new), delimiter);
+ }
+
+ /**
+ * Joins multiple {@link ComponentLike}s into one final {@link ComponentLike}
+ *
+ * @param components The components to join
+ * @param delimiter The delimiter to use between the components
+ * @return The joined components
+ * @since TODO
+ */
+ public static Component join(ComponentLike[] components, Component delimiter) {
+ TextComponent.Builder builder = Component.text();
+ for (int i = 0, j = components.length; i < j; i++) {
+ if (i > 0) {
+ builder.append(delimiter);
+ }
+ builder.append(components[i]);
+ }
+ return builder.build();
+ }
+
+}
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 be653f45d..b7fe15e79 100644
--- a/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java
+++ b/Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java
@@ -80,7 +80,9 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -380,7 +382,7 @@ public class EventDispatcher {
if (notifyPerms) {
player.sendMessage(
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
- Template.of("flag", PlaceFlag.getFlagName(UseFlag.class))
+ TagResolver.resolver("flag", Tag.inserting(PlaceFlag.getFlagNameComponent(UseFlag.class)))
);
}
return false;
@@ -447,8 +449,14 @@ public class EventDispatcher {
if (notifyPerms) {
player.sendMessage(
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
- Template.of("flag", PlotFlag.getFlagName(MobPlaceFlag.class)
- + '/' + PlotFlag.getFlagName(PlaceFlag.class))
+ TagResolver.resolver(
+ "flag",
+ Tag.inserting(
+ PlotFlag.getFlagNameComponent(MobPlaceFlag.class)
+ .append(Component.text("/"))
+ .append(PlotFlag.getFlagNameComponent(PlaceFlag.class))
+ )
+ )
);
}
return false;
@@ -483,8 +491,14 @@ public class EventDispatcher {
if (notifyPerms) {
player.sendMessage(
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
- Template.of("flag", PlotFlag.getFlagName(MiscPlaceFlag.class)
- + '/' + PlotFlag.getFlagName(PlaceFlag.class))
+ TagResolver.resolver(
+ "flag",
+ Tag.inserting(
+ PlotFlag.getFlagNameComponent(MiscPlaceFlag.class)
+ .append(Component.text("/"))
+ .append(PlotFlag.getFlagNameComponent(PlaceFlag.class))
+ )
+ )
);
}
return false;
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 d5818f735..90c5747ee 100644
--- a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java
+++ b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java
@@ -31,7 +31,9 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.plot.BlockBucket;
import com.sk89q.worldedit.world.block.BlockState;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
@@ -119,8 +121,10 @@ 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())
+ TagResolver.builder()
+ .tag("value1", Tag.inserting(Component.text(block)))
+ .tag("value2", Tag.inserting(Component.text(bucket.toString())))
+ .build()
);
}
@@ -135,8 +139,10 @@ public final class LegacyConverter {
ConsolePlayer.getConsole()
.sendMessage(
TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
- Template.of("value1", plotBlockArrayString(blocks)),
- Template.of("value2", bucket.toString())
+ TagResolver.builder()
+ .tag("value1", Tag.inserting(Component.text(plotBlockArrayString(blocks))))
+ .tag("value2", Tag.inserting(Component.text(bucket.toString())))
+ .build()
);
}
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 e2db0dc7f..2be9de3c3 100644
--- a/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java
+++ b/Core/src/main/java/com/plotsquared/core/util/PatternUtil.java
@@ -41,7 +41,9 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayList;
@@ -91,7 +93,7 @@ public class PatternUtil {
} catch (InputParseException e) {
throw new Command.CommandException(
TranslatableCaption.of("invalid.not_valid_block"),
- Template.of("value", e.getMessage())
+ TagResolver.resolver("value", Tag.inserting(Component.text(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 41701b973..7304c21f4 100644
--- a/Core/src/main/java/com/plotsquared/core/util/Permissions.java
+++ b/Core/src/main/java/com/plotsquared/core/util/Permissions.java
@@ -30,7 +30,9 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.permissions.PermissionHolder;
import com.plotsquared.core.player.PlotPlayer;
-import net.kyori.adventure.text.minimessage.Template;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
@@ -96,7 +98,7 @@ public class Permissions {
if (notify) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
- Template.of("node", permission)
+ TagResolver.resolver("node", Tag.inserting(Component.text(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 11be11a43..9e8ed2cbd 100644
--- a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
+++ b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
@@ -37,9 +37,11 @@ import com.plotsquared.core.player.OfflinePlotPlayer;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.ComponentLike;
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.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -121,18 +123,18 @@ public abstract class PlayerManager
, T> {
*/
public static @NonNull Component getPlayerList(final @NonNull Collection uuids, LocaleHolder localeHolder) {
if (uuids.isEmpty()) {
- return MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(localeHolder));
+ return TranslatableCaption.of("info.none").toComponent(localeHolder).asComponent();
}
final List players = new LinkedList<>();
- final List users = new LinkedList<>();
+ final List users = new LinkedList<>();
for (final UUID uuid : uuids) {
if (uuid == null) {
- users.add(MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.none").getComponent(localeHolder)));
+ users.add(TranslatableCaption.of("info.none").toComponent(localeHolder));
} else if (DBFunc.EVERYONE.equals(uuid)) {
- users.add(MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.everyone").getComponent(localeHolder)));
+ users.add(TranslatableCaption.of("info.everyone").toComponent(localeHolder));
} else if (DBFunc.SERVER.equals(uuid)) {
- users.add(MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.console").getComponent(localeHolder)));
+ users.add(TranslatableCaption.of("info.console").toComponent(localeHolder));
} else {
players.add(uuid);
}
@@ -141,7 +143,7 @@ public abstract class PlayerManager