diff --git a/Bukkit/build.gradle.kts b/Bukkit/build.gradle.kts
index 68179e38a..532846c74 100644
--- a/Bukkit/build.gradle.kts
+++ b/Bukkit/build.gradle.kts
@@ -100,5 +100,6 @@ tasks {
opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/")
opt.links("https://checkerframework.org/api/")
+ opt.links("https://notmyfault.github.io/MiniMessage-Javadocs/") // Temporary hosting until Kyori adds hosted Javadocs
}
}
diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java
index d0d47e51c..c8c2db05c 100644
--- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java
+++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java
@@ -733,7 +733,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
Placeholder> plotTemplate = Placeholder.miniMessage("plot_id", id.toString());
Placeholder> senderTemplate = Placeholder.miniMessage("sender", sender);
// If we do/don't want colour, we need to be careful about how to go about it, as players could attempt either or &6 etc.
- // In both cases, we want to use a Component Template to ensure that the player cannot use any of in their message on purpose
+ // In both cases, we want to use a Component Template to ensure that the player cannot use any placeholders in their message on purpose
// or accidentally, as component templates are done at the end. We also need to deserialize from legacy color codes to a Component if
// allowing colour.
if (plotPlayer.hasPermission("plots.chat.color")) {
diff --git a/Core/src/main/java/com/plotsquared/core/PlotAPI.java b/Core/src/main/java/com/plotsquared/core/PlotAPI.java
index 9f79ca360..8ac9925ad 100644
--- a/Core/src/main/java/com/plotsquared/core/PlotAPI.java
+++ b/Core/src/main/java/com/plotsquared/core/PlotAPI.java
@@ -155,7 +155,7 @@ public class PlotAPI {
final @NonNull String message,
final @NonNull Placeholder> @NonNull ... replacements
) {
- ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements);
+ ConsolePlayer.getConsole().sendMessage(StaticCaption.miniMessage(message), replacements);
}
/**
diff --git a/Core/src/main/java/com/plotsquared/core/command/Area.java b/Core/src/main/java/com/plotsquared/core/command/Area.java
index 510bc2e36..6ea996851 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Area.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Area.java
@@ -728,7 +728,7 @@ public class Area extends SubCommand {
Placeholder> typeTemplate = Placeholder.miniMessage("area_type", area.getType().name());
Placeholder> terrainTemplate = Placeholder.miniMessage("area_terrain", area.getTerrain().name());
caption.set(TranslatableCaption.miniMessage("info.area_list_item"));
- caption.setPlaceholders(
+ caption.parsePlaceholders(
tooltipTemplate,
visitcmdTemplate,
numberTemplate,
diff --git a/Core/src/main/java/com/plotsquared/core/command/Command.java b/Core/src/main/java/com/plotsquared/core/command/Command.java
index b0e21e96b..9be9be1b7 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Command.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Command.java
@@ -215,7 +215,7 @@ public abstract class Command {
String descriptionKey = String.join(".", path);
this.description = TranslatableCaption.miniMessage(String.format("commands.description.%s", descriptionKey));
} else {
- this.description = StaticCaption.of(declaration.description());
+ this.description = StaticCaption.miniMessage(declaration.description());
}
this.usage = declaration.usage();
this.confirmation = declaration.confirmation();
@@ -274,7 +274,7 @@ public abstract class Command {
i++;
final CaptionHolder msg = new CaptionHolder();
add.run(i, obj, msg);
- player.sendMessage(msg.get(), msg.getPlaceholders());
+ player.sendMessage(msg.caption(), msg.placeholders());
}
// Send the footer
Placeholder> command1 = Placeholder.miniMessage("command1", baseCommand + " " + page);
@@ -307,7 +307,7 @@ public abstract class Command {
}
if (this.allCommands.isEmpty()) {
player.sendMessage(
- StaticCaption.of("Not Implemented: https://github.com/IntellectualSites/PlotSquared/issues"));
+ StaticCaption.miniMessage("Not Implemented: https://github.com/IntellectualSites/PlotSquared/issues"));
return CompletableFuture.completedFuture(false);
}
Command cmd = getCommand(args[0]);
@@ -608,12 +608,30 @@ public abstract class Command {
return this.getFullId().hashCode();
}
+ /**
+ * Check whether a given condition is true
+ *
+ * @param mustBeTrue The condition to check, that must be true
+ * @param message The message to send
+ * @param args The arguments to send with the message
+ * @since 6.3.0
+ */
public void checkTrue(boolean mustBeTrue, Caption message, Placeholder>... args) {
if (!mustBeTrue) {
throw new CommandException(message, args);
}
}
+ /**
+ * Check whether a given condition is true
+ *
+ * @param object The condition to check, that must be true
+ * @param message The message to send
+ * @param args The arguments to send with the message
+ * @param The type of the object
+ * @return The object
+ * @since 6.3.0
+ */
public T check(T object, Caption message, Placeholder>... args) {
if (object == null) {
throw new CommandException(message, args);
@@ -633,6 +651,13 @@ public abstract class Command {
private final Placeholder>[] placeholders;
private final Caption message;
+ /**
+ * Create a new CommandException
+ *
+ * @param message The message to send
+ * @param placeholders The placeholders to send with the message
+ * @since 6.3.0
+ */
public CommandException(final @Nullable Caption message, final Placeholder>... placeholders) {
this.message = message;
this.placeholders = placeholders;
diff --git a/Core/src/main/java/com/plotsquared/core/command/CommandCaller.java b/Core/src/main/java/com/plotsquared/core/command/CommandCaller.java
index 10a6e64c5..ff0176add 100644
--- a/Core/src/main/java/com/plotsquared/core/command/CommandCaller.java
+++ b/Core/src/main/java/com/plotsquared/core/command/CommandCaller.java
@@ -40,6 +40,7 @@ public interface CommandCaller {
*
* @param caption Caption to send
* @param replacements Variable replacements
+ * @since 6.3.0
*/
void sendMessage(@NonNull Caption caption, @NonNull Placeholder>... replacements);
diff --git a/Core/src/main/java/com/plotsquared/core/command/Comment.java b/Core/src/main/java/com/plotsquared/core/command/Comment.java
index 77e091d38..c057db118 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Comment.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Comment.java
@@ -112,7 +112,7 @@ public class Comment extends SubCommand {
for (final PlotPlayer> pp : PlotSquared.platform().playerManager().getPlayers()) {
if (pp.getAttribute("chatspy")) {
- pp.sendMessage(StaticCaption.of("/plot comment " + StringMan.join(args, " ")));
+ pp.sendMessage(StaticCaption.miniMessage("/plot comment " + StringMan.join(args, " ")));
}
}
diff --git a/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java b/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java
index 7cc419e45..b66427a59 100644
--- a/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java
+++ b/Core/src/main/java/com/plotsquared/core/command/DatabaseCommand.java
@@ -213,7 +213,7 @@ public class DatabaseCommand extends SubCommand {
}
case "mysql" -> {
if (args.length < 6) {
- player.sendMessage(StaticCaption.of(
+ player.sendMessage(StaticCaption.miniMessage(
"/plot database mysql [host] [port] [username] [password] [database] {prefix}"));
return false;
}
@@ -229,7 +229,7 @@ public class DatabaseCommand extends SubCommand {
}
case "sqlite" -> {
if (args.length < 2) {
- player.sendMessage(StaticCaption.of("/plot database sqlite [file]"));
+ player.sendMessage(StaticCaption.miniMessage("/plot database sqlite [file]"));
return false;
}
File sqliteFile =
@@ -237,7 +237,7 @@ public class DatabaseCommand extends SubCommand {
implementation = new SQLite(sqliteFile);
}
default -> {
- player.sendMessage(StaticCaption.of("/plot database [sqlite/mysql]"));
+ player.sendMessage(StaticCaption.miniMessage("/plot database [sqlite/mysql]"));
return false;
}
}
diff --git a/Core/src/main/java/com/plotsquared/core/command/Debug.java b/Core/src/main/java/com/plotsquared/core/command/Debug.java
index d49f3baf5..72b56fb80 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Debug.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Debug.java
@@ -82,7 +82,7 @@ public class Debug extends SubCommand {
if (args.length > 0) {
if ("player".equalsIgnoreCase(args[0])) {
for (Map.Entry meta : player.getMeta().entrySet()) {
- player.sendMessage(StaticCaption.of("Key: " + meta.getKey() + " Value: " + meta
+ player.sendMessage(StaticCaption.miniMessage("Key: " + meta.getKey() + " Value: " + meta
.getValue()
.toString() + " , "));
}
@@ -93,7 +93,7 @@ public class Debug extends SubCommand {
final long start = System.currentTimeMillis();
player.sendMessage(TranslatableCaption.miniMessage("debug.fetching_loaded_chunks"));
TaskManager.runTaskAsync(() -> player.sendMessage(StaticCaption
- .of("Loaded chunks: " + this.worldUtil
+ .miniMessage("Loaded chunks: " + this.worldUtil
.getChunkChunks(player.getLocation().getWorldName())
.size() + " (" + (System.currentTimeMillis()
- start) + "ms) using thread: " + Thread.currentThread().getName())));
@@ -126,7 +126,7 @@ public class Debug extends SubCommand {
for (final EntityType entityType : category.getAll()) {
builder.append(entityType.getId()).append(" ");
}
- player.sendMessage(StaticCaption.of("" + builder));
+ player.sendMessage(StaticCaption.miniMessage("" + builder));
});
EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId))
.forEach(entityType -> {
@@ -135,7 +135,7 @@ public class Debug extends SubCommand {
if (categoryCount > 0) {
return;
}
- player.sendMessage(StaticCaption.of("" + entityType.getName() + " is in "
+ player.sendMessage(StaticCaption.miniMessage("" + entityType.getName() + " is in "
+ categoryCount + " categories"));
});
return true;
@@ -170,7 +170,7 @@ public class Debug extends SubCommand {
PlaceholderResolver.placeholders(Placeholder.miniMessage("var", "Total Messages"),
Placeholder.miniMessage("val", String.valueOf(captions.size())))
));
- player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(information.build())));
+ player.sendMessage(StaticCaption.miniMessage(MINI_MESSAGE.serialize(information.build())));
return true;
}
diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java
index f4fc87f34..386d37a12 100644
--- a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java
+++ b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java
@@ -228,7 +228,7 @@ public class DebugExec extends SubCommand {
}
}
}
- player.sendMessage(StaticCaption.of("Possible sub commands: /plot debugexec <"
+ player.sendMessage(StaticCaption.miniMessage("Possible sub commands: /plot debugexec <"
+ StringMan.join(allowedParams, " | ") + ">"));
return false;
}
diff --git a/Core/src/main/java/com/plotsquared/core/command/Download.java b/Core/src/main/java/com/plotsquared/core/command/Download.java
index 17f3cd1e1..ab5c18595 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Download.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Download.java
@@ -193,7 +193,7 @@ public class Download extends SubCommand {
Placeholder.miniMessage("download", value.toString()),
Placeholder.miniMessage("delete", "Not available")
);
- player.sendMessage(StaticCaption.of(value.toString()));
+ player.sendMessage(StaticCaption.miniMessage(value.toString()));
}
});
});
diff --git a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java
index fb30ba826..1507da319 100644
--- a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java
+++ b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java
@@ -595,7 +595,7 @@ public final class FlagCommand extends Command {
)
));
}
- player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build())));
+ player.sendMessage(StaticCaption.miniMessage(MINI_MESSAGE.serialize(builder.build())));
}
}
diff --git a/Core/src/main/java/com/plotsquared/core/command/Help.java b/Core/src/main/java/com/plotsquared/core/command/Help.java
index bff088ca2..af9cbd974 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Help.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Help.java
@@ -142,7 +142,7 @@ public class Help extends Command {
builder.append(Component.newline()).append(MINI_MESSAGE.parse(TranslatableCaption
.miniMessage("help.help_footer")
.getComponent(player)));
- player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.asComponent())));
+ player.sendMessage(StaticCaption.miniMessage(MINI_MESSAGE.serialize(builder.asComponent())));
return true;
}
new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages().generatePage(
diff --git a/Core/src/main/java/com/plotsquared/core/command/Inbox.java b/Core/src/main/java/com/plotsquared/core/command/Inbox.java
index 777d9d869..39c8ae5ff 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Inbox.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Inbox.java
@@ -122,7 +122,7 @@ public class Inbox extends SubCommand {
commentTemplate
)));
}
- player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build())));
+ player.sendMessage(StaticCaption.miniMessage(MINI_MESSAGE.serialize(builder.build())));
}
@Override
diff --git a/Core/src/main/java/com/plotsquared/core/command/Info.java b/Core/src/main/java/com/plotsquared/core/command/Info.java
index 44d62e443..16bf87d98 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Info.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Info.java
@@ -129,11 +129,11 @@ public class Info extends SubCommand {
info = getCaption(arg);
if (info == null) {
if (Settings.Ratings.USE_LIKES) {
- player.sendMessage(StaticCaption.of(
+ player.sendMessage(StaticCaption.miniMessage(
"&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
+ "&aowner&7, " + " &alikes"));
} else {
- player.sendMessage(StaticCaption.of(
+ player.sendMessage(StaticCaption.miniMessage(
"&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
+ "&aowner&7, " + " &arating"));
}
diff --git a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java
index 1e85570a9..39581977a 100644
--- a/Core/src/main/java/com/plotsquared/core/command/ListCmd.java
+++ b/Core/src/main/java/com/plotsquared/core/command/ListCmd.java
@@ -493,7 +493,7 @@ public class ListCmd extends SubCommand {
}
Placeholder> players = Placeholder.miniMessage("players", builder.asComponent().toString());
caption.set(TranslatableCaption.miniMessage("info.plot_list_item"));
- caption.setPlaceholders(command_tp, command_info, hover_info, numberTemplate, plotTemplate, players);
+ caption.parsePlaceholders(command_tp, command_info, hover_info, numberTemplate, plotTemplate, players);
}
}, "/plot list " + args[0], TranslatableCaption.miniMessage("list.plot_list_header_paged"));
}
diff --git a/Core/src/main/java/com/plotsquared/core/command/Load.java b/Core/src/main/java/com/plotsquared/core/command/Load.java
index 4ba50fda9..86b238d97 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Load.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Load.java
@@ -210,7 +210,7 @@ public class Load extends SubCommand {
PlotId id = PlotId.fromString(split[2] + ';' + split[3]);
String size = split[4];
String color = "";
- player.sendMessage(StaticCaption.of("[" + (i + 1) + "] " + color + time + " | " + color + world + ';' + id
+ player.sendMessage(StaticCaption.miniMessage("[" + (i + 1) + "] " + color + time + " | " + color + world + ';' + id
+ " | " + color + size + 'x' + size));
} catch (Exception e) {
e.printStackTrace();
diff --git a/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java b/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java
index 11fd7c5f8..f9aa851ce 100644
--- a/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java
+++ b/Core/src/main/java/com/plotsquared/core/command/PluginCmd.java
@@ -43,19 +43,23 @@ public class PluginCmd extends SubCommand {
public boolean onCommand(final PlotPlayer> player, String[] args) {
TaskManager.getPlatformImplementation().taskAsync(() -> {
player.sendMessage(
- StaticCaption.of(">> " + PlotSquared
+ StaticCaption.miniMessage(">> " + PlotSquared
.platform()
.pluginName() + " (Version: )"),
Placeholder.miniMessage("version", String.valueOf(PlotSquared.get().getVersion()))
);
- player.sendMessage(StaticCaption.of(
- ">> Authors: Citymonstret & Empire92 & MattBDev & dordsor21 & NotMyFault & SirYwell"));
- player.sendMessage(StaticCaption.of(
- ">> Wiki: https://github.com/IntellectualSites/PlotSquared-Documentation/wiki"));
- player.sendMessage(StaticCaption.of(
- ">> Discord: https://discord.gg/intellectualsites"));
+ player.sendMessage(StaticCaption.miniMessage(
+ ">> Authors: Citymonstret & " +
+ "Empire92 & MattBDev & " +
+ "dordsor21 & NotMyFault & SirYwell"));
+ player.sendMessage(StaticCaption.miniMessage(
+ ">> Wiki:" +
+ "https://github.com/IntellectualSites/PlotSquared-Documentation/wiki"));
+ player.sendMessage(StaticCaption.miniMessage(
+ ">> Discord:" +
+ "https://discord.gg/intellectualsites"));
player.sendMessage(
- StaticCaption.of(">> Premium: "),
+ StaticCaption.miniMessage(">> Premium: "),
Placeholder.miniMessage("value", String.valueOf(PremiumVerification.isPremium()))
);
});
diff --git a/Core/src/main/java/com/plotsquared/core/command/RequiredType.java b/Core/src/main/java/com/plotsquared/core/command/RequiredType.java
index 46e359c0d..185fec9e0 100644
--- a/Core/src/main/java/com/plotsquared/core/command/RequiredType.java
+++ b/Core/src/main/java/com/plotsquared/core/command/RequiredType.java
@@ -33,7 +33,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
public enum RequiredType {
CONSOLE(TranslatableCaption.miniMessage("console.not_console")),
PLAYER(TranslatableCaption.miniMessage("console.is_console")),
- NONE(StaticCaption.of("Something went wrong: RequiredType=NONE")); // this caption should never be sent
+ NONE(StaticCaption.miniMessage("Something went wrong: RequiredType=NONE")); // this caption should never be sent
private final Caption caption;
diff --git a/Core/src/main/java/com/plotsquared/core/command/Set.java b/Core/src/main/java/com/plotsquared/core/command/Set.java
index 4f67a2fd3..b102fb9c6 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Set.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Set.java
@@ -204,7 +204,7 @@ public class Set extends SubCommand {
if (plot != null) {
newValues.addAll(Arrays.asList(plot.getManager().getPlotComponents(plot.getId())));
}
- player.sendMessage(StaticCaption.of(TranslatableCaption
+ player.sendMessage(StaticCaption.miniMessage(TranslatableCaption
.miniMessage("commandconfig.subcommand_set_options_header_only")
.getComponent(player) + StringMan
.join(newValues, TranslatableCaption.miniMessage("blocklist.block_list_separator").getComponent(player))));
diff --git a/Core/src/main/java/com/plotsquared/core/command/Setup.java b/Core/src/main/java/com/plotsquared/core/command/Setup.java
index 4ea23943b..946af6661 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Setup.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Setup.java
@@ -72,7 +72,7 @@ public class Setup extends SubCommand {
message.append("\n - ").append(entry.getKey()).append(" (Unknown structure)");
}
}
- player.sendMessage(StaticCaption.of(message.toString()));
+ player.sendMessage(StaticCaption.miniMessage(message.toString()));
}
@Override
diff --git a/Core/src/main/java/com/plotsquared/core/command/Trim.java b/Core/src/main/java/com/plotsquared/core/command/Trim.java
index 0a73e490c..1552a1c30 100644
--- a/Core/src/main/java/com/plotsquared/core/command/Trim.java
+++ b/Core/src/main/java/com/plotsquared/core/command/Trim.java
@@ -104,9 +104,9 @@ public class Trim extends SubCommand {
}
result.value1 = new HashSet<>(PlotSquared.platform().worldUtil().getChunkChunks(world));
result.value2 = new HashSet<>();
- StaticCaption.of(" - MCA #: " + result.value1.size());
- StaticCaption.of(" - CHUNKS: " + (result.value1.size() * 1024) + " (max)");
- StaticCaption.of(" - TIME ESTIMATE: 12 Parsecs");
+ StaticCaption.miniMessage(" - MCA #: " + result.value1.size());
+ StaticCaption.miniMessage(" - CHUNKS: " + (result.value1.size() * 1024) + " (max)");
+ StaticCaption.miniMessage(" - TIME ESTIMATE: 12 Parsecs");
TaskManager.getPlatformImplementation().objectTask(plots, new RunnableVal<>() {
@Override
public void run(Plot plot) {
diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionHolder.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionHolder.java
index 97a63f5fe..2c3e69b4e 100644
--- a/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionHolder.java
+++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/CaptionHolder.java
@@ -24,28 +24,40 @@
* along with this program. If not, see .
*/
package com.plotsquared.core.configuration.caption;
-
-import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
-
-public class CaptionHolder {
-
- private Caption caption = StaticCaption.of("");
- private Placeholder>[] placeholders = new Placeholder[0];
-
- public void set(Caption caption) {
- this.caption = caption;
- }
-
- public Caption get() {
- return this.caption;
- }
-
- public Placeholder>[] getPlaceholders() {
- return this.placeholders;
- }
-
- public void setPlaceholders(Placeholder>... placeholders) {
- this.placeholders = placeholders;
- }
-
-}
+
+import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
+
+public class CaptionHolder {
+
+ private Caption caption = StaticCaption.miniMessage("");
+ private Placeholder>[] placeholders = new Placeholder[0];
+
+ public void set(Caption caption) {
+ this.caption = caption;
+ }
+
+ /**
+ * @return a {@link Caption} from a {@link StaticCaption}
+ * @since 6.3.0
+ */
+ public Caption caption() {
+ return this.caption;
+ }
+
+ /**
+ * @return an array of {@link net.kyori.adventure.text.minimessage.placeholder.Placeholder}s
+ * @since 6.3.0
+ */
+ public Placeholder>[] placeholders() {
+ return this.placeholders;
+ }
+
+ /**
+ * @param placeholders placeholders
+ * @since 6.3.0
+ */
+ public void parsePlaceholders(Placeholder>... placeholders) {
+ this.placeholders = placeholders;
+ }
+
+}
diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/StaticCaption.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/StaticCaption.java
index 675142d30..c7c47c2a1 100644
--- a/Core/src/main/java/com/plotsquared/core/configuration/caption/StaticCaption.java
+++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/StaticCaption.java
@@ -41,11 +41,24 @@ public final class StaticCaption implements Caption {
*
* @param text Text
* @return Created caption
+ * @deprecated Use {@link #miniMessage(String)} instead
*/
+ @Deprecated(forRemoval = true, since = "6.3.0")
public static @NonNull StaticCaption of(final @NonNull String text) {
return new StaticCaption(Preconditions.checkNotNull(text, "Text may not be null"));
}
+ /**
+ * Create a new static caption from the given text
+ *
+ * @param text Text
+ * @return Created caption
+ * @since 6.3.0
+ */
+ public static @NonNull StaticCaption miniMessage(final @NonNull String text) {
+ return new StaticCaption(Preconditions.checkNotNull(text, "Text may not be null"));
+ }
+
@Override
public @NonNull String getComponent(@NonNull LocaleHolder localeHolder) {
return this.value; // can't be translated
diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java
index 7f7997167..694fc8ca0 100644
--- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java
+++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java
@@ -328,9 +328,9 @@ public class PlotListener {
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) {
final UUID plotOwner = plot.getOwnerAbs();
String owner = PlayerManager.getName(plotOwner, false);
- Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.miniMessage("titles" +
+ Caption header = fromFlag ? StaticCaption.miniMessage(title) : TranslatableCaption.miniMessage("titles" +
".title_entered_plot");
- Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.miniMessage("titles" +
+ Caption subHeader = fromFlag ? StaticCaption.miniMessage(subtitle) : TranslatableCaption.miniMessage("titles" +
".title_entered_plot_sub");
Placeholder> plotTemplate = Placeholder.miniMessage("plot", lastPlot.getId().toString());
Placeholder> worldTemplate = Placeholder.miniMessage("world", player.getLocation().getWorldName());
diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java
index 619c1f1bd..7959756dd 100644
--- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java
+++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java
@@ -836,6 +836,7 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer,
* @param title Title text
* @param subtitle Subtitle text
* @param replacements Variable replacements
+ * @since 6.3.0
*/
public void sendTitle(
final @NonNull Caption title, final @NonNull Caption subtitle,
@@ -860,6 +861,7 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer,
* @param stay The title stays for (in ticks)
* @param fadeOut Fade out time (in ticks)
* @param replacements Variable replacements
+ * @since 6.3.0
*/
public void sendTitle(
final @NonNull Caption title, final @NonNull Caption subtitle,
@@ -885,6 +887,7 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer,
*
* @param caption Caption
* @param replacements Variable replacements
+ * @since 6.3.0
*/
public void sendActionBar(
final @NonNull Caption caption,
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 1d9c39e8c..993550196 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java
@@ -2946,7 +2946,7 @@ public class Plot {
}
}
}
- future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
+ future.complete(StaticCaption.miniMessage(MINI_MESSAGE.serialize(MINI_MESSAGE
.deserialize(
iInfo.getComponent(player),
PlaceholderResolver.placeholders(
@@ -2973,7 +2973,7 @@ public class Plot {
});
return;
}
- future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
+ future.complete(StaticCaption.miniMessage(MINI_MESSAGE.serialize(MINI_MESSAGE
.deserialize(
iInfo.getComponent(player),
PlaceholderResolver.placeholders(
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 4077ea2e9..24ab16382 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java
@@ -375,6 +375,7 @@ public final class PlotModificationManager {
* Sets the sign for a plot to a specific name
*
* @param name name
+ * @since 6.3.0
*/
public void setSign(final @NonNull String name) {
if (!this.plot.isLoaded()) {
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 3ffe7e244..c6ac7d62e 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
@@ -75,7 +75,7 @@ public class CommentManager {
}
if ((size.decrementAndGet() == 0) && (total > 0)) {
player.sendTitle(
- StaticCaption.of(""),
+ StaticCaption.miniMessage(""),
TranslatableCaption.miniMessage("comment.inbox_notification"),
Placeholder.miniMessage("amount", Integer.toString(total)),
Placeholder.miniMessage("command", "/plot inbox")
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 d3876e7d2..06e2b0d05 100644
--- a/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java
+++ b/Core/src/main/java/com/plotsquared/core/util/WorldUtil.java
@@ -142,6 +142,7 @@ public abstract class WorldUtil {
* @param location Block location
* @param lines Sign text
* @param replacements Text replacements
+ * @since 6.3.0
*/
public abstract void setSign(
@NonNull Location location,
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 df5f6e073..5b29e57c6 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
@@ -71,7 +71,7 @@ public class HelpPage {
Placeholder> help_objects = Placeholder.miniMessage("help_objects", StringMan.join(this.helpObjects, "\n"));
Placeholder> footer = Placeholder.miniMessage("footer", TranslatableCaption.miniMessage("help.help_footer").getComponent(player));
player.sendMessage(
- StaticCaption.of("\n\n\n