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;
@@ -868,9 +866,9 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer,
final int fadeIn, final int stay, final int fadeOut,
final @NonNull Template... replacements
) {
- final Component titleComponent = MINI_MESSAGE.deserialize(title.getComponent(this), TemplateResolver.templates(replacements));
+ final Component titleComponent = MiniMessage.get().parse(title.getComponent(this), replacements);
final Component subtitleComponent =
- MINI_MESSAGE.deserialize(subtitle.getComponent(this), TemplateResolver.templates(replacements));
+ MiniMessage.get().parse(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),
@@ -908,7 +906,7 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer,
.replace("", TranslatableCaption.of("core.prefix").getComponent(this));
- final Component component = MINI_MESSAGE.deserialize(message, TemplateResolver.templates(replacements));
+ final Component component = MiniMessage.get().parse(message, replacements);
getAudience().sendActionBar(component);
}
@@ -934,7 +932,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 = MINI_MESSAGE.deserialize(message, TemplateResolver.templates(replacements));
+ final Component component = MiniMessage.get().parse(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 1aa7765f8..db5e58e4b 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java
@@ -40,6 +40,7 @@ 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;
@@ -79,7 +80,6 @@ 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.template("plot", this.getId().toString()));
+ player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("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.template("plot", this.toString());
- Template messageTemplate = Template.template("message", message);
+ Template plotTemplate = Template.of("plot", this.toString());
+ Template messageTemplate = Template.of("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.template("value", "Teleport")
+ Template.of("value", "Teleport")
);
resultConsumer.accept(false);
return;
@@ -2624,7 +2624,7 @@ public class Plot {
}
player.sendMessage(
TranslatableCaption.of("teleport.teleport_in_seconds"),
- Template.template("amount", String.valueOf(Settings.Teleport.DELAY))
+ Template.of("amount", String.valueOf(Settings.Teleport.DELAY))
);
final String name = player.getName();
TaskManager.addToTeleportQueue(name);
@@ -2845,12 +2845,13 @@ public class Plot {
} else {
value = flag.toString();
}
- Component snip = MINI_MESSAGE.deserialize(
+ Component snip = MINI_MESSAGE.parse(
prefix + CaptionUtility.format(
player,
- TranslatableCaption.of("info.plot_flag_list").getComponent(player)),
- TemplateResolver.templates(Template.template("flag", flag.getName()),
- Template.template("value", CaptionUtility.formatRaw(player, value.toString())))
+ TranslatableCaption.of("info.plot_flag_list").getComponent(player)
+ ),
+ Template.of("flag", flag.getName()),
+ Template.of("value", CaptionUtility.formatRaw(player, value.toString()))
);
flagBuilder.append(snip);
prefix = ", ";
@@ -2868,51 +2869,51 @@ public class Plot {
} else {
owner = PlayerManager.getPlayerList(this.getOwners(), player);
}
- Template headerTemplate = Template.template(
+ Template headerTemplate = Template.of(
"header",
TranslatableCaption.of("info.plot_info_header").getComponent(player)
);
- Template footerTemplate = Template.template(
+ Template footerTemplate = Template.of(
"footer",
TranslatableCaption.of("info.plot_info_footer").getComponent(player)
);
Template areaTemplate;
if (this.getArea() != null) {
areaTemplate =
- Template.template(
+ Template.of(
"area",
this.getArea().getWorldName() + (this.getArea().getId() == null
? ""
: "(" + this.getArea().getId() + ")")
);
} else {
- areaTemplate = Template.template("area", TranslatableCaption.of("info.none").getComponent(player));
+ areaTemplate = Template.of("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.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));
+ 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));
if (iInfo.getComponent(player).contains("")) {
TaskManager.runTaskAsync(() -> {
Template ratingTemplate;
if (Settings.Ratings.USE_LIKES) {
- ratingTemplate = Template.template(
+ ratingTemplate = Template.of(
"rating",
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
);
@@ -2930,13 +2931,13 @@ public class Plot {
.append(String.format("%.1f", ratings[i]));
prefix = ",";
}
- ratingTemplate = Template.template("rating", rating.toString());
+ ratingTemplate = Template.of("rating", rating.toString());
} else {
double rating = this.getAverageRating();
if (Double.isFinite(rating)) {
- ratingTemplate = Template.template("rating", String.format("%.1f", rating) + '/' + max);
+ ratingTemplate = Template.of("rating", String.format("%.1f", rating) + '/' + max);
} else {
- ratingTemplate = Template.template(
+ ratingTemplate = Template.of(
"rating",
TranslatableCaption.of("info.none").getComponent(player)
);
@@ -2944,35 +2945,9 @@ public class Plot {
}
}
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
- .deserialize(
+ .parse(
iInfo.getComponent(player),
- 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,
+ headerTemplate,
areaTemplate,
idTemplate,
aliasTemplate,
@@ -2988,7 +2963,33 @@ public class Plot {
seenTemplate,
flagsTemplate,
buildTemplate,
- footerTemplate)
+ 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
))));
}
);
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 2e0a2471d..8b5f7c069 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
@@ -71,7 +71,6 @@ 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;
@@ -412,7 +411,7 @@ public abstract class PlotArea {
this.getFlagContainer().addAll(parseFlags(flags));
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.area_flags"),
- Template.template("flags", flags.toString())
+ Template.of("flags", flags.toString())
);
this.spawnEggs = config.getBoolean("event.spawn.egg");
@@ -433,7 +432,7 @@ public abstract class PlotArea {
this.getRoadFlagContainer().addAll(parseFlags(roadflags));
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.road_flags"),
- Template.template("flags", roadflags.toString())
+ Template.of("flags", roadflags.toString())
);
loadConfiguration(config);
@@ -451,14 +450,14 @@ public abstract class PlotArea {
} else {
value = flag.toString();
}
- Component snip = MINI_MESSAGE.deserialize(
+ Component snip = MINI_MESSAGE.parse(
prefix + CaptionUtility
.format(
ConsolePlayer.getConsole(),
TranslatableCaption.of("info.plot_flag_list").getComponent(LocaleHolder.console())
),
- TemplateResolver.templates(Template.template("flag", flag.getName()),
- Template.template("value", CaptionUtility.formatRaw(ConsolePlayer.getConsole(), value.toString())))
+ Template.of("flag", flag.getName()),
+ Template.of("value", CaptionUtility.formatRaw(ConsolePlayer.getConsole(), value.toString()))
);
if (flagsComponent != null) {
flagsComponent.append(snip);
@@ -1306,8 +1305,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 4460fdfa3..59d0bb3ef 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.template("id", id), Template.template("owner", name));
+ PlotSquared.platform().worldUtil().setSign(location, lines, Template.of("id", id), Template.of("owner", name));
}
}
@@ -497,7 +497,7 @@ public final class PlotModificationManager {
if (player != null) {
player.sendMessage(
TranslatableCaption.of("events.event_denied"),
- Template.template("value", "Auto merge on claim")
+ Template.of("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 295a695ad..adfc4df75 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.template("amount", Integer.toString(total)),
- Template.template("command", "/plot inbox")
+ Template.of("amount", Integer.toString(total)),
+ Template.of("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 e1a894028..2e63a2ef0 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.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");
+ 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,
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 981784460..c5ba0004d 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.template("value", input)
+ Template.of("value", input)
);
}
if (parsed < 1) {
@@ -57,7 +57,7 @@ public class FeedFlag extends TimedFlag {
this,
input,
TranslatableCaption.of("invalid.number_not_positive"),
- Template.template("value", String.valueOf(parsed))
+ Template.of("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 4047c45d1..12399c667 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.template("value", input)
+ Template.of("value", input)
);
}
if (parsed < 1) {
@@ -57,7 +57,7 @@ public class HealFlag extends TimedFlag {
this,
input,
TranslatableCaption.of("invalid.number_not_positive"),
- Template.template("value", String.valueOf(parsed))
+ Template.of("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 3573cb501..c7bb199ba 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.template("list", "none, true, false")
+ Template.of("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 f6cc40d34..ac30f0b63 100644
--- a/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java
+++ b/Core/src/main/java/com/plotsquared/core/queue/QueueCoordinator.java
@@ -39,20 +39,23 @@ 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;
@@ -202,8 +205,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 e4d2c462a..10ee06c33 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.template("progress", String.format("%.2f", this.progress.doubleValue() * 100))
+ Template.of("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 275a00dd6..28f46249d 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.template("value", argument));
+ plotPlayer.sendMessage(TranslatableCaption.of("setup.setup_world_taken"), Template.of("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 81241d58b..8ff2a944b 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.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()))
+ 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()))
);
}
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 e027a525a..12b63d3b2 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 8d7e14750..9210ddb7e 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 56fc17ec6..7173ecdcb 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.template("flag", PlaceFlag.getFlagName(UseFlag.class))
+ Template.of("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.template("flag", PlotFlag.getFlagName(MobPlaceFlag.class)
+ Template.of("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.template("flag", PlotFlag.getFlagName(MiscPlaceFlag.class)
+ Template.of("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 1abe776fd..5fdb8d316 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.template("value1", block),
- Template.template("value2", bucket.toString())
+ Template.of("value1", block),
+ Template.of("value2", bucket.toString())
);
}
@@ -135,8 +135,8 @@ public final class LegacyConverter {
ConsolePlayer.getConsole()
.sendMessage(
TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
- Template.template("value1", plotBlockArrayString(blocks)),
- Template.template("value2", bucket.toString())
+ Template.of("value1", plotBlockArrayString(blocks)),
+ Template.of("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 b270948ff..0321ee164 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.template("value", e.getMessage())
+ Template.of("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 7732a11a1..6fbc434b0 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.template("node", permission)
+ Template.of("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 8025c89db..f6bb1e10f 100644
--- a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
+++ b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
@@ -38,7 +38,6 @@ 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;
@@ -150,11 +149,9 @@ 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.deserialize(c,
- TemplateResolver.templates(Template.template("user", users.get(x)))));
+ list.append(MINI_MESSAGE.parse(c, Template.of("user", users.get(x))));
} else {
- list.append(MINI_MESSAGE.deserialize(c + ", ",
- TemplateResolver.templates(Template.template("user", users.get(x)))));
+ list.append(MINI_MESSAGE.parse(c + ", ", Template.of("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 c32091847..33e623055 100644
--- a/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java
+++ b/Core/src/main/java/com/plotsquared/core/util/TabCompletions.java
@@ -38,6 +38,7 @@ 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;
@@ -115,6 +116,7 @@ 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 52fc18bca..d0c3d1652 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 a794f292d..24d7c466d 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,7 +33,6 @@ 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 {
@@ -42,15 +41,13 @@ public class HelpObject {
private final String rendered;
public HelpObject(final Command command, final String label, final PlotPlayer> audience) {
- rendered = MINI_MESSAGE.serialize(MINI_MESSAGE.deserialize(
+ rendered = MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
TranslatableCaption.of("help.help_item").getComponent(audience),
- 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)
- )
+ 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)
));
}
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 701e5d6ae..a5f23fccf 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,7 +32,6 @@ 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;
@@ -47,28 +46,27 @@ public class HelpPage {
public HelpPage(CommandCategory category, int currentPage, int maxPages) {
this.helpObjects = new ArrayList<>();
- 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));
+ 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));
}
public void render(PlotPlayer> player) {
if (this.helpObjects.size() < 1) {
player.sendMessage(TranslatableCaption.of("help.no_permission"));
} else {
- Template header = Template.template("header", TranslatableCaption.of("help.help_header").getComponent(player));
- Template page_header = Template.template(
+ Template header = Template.of("header", TranslatableCaption.of("help.help_header").getComponent(player));
+ Template page_header = Template.of(
"page_header",
- MINI_MESSAGE.deserialize(
+ MINI_MESSAGE.parse(
TranslatableCaption.of("help.help_page_header").getComponent(player),
- TemplateResolver.templates(
- catTemplate,
- curTemplate,
- maxTemplate)
+ catTemplate,
+ curTemplate,
+ maxTemplate
)
);
- Template help_objects = Template.template("help_objects", StringMan.join(this.helpObjects, "\n"));
- Template footer = Template.template("footer", TranslatableCaption.of("help.help_footer").getComponent(player));
+ Template help_objects = Template.of("help_objects", StringMan.join(this.helpObjects, "\n"));
+ Template footer = Template.of("footer", TranslatableCaption.of("help.help_footer").getComponent(player));
player.sendMessage(
StaticCaption.of("\n\n\n