refactor!: Update minimessage implementation

This commit is contained in:
NotMyFault 2021-12-15 01:20:26 +01:00
parent 8859871e89
commit fda01502b2
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
215 changed files with 2401 additions and 2306 deletions

View File

@ -68,7 +68,7 @@ import com.plotsquared.core.util.task.TaskTime;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
@ -282,16 +282,16 @@ public class BlockEventListener implements Listener {
.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { .hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true); event.setCancelled(true);
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("height.height_limit"), TranslatableCaption.miniMessage("height.height_limit"),
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())), Placeholder.miniMessage("minHeight", String.valueOf(area.getMinBuildHeight())),
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight())) Placeholder.miniMessage("maxHeight", String.valueOf(area.getMaxBuildHeight()))
); );
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -307,8 +307,8 @@ public class BlockEventListener implements Listener {
} }
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
plot.debug(player.getName() + " could not place " + event.getBlock().getType() plot.debug(player.getName() + " could not place " + event.getBlock().getType()
@ -318,7 +318,7 @@ public class BlockEventListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -334,8 +334,8 @@ public class BlockEventListener implements Listener {
} }
} else if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) { } else if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -356,8 +356,8 @@ public class BlockEventListener implements Listener {
if (!Permissions if (!Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) { .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL))
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -367,9 +367,9 @@ public class BlockEventListener implements Listener {
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true); event.setCancelled(true);
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("height.height_limit"), TranslatableCaption.miniMessage("height.height_limit"),
Template.of("minHeight", String.valueOf(area.getMinBuildHeight())), Placeholder.miniMessage("minHeight", String.valueOf(area.getMinBuildHeight())),
Template.of("maxHeight", String.valueOf(area.getMaxBuildHeight())) Placeholder.miniMessage("maxHeight", String.valueOf(area.getMaxBuildHeight()))
); );
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
@ -393,14 +393,14 @@ public class BlockEventListener implements Listener {
return; return;
} }
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -419,8 +419,8 @@ public class BlockEventListener implements Listener {
} }
} }
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1094,24 +1094,24 @@ public class BlockEventListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -44,7 +44,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.TileState; import org.bukkit.block.TileState;
@ -301,8 +301,8 @@ public class PaperListener implements Listener {
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) { if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer()); final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("errors.tile_entity_cap_reached"), TranslatableCaption.miniMessage("errors.tile_entity_cap_reached"),
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES)) Placeholder.miniMessage("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
); );
event.setCancelled(true); event.setCancelled(true);
event.setBuild(false); event.setBuild(false);

View File

@ -33,7 +33,7 @@ import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.block.Banner; import org.bukkit.block.Banner;
import org.bukkit.block.Beacon; import org.bukkit.block.Beacon;
import org.bukkit.block.Bed; import org.bukkit.block.Bed;
@ -83,8 +83,8 @@ public class PaperListener113 extends PaperListener {
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) { if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer()); final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("errors.tile_entity_cap_reached"), TranslatableCaption.miniMessage("errors.tile_entity_cap_reached"),
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES)) Placeholder.miniMessage("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
); );
event.setCancelled(true); event.setCancelled(true);
event.setBuild(false); event.setBuild(false);

View File

@ -87,7 +87,7 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.FluidCollisionMode; import org.bukkit.FluidCollisionMode;
@ -309,7 +309,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
perm = "plots.admin.command.blocked-cmds.road"; perm = "plots.admin.command.blocked-cmds.road";
} }
if (!Permissions.hasPermission(plotPlayer, perm)) { if (!Permissions.hasPermission(plotPlayer, perm)) {
plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked")); plotPlayer.sendMessage(TranslatableCaption.miniMessage("blockedcmds.command_blocked"));
event.setCancelled(true); event.setCancelled(true);
} }
return; return;
@ -362,11 +362,11 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (pp.hasPermission(Permission.PERMISSION_ADMIN_UPDATE_NOTIFICATION.toString()) && Settings.Enabled_Components.UPDATE_NOTIFICATIONS if (pp.hasPermission(Permission.PERMISSION_ADMIN_UPDATE_NOTIFICATION.toString()) && Settings.Enabled_Components.UPDATE_NOTIFICATIONS
&& PremiumVerification.isPremium() && UpdateUtility.hasUpdate) { && PremiumVerification.isPremium() && UpdateUtility.hasUpdate) {
Caption boundary = TranslatableCaption.of("update.update_boundary"); Caption boundary = TranslatableCaption.miniMessage("update.update_boundary");
Caption updateNotification = TranslatableCaption.of("update.update_notification"); Caption updateNotification = TranslatableCaption.miniMessage("update.update_notification");
Template internalVersion = Template.of("p2version", UpdateUtility.internalVersion.versionString()); Placeholder<?> internalVersion = Placeholder.miniMessage("p2version", UpdateUtility.internalVersion.versionString());
Template spigotVersion = Template.of("spigotversion", UpdateUtility.spigotVersion); Placeholder<?> spigotVersion = Placeholder.miniMessage("spigotversion", UpdateUtility.spigotVersion);
Template downloadUrl = Template.of("downloadurl", "https://www.spigotmc.org/resources/77506/updates"); Placeholder<?> downloadUrl = Placeholder.miniMessage("downloadurl", "https://www.spigotmc.org/resources/77506/updates");
pp.sendMessage(boundary); pp.sendMessage(boundary);
pp.sendMessage(updateNotification, internalVersion, spigotVersion, downloadUrl); pp.sendMessage(updateNotification, internalVersion, spigotVersion, downloadUrl);
pp.sendMessage(boundary); pp.sendMessage(boundary);
@ -418,8 +418,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
.getHomeSynchronous() .getHomeSynchronous()
.equals(BukkitUtil.adaptComplete(to)))) { .equals(BukkitUtil.adaptComplete(to)))) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -507,7 +507,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
BukkitPlayer pp = BukkitUtil.adapt(player); BukkitPlayer pp = BukkitUtil.adapt(player);
// Cancel teleport // Cancel teleport
if (TaskManager.removeFromTeleportQueue(pp.getName())) { if (TaskManager.removeFromTeleportQueue(pp.getName())) {
pp.sendMessage(TranslatableCaption.of("teleport.teleport_failed")); pp.sendMessage(TranslatableCaption.miniMessage("teleport.teleport_failed"));
} }
// Set last location // Set last location
Location location = BukkitUtil.adapt(to); Location location = BukkitUtil.adapt(to);
@ -534,8 +534,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) { pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
); );
this.tmpTeleport = false; this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) { if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
@ -552,8 +552,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
ForceFieldListener.handleForcefield(player, pp, now); ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) { } else if (!plotEntry(pp, now) && this.tmpTeleport) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
); );
this.tmpTeleport = false; this.tmpTeleport = false;
to.setX(from.getBlockX()); to.setX(from.getBlockX());
@ -571,9 +571,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied")); pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else { } else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
} }
} else if (x2 < -border && this.tmpTeleport) { } else if (x2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
@ -581,13 +581,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied")); pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else { } else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
} }
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) { } else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.of("border.bypass.entered")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.entered"));
} }
} }
} }
@ -597,7 +597,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
BukkitPlayer pp = BukkitUtil.adapt(player); BukkitPlayer pp = BukkitUtil.adapt(player);
// Cancel teleport // Cancel teleport
if (TaskManager.removeFromTeleportQueue(pp.getName())) { if (TaskManager.removeFromTeleportQueue(pp.getName())) {
pp.sendMessage(TranslatableCaption.of("teleport.teleport_failed")); pp.sendMessage(TranslatableCaption.miniMessage("teleport.teleport_failed"));
} }
// Set last location // Set last location
Location location = BukkitUtil.adapt(to); Location location = BukkitUtil.adapt(to);
@ -624,8 +624,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) { pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_KICK)) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) { if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !kickAccess.get().orElse(false)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_EXIT_DENIED))
); );
this.tmpTeleport = false; this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) { if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
@ -642,8 +642,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
ForceFieldListener.handleForcefield(player, pp, now); ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) { } else if (!plotEntry(pp, now) && this.tmpTeleport) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_ENTRY_DENIED))
); );
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(from); player.teleport(from);
@ -662,9 +662,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied")); pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else { } else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
} }
} else if (z2 < -border && this.tmpTeleport) { } else if (z2 < -border && this.tmpTeleport) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
@ -672,13 +672,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied")); pp.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} else { } else {
pp.sendMessage(TranslatableCaption.of("border.bypass.exited")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.exited"));
} }
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) { } else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {
if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
pp.sendMessage(TranslatableCaption.of("border.bypass.entered")); pp.sendMessage(TranslatableCaption.miniMessage("border.bypass.entered"));
} }
} }
} }
@ -727,45 +727,45 @@ public class PlayerEventListener extends PlotListener implements Listener {
String sender = event.getPlayer().getDisplayName(); String sender = event.getPlayer().getDisplayName();
PlotId id = plot.getId(); PlotId id = plot.getId();
String worldName = plot.getWorldName(); String worldName = plot.getWorldName();
Caption msg = TranslatableCaption.of("chat.plot_chat_format"); Caption msg = TranslatableCaption.miniMessage("chat.plot_chat_format");
Template msgTemplate; Placeholder<?> msgTemplate;
Template worldNameTemplate = Template.of("world", worldName); Placeholder<?> worldNameTemplate = Placeholder.miniMessage("world", worldName);
Template plotTemplate = Template.of("plot_id", id.toString()); Placeholder<?> plotTemplate = Placeholder.miniMessage("plot_id", id.toString());
Template senderTemplate = Template.of("sender", sender); 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 <gold></gold> or &6 etc. // If we do/don't want colour, we need to be careful about how to go about it, as players could attempt either <gold></gold> or &6 etc.
// In both cases, we want to use a Component Template to ensure that the player cannot use any placeholders in their message on purpose // In both cases, we want to use a Component Template to ensure that the player cannot use any of 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 // 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. // allowing colour.
if (plotPlayer.hasPermission("plots.chat.color")) { if (plotPlayer.hasPermission("plots.chat.color")) {
msgTemplate = Template msgTemplate = Placeholder
.of( .miniMessage(
"msg", "msg",
BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes( BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes(
'&', '&',
message message
)) )).toString()
); );
} else { } else {
msgTemplate = Template.of("msg", BukkitUtil.MINI_MESSAGE.deserialize( msgTemplate = Placeholder.miniMessage("msg", BukkitUtil.MINI_MESSAGE.deserialize(
ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message))))); ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))).toString());
} }
for (PlotPlayer<?> receiver : plotRecipients) { for (PlotPlayer<?> receiver : plotRecipients) {
receiver.sendMessage(msg, worldNameTemplate, msgTemplate, plotTemplate, senderTemplate); receiver.sendMessage(msg, worldNameTemplate, msgTemplate, plotTemplate, senderTemplate);
} }
if (!spies.isEmpty()) { if (!spies.isEmpty()) {
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format"); Caption spymsg = TranslatableCaption.miniMessage("chat.plot_chat_spy_format");
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY()); Placeholder<?> plotidTemplate = Placeholder.miniMessage("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.of("sender", sender); Placeholder<?> spysenderTemplate = Placeholder.miniMessage("sender", sender);
Template spymessageTemplate = Template.of("msg", Component.text(message)); Placeholder<?> spymessageTemplate = Placeholder.miniMessage("msg", Component.text(message).toString());
for (PlotPlayer<?> player : spies) { for (PlotPlayer<?> player : spies) {
player.sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, spymessageTemplate); player.sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, spymessageTemplate);
} }
} }
if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) { if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) {
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format"); Caption spymsg = TranslatableCaption.miniMessage("chat.plot_chat_spy_format");
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY()); Placeholder<?> plotidTemplate = Placeholder.miniMessage("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.of("sender", sender); Placeholder<?> spysenderTemplate = Placeholder.miniMessage("sender", sender);
Template spymessageTemplate = Template.of("msg", Component.text(message)); Placeholder<?> spymessageTemplate = Placeholder.miniMessage("msg", Component.text(message).toString());
ConsolePlayer.getConsole().sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, ConsolePlayer.getConsole().sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate,
spymessageTemplate spymessageTemplate
); );
@ -920,16 +920,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
); );
cancelled = true; cancelled = true;
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
); );
cancelled = true; cancelled = true;
} }
@ -938,8 +938,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.isAdded(uuid)) { if (!plot.isAdded(uuid)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
); );
cancelled = true; cancelled = true;
} }
@ -976,8 +976,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!area.isRoadFlags() && !area.getRoadFlag(MiscInteractFlag.class) && !Permissions if (!area.isRoadFlags() && !area.getRoadFlag(MiscInteractFlag.class) && !Permissions
.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) { .hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
); );
e.setCancelled(true); e.setCancelled(true);
} }
@ -985,7 +985,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -994,8 +994,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
); );
e.setCancelled(true); e.setCancelled(true);
} }
@ -1009,8 +1009,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
} }
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
); );
e.setCancelled(true); e.setCancelled(true);
plot.debug(pp.getName() + " could not interact with " + entity.getType() plot.debug(pp.getName() + " could not interact with " + entity.getType()
@ -1225,8 +1225,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
@ -1234,8 +1234,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
@ -1250,14 +1250,14 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1297,8 +1297,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
@ -1306,8 +1306,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.isAdded(plotPlayer.getUUID())) { } else if (!plot.isAdded(plotPlayer.getUUID())) {
@ -1323,14 +1323,14 @@ public class PlayerEventListener extends PlotListener implements Listener {
return; return;
} }
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1355,8 +1355,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1364,8 +1364,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1375,8 +1375,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.getFlag(HangingPlaceFlag.class)) { if (!plot.getFlag(HangingPlaceFlag.class)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1404,16 +1404,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1423,8 +1423,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
} }
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
plot.debug(p.getName() plot.debug(p.getName()
@ -1445,8 +1445,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) { .hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1455,8 +1455,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_DESTROY_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
plot.debug(player.getName() plot.debug(player.getName()
@ -1487,16 +1487,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null && !area.isRoadFlags()) { if (plot == null && !area.isRoadFlags()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
} else if (plot != null && !plot.hasOwner()) { } else if (plot != null && !plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1553,8 +1553,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1575,8 +1575,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1584,8 +1584,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED))
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -1598,8 +1598,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
} }
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
plot.debug(pp.getName() plot.debug(pp.getName()
@ -1623,24 +1623,24 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
); );
event.setHatching(false); event.setHatching(false);
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
); );
event.setHatching(false); event.setHatching(false);
} }
} else if (!plot.isAdded(plotPlayer.getUUID())) { } else if (!plot.isAdded(plotPlayer.getUUID())) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
); );
event.setHatching(false); event.setHatching(false);
} }

View File

@ -50,7 +50,7 @@ public class ServerListener implements Listener {
public void onServerLoad(ServerLoadEvent event) { public void onServerLoad(ServerLoadEvent event) {
if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null && Settings.Enabled_Components.USE_MVDWAPI) { if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null && Settings.Enabled_Components.USE_MVDWAPI) {
new MVdWPlaceholders(this.plugin, this.plugin.placeholderRegistry()); new MVdWPlaceholders(this.plugin, this.plugin.placeholderRegistry());
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("placeholder.hooked")); ConsolePlayer.getConsole().sendMessage(TranslatableCaption.miniMessage("placeholder.hooked"));
} }
} }

View File

@ -51,7 +51,7 @@ public class MVdWPlaceholders {
) { ) {
this.plugin = plugin; this.plugin = plugin;
this.registry = registry; this.registry = registry;
for (final Placeholder placeholder : registry.getPlaceholders()) { for (final Placeholder placeholder : registry.allPlaceholders()) {
this.addPlaceholder(placeholder); this.addPlaceholder(placeholder);
} }
PlotSquared.get().getEventDispatcher().registerListener(this); PlotSquared.get().getEventDispatcher().registerListener(this);

View File

@ -50,7 +50,7 @@ import com.plotsquared.core.util.EntityUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.entity.EntityCategories; import com.plotsquared.core.util.entity.EntityCategories;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -178,7 +178,7 @@ public class BukkitEntityUtil {
if (!Permissions if (!Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("done.building_restricted") TranslatableCaption.miniMessage("done.building_restricted")
); );
return false; return false;
} }
@ -187,8 +187,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
); );
return false; return false;
} }
@ -199,8 +199,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
); );
if (plot != null) { if (plot != null) {
plot.debug(player.getName() plot.debug(player.getName()
@ -220,8 +220,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
); );
if (plot != null) { if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType plot.debug(player.getName() + " could not attack " + entityType
@ -241,8 +241,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
); );
if (plot != null) { if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType plot.debug(player.getName() + " could not attack " + entityType
@ -255,8 +255,8 @@ public class BukkitEntityUtil {
if (!plot.getFlag(PvpFlag.class) && !Permissions if (!plot.getFlag(PvpFlag.class) && !Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) { .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
); );
plot.debug(player.getName() + " could not attack " + entityType plot.debug(player.getName() + " could not attack " + entityType
+ " because pve = false"); + " because pve = false");
@ -269,8 +269,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
); );
return false; return false;
} }
@ -286,8 +286,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
); );
if (plot != null) { if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType plot.debug(player.getName() + " could not attack " + entityType
@ -308,8 +308,8 @@ public class BukkitEntityUtil {
} }
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.miniMessage("permission.no_permission_event"),
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
); );
if (plot != null) { if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType plot.debug(player.getName() + " could not attack " + entityType

View File

@ -53,7 +53,8 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -337,7 +338,7 @@ public class BukkitUtil extends WorldUtil {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void setSign( public void setSign(
final @NonNull Location location, final @NonNull Caption[] lines, final @NonNull Location location, final @NonNull Caption[] lines,
final @NonNull Template... replacements final @NonNull Placeholder<?>... replacements
) { ) {
ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> { ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> {
PlotArea area = location.getPlotArea(); PlotArea area = location.getPlotArea();
@ -369,7 +370,8 @@ public class BukkitUtil extends WorldUtil {
if (blockstate instanceof final Sign sign) { if (blockstate instanceof final Sign sign) {
for (int i = 0; i < lines.length; i++) { for (int i = 0; i < lines.length; i++) {
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
.serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()), replacements))); .serialize(MINI_MESSAGE.deserialize(lines[i].getComponent(LocaleHolder.console()),
PlaceholderResolver.placeholders(replacements))));
} }
sign.update(true); sign.update(true);
} }

View File

@ -37,7 +37,7 @@ import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -149,10 +149,11 @@ public class PlotAPI {
* *
* @param message the message * @param message the message
* @param replacements Variable replacements * @param replacements Variable replacements
* @since 6.3.0
*/ */
public void sendConsoleMessage( public void sendConsoleMessage(
final @NonNull String message, final @NonNull String message,
final @NonNull Template @NonNull ... replacements final @NonNull Placeholder<?> @NonNull ... replacements
) { ) {
ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements); ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements);
} }
@ -162,10 +163,11 @@ public class PlotAPI {
* *
* @param caption the message * @param caption the message
* @param replacements Variable replacements * @param replacements Variable replacements
* @since 6.3.0
*/ */
public void sendConsoleMessage( public void sendConsoleMessage(
final @NonNull Caption caption, final @NonNull Caption caption,
final @NonNull Template @NonNull ... replacements final @NonNull Placeholder<?> @NonNull ... replacements
) { ) {
ConsolePlayer.getConsole().sendMessage(caption, replacements); ConsolePlayer.getConsole().sendMessage(caption, replacements);
} }

View File

@ -209,7 +209,7 @@ public class PlayerBackupProfile implements BackupProfile {
} else { } else {
future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens( future.completeExceptionally(new RuntimeException(MINI_MESSAGE.stripTokens(
TranslatableCaption TranslatableCaption
.of("schematics.schematic_paste_failed") .miniMessage("schematics.schematic_paste_failed")
.getComponent(ConsolePlayer.getConsole())))); .getComponent(ConsolePlayer.getConsole()))));
} }
} }

View File

@ -31,13 +31,12 @@ import com.google.inject.Inject;
import com.google.inject.Singleton; import com.google.inject.Singleton;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.Placeholders;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory; import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -106,22 +105,22 @@ public class SimpleBackupManager implements BackupManager {
} else { } else {
if (player != null) { if (player != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_automatic_started"), TranslatableCaption.miniMessage("backups.backup_automatic_started"),
Template.of("plot", plot.getId().toString()) Placeholders.miniMessage("plot", plot.getId().toString())
); );
} }
profile.createBackup().whenComplete((backup, throwable) -> { profile.createBackup().whenComplete((backup, throwable) -> {
if (throwable != null) { if (throwable != null) {
if (player != null) { if (player != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_automatic_failure"), TranslatableCaption.miniMessage("backups.backup_automatic_failure"),
Templates.of("reason", throwable.getMessage()) Placeholders.miniMessage("reason", throwable.getMessage())
); );
} }
throwable.printStackTrace(); throwable.printStackTrace();
} else { } else {
if (player != null) { if (player != null) {
player.sendMessage(TranslatableCaption.of("backups.backup_automatic_finished")); player.sendMessage(TranslatableCaption.miniMessage("backups.backup_automatic_finished"));
TaskManager.runTaskAsync(whenDone); TaskManager.runTaskAsync(whenDone);
} }
} }

View File

@ -38,7 +38,7 @@ import com.plotsquared.core.util.PlayerManager;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection; import java.util.Collection;
@ -69,33 +69,33 @@ public class Add extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone RunnableVal2<Command, CommandResult> whenDone
) throws CommandException { ) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot")); final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned")); checkTrue(plot.hasOwner(), TranslatableCaption.miniMessage("info.plot_unowned"));
checkTrue( checkTrue(
plot.isOwner(player.getUUID()) || Permissions plot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST), .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST),
TranslatableCaption.of("permission.no_plot_perms") TranslatableCaption.miniMessage("permission.no_plot_perms")
); );
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"), checkTrue(args.length == 1, TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot add <player | *>") Placeholder.miniMessage("value", "/plot add <player | *>")
); );
final CompletableFuture<Boolean> future = new CompletableFuture<>(); final CompletableFuture<Boolean> future = new CompletableFuture<>();
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
if (throwable != null) { if (throwable != null) {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
} }
future.completeExceptionally(throwable); future.completeExceptionally(throwable);
return; return;
} else { } else {
try { try {
checkTrue(!uuids.isEmpty(), TranslatableCaption.of("errors.invalid_player"), checkTrue(!uuids.isEmpty(), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
Iterator<UUID> iterator = uuids.iterator(); Iterator<UUID> iterator = uuids.iterator();
int size = plot.getTrusted().size() + plot.getMembers().size(); int size = plot.getTrusted().size() + plot.getMembers().size();
@ -105,24 +105,24 @@ public class Add extends Command {
Permissions.hasPermission(player, Permission.PERMISSION_TRUST_EVERYONE) || Permissions Permissions.hasPermission(player, Permission.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", PlayerManager.getName(uuid)) Placeholder.miniMessage("value", PlayerManager.getName(uuid))
); );
iterator.remove(); iterator.remove();
continue; continue;
} }
if (plot.isOwner(uuid)) { if (plot.isOwner(uuid)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("member.already_added"), TranslatableCaption.miniMessage("member.already_added"),
Template.of("player", PlayerManager.getName(uuid)) Placeholder.miniMessage("player", PlayerManager.getName(uuid))
); );
iterator.remove(); iterator.remove();
continue; continue;
} }
if (plot.getMembers().contains(uuid)) { if (plot.getMembers().contains(uuid)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("member.already_added"), TranslatableCaption.miniMessage("member.already_added"),
Template.of("player", PlayerManager.getName(uuid)) Placeholder.miniMessage("player", PlayerManager.getName(uuid))
); );
iterator.remove(); iterator.remove();
continue; continue;
@ -134,8 +134,8 @@ public class Add extends Command {
int maxAddSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_ADD, Settings.Limit.MAX_PLOTS); int maxAddSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_ADD, Settings.Limit.MAX_PLOTS);
if (localAddSize >= maxAddSize) { if (localAddSize >= maxAddSize) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("members.plot_max_members_added"), TranslatableCaption.miniMessage("members.plot_max_members_added"),
Template.of("amount", String.valueOf(localAddSize)) Placeholder.miniMessage("amount", String.valueOf(localAddSize))
); );
return; return;
} }
@ -151,7 +151,7 @@ public class Add extends Command {
} }
plot.addMember(uuid); plot.addMember(uuid);
this.eventDispatcher.callMember(player, plot, uuid, true); this.eventDispatcher.callMember(player, plot, uuid, true);
player.sendMessage(TranslatableCaption.of("member.member_added")); player.sendMessage(TranslatableCaption.miniMessage("member.member_added"));
} }
}, null); }, null);
} catch (final Throwable exception) { } catch (final Throwable exception) {

View File

@ -35,7 +35,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -67,12 +67,12 @@ public class Alias extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed")); player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
return false; return false;
} }
@ -90,7 +90,7 @@ public class Alias extends SubCommand {
permission = isPermitted(player, Permission.PERMISSION_ALIAS_SET); permission = isPermitted(player, Permission.PERMISSION_ALIAS_SET);
admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_SET); admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_SET);
if (!admin && !owner) { if (!admin && !owner) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
if (permission) { // is either admin or owner if (permission) { // is either admin or owner
@ -98,8 +98,8 @@ public class Alias extends SubCommand {
return true; return true;
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_SET)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ALIAS_SET))
); );
} }
} }
@ -107,15 +107,15 @@ public class Alias extends SubCommand {
permission = isPermitted(player, Permission.PERMISSION_ALIAS_REMOVE); permission = isPermitted(player, Permission.PERMISSION_ALIAS_REMOVE);
admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_REMOVE); admin = isPermitted(player, Permission.PERMISSION_ADMIN_ALIAS_REMOVE);
if (!admin && !owner) { if (!admin && !owner) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
if (permission) { if (permission) {
result = removeAlias(player, plot); result = removeAlias(player, plot);
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE))
); );
} }
} }
@ -147,37 +147,37 @@ public class Alias extends SubCommand {
if (alias.isEmpty()) { if (alias.isEmpty()) {
sendUsage(player); sendUsage(player);
} else if (alias.length() >= 50) { } else if (alias.length() >= 50) {
player.sendMessage(TranslatableCaption.of("alias.alias_too_long")); player.sendMessage(TranslatableCaption.miniMessage("alias.alias_too_long"));
} else if (MathMan.isInteger(alias)) { } else if (MathMan.isInteger(alias)) {
player.sendMessage(TranslatableCaption.of("flag.not_valid_value")); // TODO this is obviously wrong player.sendMessage(TranslatableCaption.miniMessage("flag.not_valid_value")); // TODO this is obviously wrong
} else { } else {
if (PlotQuery.newQuery().inArea(plot.getArea()) if (PlotQuery.newQuery().inArea(plot.getArea())
.withAlias(alias) .withAlias(alias)
.anyMatch()) { .anyMatch()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.alias_is_taken"), TranslatableCaption.miniMessage("alias.alias_is_taken"),
Template.of("alias", alias) Placeholder.miniMessage("alias", alias)
); );
return; return;
} }
if (Settings.UUID.OFFLINE) { if (Settings.UUID.OFFLINE) {
plot.setAlias(alias); plot.setAlias(alias);
player.sendMessage(TranslatableCaption.of("alias.alias_set_to"), Template.of("alias", alias)); player.sendMessage(TranslatableCaption.miniMessage("alias.alias_set_to"), Placeholder.miniMessage("alias", alias));
return; return;
} }
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(alias, ((uuid, throwable) -> { PlotSquared.get().getImpromptuUUIDPipeline().getSingle(alias, ((uuid, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (uuid != null) { } else if (uuid != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.alias_is_taken"), TranslatableCaption.miniMessage("alias.alias_is_taken"),
Template.of("alias", alias) Placeholder.miniMessage("alias", alias)
); );
} else { } else {
plot.setAlias(alias); plot.setAlias(alias);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.alias_set_to"), TranslatableCaption.miniMessage("alias.alias_set_to"),
Template.of("alias", alias) Placeholder.miniMessage("alias", alias)
); );
} }
})); }));
@ -188,12 +188,12 @@ public class Alias extends SubCommand {
String alias = plot.getAlias(); String alias = plot.getAlias();
if (!plot.getAlias().isEmpty()) { if (!plot.getAlias().isEmpty()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.alias_removed"), TranslatableCaption.miniMessage("alias.alias_removed"),
Template.of("alias", alias) Placeholder.miniMessage("alias", alias)
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.no_alias_set") TranslatableCaption.miniMessage("alias.no_alias_set")
); );
} }
plot.setAlias(null); plot.setAlias(null);

View File

@ -31,7 +31,7 @@ import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.CaptionHolder; import com.plotsquared.core.configuration.caption.CaptionHolder;
import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.Placeholders;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.events.TeleportCause;
@ -75,7 +75,8 @@ import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.File; import java.io.File;
@ -146,26 +147,26 @@ public class Area extends SubCommand {
} }
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
); );
return false; return false;
} }
if (args.length < 2) { if (args.length < 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("single.single_area_needs_name"), TranslatableCaption.miniMessage("single.single_area_needs_name"),
Template.of("command", "/plot area single <name>") Placeholder.miniMessage("command", "/plot area single <name>")
); );
return false; return false;
} }
final PlotArea existingArea = this.plotAreaManager.getPlotArea(player.getLocation().getWorldName(), args[1]); final PlotArea existingArea = this.plotAreaManager.getPlotArea(player.getLocation().getWorldName(), args[1]);
if (existingArea != null && existingArea.getId().equalsIgnoreCase(args[1])) { if (existingArea != null && existingArea.getId().equalsIgnoreCase(args[1])) {
player.sendMessage(TranslatableCaption.of("single.single_area_name_taken")); player.sendMessage(TranslatableCaption.miniMessage("single.single_area_name_taken"));
return false; return false;
} }
final LocalSession localSession = WorldEdit.getInstance().getSessionManager().getIfPresent(player.toActor()); final LocalSession localSession = WorldEdit.getInstance().getSessionManager().getIfPresent(player.toActor());
if (localSession == null) { if (localSession == null) {
player.sendMessage(TranslatableCaption.of("single.single_area_missing_selection")); player.sendMessage(TranslatableCaption.miniMessage("single.single_area_missing_selection"));
return false; return false;
} }
Region playerSelectedRegion = null; Region playerSelectedRegion = null;
@ -174,18 +175,18 @@ public class Area extends SubCommand {
} catch (final Exception ignored) { } catch (final Exception ignored) {
} }
if (playerSelectedRegion == null) { if (playerSelectedRegion == null) {
player.sendMessage(TranslatableCaption.of("single.single_area_missing_selection")); player.sendMessage(TranslatableCaption.miniMessage("single.single_area_missing_selection"));
return false; return false;
} }
if (playerSelectedRegion.getWidth() != playerSelectedRegion.getLength()) { if (playerSelectedRegion.getWidth() != playerSelectedRegion.getLength()) {
player.sendMessage(TranslatableCaption.of("single.single_area_not_square")); player.sendMessage(TranslatableCaption.miniMessage("single.single_area_not_square"));
return false; return false;
} }
if (this.plotAreaManager.getPlotAreas( if (this.plotAreaManager.getPlotAreas(
Objects.requireNonNull(playerSelectedRegion.getWorld()).getName(), Objects.requireNonNull(playerSelectedRegion.getWorld()).getName(),
CuboidRegion.makeCuboid(playerSelectedRegion) CuboidRegion.makeCuboid(playerSelectedRegion)
).length != 0) { ).length != 0) {
player.sendMessage(TranslatableCaption.of("single.single_area_overlapping")); player.sendMessage(TranslatableCaption.miniMessage("single.single_area_overlapping"));
} }
// Alter the region // Alter the region
final BlockVector3 playerSelectionMin = playerSelectedRegion.getMinimumPoint(); final BlockVector3 playerSelectionMin = playerSelectedRegion.getMinimumPoint();
@ -227,7 +228,7 @@ public class Area extends SubCommand {
+ hybridPlotWorld.getId() + hybridPlotWorld.getId()
); );
if (!parentFile.exists() && !parentFile.mkdirs()) { if (!parentFile.exists() && !parentFile.mkdirs()) {
player.sendMessage(TranslatableCaption.of("single.single_area_could_not_make_directories")); player.sendMessage(TranslatableCaption.miniMessage("single.single_area_could_not_make_directories"));
return false; return false;
} }
final File file = new File(parentFile, "plot.schem"); final File file = new File(parentFile, "plot.schem");
@ -245,7 +246,7 @@ public class Area extends SubCommand {
Operations.complete(forwardExtentCopy); Operations.complete(forwardExtentCopy);
clipboardWriter.write(clipboard); clipboardWriter.write(clipboard);
} catch (final Exception e) { } catch (final Exception e) {
player.sendMessage(TranslatableCaption.of("single.single_area_failed_to_save")); player.sendMessage(TranslatableCaption.miniMessage("single.single_area_failed_to_save"));
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }
@ -281,11 +282,11 @@ public class Area extends SubCommand {
final String world = this.setupUtils.setupWorld(singleBuilder); final String world = this.setupUtils.setupWorld(singleBuilder);
if (this.worldUtil.isWorld(world)) { if (this.worldUtil.isWorld(world)) {
PlotSquared.get().loadWorld(world, null); PlotSquared.get().loadWorld(world, null);
player.sendMessage(TranslatableCaption.of("single.single_area_created")); player.sendMessage(TranslatableCaption.miniMessage("single.single_area_created"));
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.error_create"), TranslatableCaption.miniMessage("errors.error_create"),
Template.of("world", hybridPlotWorld.getWorldName()) Placeholder.miniMessage("world", hybridPlotWorld.getWorldName())
); );
} }
}; };
@ -295,16 +296,16 @@ public class Area extends SubCommand {
case "c", "setup", "create" -> { case "c", "setup", "create" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_CREATE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_CREATE)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_CREATE))
); );
return false; return false;
} }
switch (args.length) { switch (args.length) {
case 1: case 1:
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...") Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
case 2: case 2:
@ -317,8 +318,8 @@ public class Area extends SubCommand {
.get("area_create_area"); .get("area_create_area");
if (area == null) { if (area == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...") Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
} }
@ -328,13 +329,13 @@ public class Area extends SubCommand {
location location
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("set.set_attribute"), TranslatableCaption.miniMessage("set.set_attribute"),
Template.of("attribute", "area_pos1"), Placeholder.miniMessage("attribute", "area_pos1"),
Template.of("value", location.getX() + "," + location.getZ()) Placeholder.miniMessage("value", location.getX() + "," + location.getZ())
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("area.set_pos2"), TranslatableCaption.miniMessage("area.set_pos2"),
Template.of("command", "/plot area create pos2") Placeholder.miniMessage("command", "/plot area create pos2")
); );
return true; return true;
} }
@ -347,8 +348,8 @@ public class Area extends SubCommand {
.get("area_create_area"); .get("area_create_area");
if (area == null) { if (area == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Templates.of("value", "/plot area create [world[:id]] [<modifier>=<value>]...") Placeholders.miniMessage("value", "/plot area create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
} }
@ -373,8 +374,8 @@ public class Area extends SubCommand {
final Set<PlotArea> areas = this.plotAreaManager.getPlotAreasSet(area.getWorldName(), region); final Set<PlotArea> areas = this.plotAreaManager.getPlotAreasSet(area.getWorldName(), region);
if (!areas.isEmpty()) { if (!areas.isEmpty()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_intersection"), TranslatableCaption.miniMessage("cluster.cluster_intersection"),
Template.of("cluster", areas.iterator().next().toString()) Placeholder.miniMessage("cluster", areas.iterator().next().toString())
); );
return false; return false;
} }
@ -397,7 +398,7 @@ public class Area extends SubCommand {
if (this.worldUtil.isWorld(world)) { if (this.worldUtil.isWorld(world)) {
PlotSquared.get().loadWorld(world, null); PlotSquared.get().loadWorld(world, null);
player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND_AREA_CREATE); player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND_AREA_CREATE);
player.sendMessage(TranslatableCaption.of("setup.setup_finished")); player.sendMessage(TranslatableCaption.miniMessage("setup.setup_finished"));
if (area.getTerrain() != PlotAreaTerrainType.ALL) { if (area.getTerrain() != PlotAreaTerrainType.ALL) {
QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world)); QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world));
queue.setChunkConsumer(chunk -> AugmentedUtils.generate( queue.setChunkConsumer(chunk -> AugmentedUtils.generate(
@ -412,8 +413,8 @@ public class Area extends SubCommand {
} }
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.error_create"), TranslatableCaption.miniMessage("errors.error_create"),
Template.of("world", area.getWorldName()) Placeholder.miniMessage("world", area.getWorldName())
); );
} }
}; };
@ -446,8 +447,8 @@ public class Area extends SubCommand {
PlotArea other = this.plotAreaManager.getPlotArea(pa.getWorldName(), id); PlotArea other = this.plotAreaManager.getPlotArea(pa.getWorldName(), id);
if (other != null && Objects.equals(pa.getId(), other.getId())) { if (other != null && Objects.equals(pa.getId(), other.getId())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("setup.setup_world_taken"), TranslatableCaption.miniMessage("setup.setup_world_taken"),
Template.of("value", pa.toString()) Placeholder.miniMessage("value", pa.toString())
); );
return false; return false;
} }
@ -461,9 +462,9 @@ public class Area extends SubCommand {
String[] pair = args[i].split("="); String[] pair = args[i].split("=");
if (pair.length != 2) { if (pair.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"), TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
Template.of("value1,", getCommandString()), Placeholder.miniMessage("value1,", getCommandString()),
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...") Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
} }
@ -498,9 +499,9 @@ public class Area extends SubCommand {
} }
default -> { default -> {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"), TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
Template.of("value1", getCommandString()), Placeholder.miniMessage("value1", getCommandString()),
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...") Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
} }
@ -509,8 +510,8 @@ public class Area extends SubCommand {
if (pa.getType() != PlotAreaType.PARTIAL) { if (pa.getType() != PlotAreaType.PARTIAL) {
if (this.worldUtil.isWorld(pa.getWorldName())) { if (this.worldUtil.isWorld(pa.getWorldName())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("setup.setup_world_taken"), TranslatableCaption.miniMessage("setup.setup_world_taken"),
Template.of("value", pa.getWorldName()) Placeholder.miniMessage("value", pa.getWorldName())
); );
return false; return false;
} }
@ -527,11 +528,11 @@ public class Area extends SubCommand {
String world = this.setupUtils.setupWorld(builder); String world = this.setupUtils.setupWorld(builder);
if (this.worldUtil.isWorld(world)) { if (this.worldUtil.isWorld(world)) {
player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND_AREA_CREATE); player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND_AREA_CREATE);
player.sendMessage(TranslatableCaption.of("setup.setup_finished")); player.sendMessage(TranslatableCaption.miniMessage("setup.setup_finished"));
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.error_create"), TranslatableCaption.miniMessage("errors.error_create"),
Template.of("world", pa.getWorldName()) Placeholder.miniMessage("world", pa.getWorldName())
); );
} }
try { try {
@ -549,13 +550,13 @@ public class Area extends SubCommand {
} }
if (pa.getId() == null) { if (pa.getId() == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", getUsage()) Placeholder.miniMessage("value", getUsage())
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"), TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
Template.of("value1", getCommandString()), Placeholder.miniMessage("value1", getCommandString()),
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...") Placeholder.miniMessage("value2", " create [world[:id]] [<modifier>=<value>]...")
); );
return false; return false;
} }
@ -571,8 +572,8 @@ public class Area extends SubCommand {
} }
metaData.computeIfAbsent(player.getUUID(), missingUUID -> new HashMap<>()).put("area_create_area", pa); metaData.computeIfAbsent(player.getUUID(), missingUUID -> new HashMap<>()).put("area_create_area", pa);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("single.get_position"), TranslatableCaption.miniMessage("single.get_position"),
Template.of("command", getCommandString()) Placeholder.miniMessage("command", getCommandString())
); );
break; break;
} }
@ -581,8 +582,8 @@ public class Area extends SubCommand {
case "i", "info" -> { case "i", "info" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_INFO)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_INFO))
); );
return false; return false;
} }
@ -592,18 +593,18 @@ public class Area extends SubCommand {
case 2 -> area = this.plotAreaManager.getPlotAreaByString(args[1]); case 2 -> area = this.plotAreaManager.getPlotAreaByString(args[1]);
default -> { default -> {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"), TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
Template.of("value1", getCommandString()), Placeholder.miniMessage("value1", getCommandString()),
Template.of("value2", " info [area]") Placeholder.miniMessage("value2", " info [area]")
); );
return false; return false;
} }
} }
if (area == null) { if (area == null) {
if (args.length == 2) { if (args.length == 2) {
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1])); player.sendMessage(TranslatableCaption.miniMessage("errors.not_valid_plot_world"), Placeholder.miniMessage("value", args[1]));
} else { } else {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
} }
return false; return false;
} }
@ -625,24 +626,24 @@ public class Area extends SubCommand {
percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE; percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE;
region = "N/A"; region = "N/A";
} }
Template headerTemplate = Template.of( Placeholder<?> headerTemplate = Placeholder.miniMessage(
"header", "header",
TranslatableCaption.of("info.plot_info_header").getComponent(player) TranslatableCaption.miniMessage("info.plot_info_header").getComponent(player)
); );
Template nameTemplate = Template.of("name", name); Placeholder<?> nameTemplate = Placeholder.miniMessage("name", name);
Template typeTemplate = Template.of("type", area.getType().name()); Placeholder<?> typeTemplate = Placeholder.miniMessage("type", area.getType().name());
Template terrainTemplate = Template.of("terrain", area.getTerrain().name()); Placeholder<?> terrainTemplate = Placeholder.miniMessage("terrain", area.getTerrain().name());
Template usageTemplate = Template.of("usage", String.format("%.2f", percent)); Placeholder<?> usageTemplate = Placeholder.miniMessage("usage", String.format("%.2f", percent));
Template claimedTemplate = Template.of("claimed", String.valueOf(claimed)); Placeholder<?> claimedTemplate = Placeholder.miniMessage("claimed", String.valueOf(claimed));
Template clustersTemplate = Template.of("clusters", String.valueOf(clusters)); Placeholder<?> clustersTemplate = Placeholder.miniMessage("clusters", String.valueOf(clusters));
Template regionTemplate = Template.of("region", region); Placeholder<?> regionTemplate = Placeholder.miniMessage("region", region);
Template generatorTemplate = Template.of("generator", generator); Placeholder<?> generatorTemplate = Placeholder.miniMessage("generator", generator);
Template footerTemplate = Template.of( Placeholder<?> footerTemplate = Placeholder.miniMessage(
"footer", "footer",
TranslatableCaption.of("info.plot_info_footer").getComponent(player) TranslatableCaption.miniMessage("info.plot_info_footer").getComponent(player)
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("info.area_info_format"), TranslatableCaption.miniMessage("info.area_info_format"),
headerTemplate, headerTemplate,
nameTemplate, nameTemplate,
typeTemplate, typeTemplate,
@ -659,8 +660,8 @@ public class Area extends SubCommand {
case "l", "list" -> { case "l", "list" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_LIST)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_LIST)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_LIST)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_LIST))
); );
return false; return false;
} }
@ -676,9 +677,9 @@ public class Area extends SubCommand {
} }
default: default:
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"), TranslatableCaption.miniMessage("commandconfig.command_syntax_extended"),
Template.of("value1", getCommandString()), Placeholder.miniMessage("value1", getCommandString()),
Template.of("value2", " list [#]") Placeholder.miniMessage("value2", " list [#]")
); );
return false; return false;
} }
@ -704,29 +705,30 @@ public class Area extends SubCommand {
percent = claimed == 0 ? 0 : (double) claimed / Short.MAX_VALUE * Short.MAX_VALUE; percent = claimed == 0 ? 0 : (double) claimed / Short.MAX_VALUE * Short.MAX_VALUE;
region = "N/A"; region = "N/A";
} }
Template claimedTemplate = Template.of("claimed", String.valueOf(claimed)); Placeholder<?> claimedTemplate = Placeholder.miniMessage("claimed", String.valueOf(claimed));
Template usageTemplate = Template.of("usage", String.format("%.2f", percent) + "%"); Placeholder<?> usageTemplate = Placeholder.miniMessage("usage", String.format("%.2f", percent) + "%");
Template clustersTemplate = Template.of("clusters", String.valueOf(clusters)); Placeholder<?> clustersTemplate = Placeholder.miniMessage("clusters", String.valueOf(clusters));
Template regionTemplate = Template.of("region", region); Placeholder<?> regionTemplate = Placeholder.miniMessage("region", region);
Template generatorTemplate = Template.of("generator", generator); Placeholder<?> generatorTemplate = Placeholder.miniMessage("generator", generator);
String tooltip = MINI_MESSAGE.serialize(MINI_MESSAGE String tooltip = MINI_MESSAGE.serialize(MINI_MESSAGE
.parse( .deserialize(
TranslatableCaption.of("info.area_list_tooltip").getComponent(player), TranslatableCaption.miniMessage("info.area_list_tooltip").getComponent(player),
PlaceholderResolver.placeholders(
claimedTemplate, claimedTemplate,
usageTemplate, usageTemplate,
clustersTemplate, clustersTemplate,
regionTemplate, regionTemplate,
generatorTemplate generatorTemplate
)); )));
Template tooltipTemplate = Template.of("hover_info", tooltip); Placeholder<?> tooltipTemplate = Placeholder.miniMessage("hover_info", tooltip);
Template visitcmdTemplate = Template.of("command_tp", "/plot area tp " + area); Placeholder<?> visitcmdTemplate = Placeholder.miniMessage("command_tp", "/plot area tp " + area);
Template infocmdTemplate = Template.of("command_info", "/plot area info " + area); Placeholder<?> infocmdTemplate = Placeholder.miniMessage("command_info", "/plot area info " + area);
Template numberTemplate = Template.of("number", String.valueOf(i)); Placeholder<?> numberTemplate = Placeholder.miniMessage("number", String.valueOf(i));
Template nameTemplate = Template.of("area_name", name); Placeholder<?> nameTemplate = Placeholder.miniMessage("area_name", name);
Template typeTemplate = Template.of("area_type", area.getType().name()); Placeholder<?> typeTemplate = Placeholder.miniMessage("area_type", area.getType().name());
Template terrainTemplate = Template.of("area_terrain", area.getTerrain().name()); Placeholder<?> terrainTemplate = Placeholder.miniMessage("area_terrain", area.getTerrain().name());
caption.set(TranslatableCaption.of("info.area_list_item")); caption.set(TranslatableCaption.miniMessage("info.area_list_item"));
caption.setTemplates( caption.setPlaceholders(
tooltipTemplate, tooltipTemplate,
visitcmdTemplate, visitcmdTemplate,
numberTemplate, numberTemplate,
@ -736,26 +738,26 @@ public class Area extends SubCommand {
infocmdTemplate infocmdTemplate
); );
} }
}, "/plot area list", TranslatableCaption.of("list.area_list_header_paged")); }, "/plot area list", TranslatableCaption.miniMessage("list.area_list_header_paged"));
return true; return true;
} }
case "regen", "clear", "reset", "regenerate" -> { case "regen", "clear", "reset", "regenerate" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_REGEN)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_REGEN)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_REGEN)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_REGEN))
); );
return false; return false;
} }
final PlotArea area = player.getApplicablePlotArea(); final PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
if (area.getType() != PlotAreaType.PARTIAL) { if (area.getType() != PlotAreaType.PARTIAL) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("single.delete_world_region"), TranslatableCaption.miniMessage("single.delete_world_region"),
Template.of("world", area.getWorldName()) Placeholder.miniMessage("world", area.getWorldName())
); );
return false; return false;
} }
@ -768,28 +770,28 @@ public class Area extends SubCommand {
null null
)); ));
queue.addReadChunks(area.getRegion().getChunks()); queue.addReadChunks(area.getRegion().getChunks());
queue.setCompleteTask(() -> player.sendMessage(TranslatableCaption.of("single.regeneration_complete"))); queue.setCompleteTask(() -> player.sendMessage(TranslatableCaption.miniMessage("single.regeneration_complete")));
queue.enqueue(); queue.enqueue();
return true; return true;
} }
case "goto", "v", "teleport", "visit", "tp" -> { case "goto", "v", "teleport", "visit", "tp" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_TP)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_AREA_TP)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AREA_TP)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AREA_TP))
); );
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot area tp [area]") Placeholder.miniMessage("value", "/plot area tp [area]")
); );
return false; return false;
} }
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]); PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Template.of("value", args[1])); player.sendMessage(TranslatableCaption.miniMessage("errors.not_valid_plot_world"), Placeholder.miniMessage("value", args[1]));
return false; return false;
} }
Location center; Location center;
@ -817,7 +819,7 @@ public class Area extends SubCommand {
return true; return true;
} }
case "delete", "remove" -> { case "delete", "remove" -> {
player.sendMessage(TranslatableCaption.of("single.worldcreation_location")); player.sendMessage(TranslatableCaption.miniMessage("single.worldcreation_location"));
return true; return true;
} }
} }

View File

@ -51,7 +51,7 @@ import com.plotsquared.core.util.PlotExpression;
import com.plotsquared.core.util.task.AutoClaimFinishTask; import com.plotsquared.core.util.task.AutoClaimFinishTask;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -116,14 +116,14 @@ public class Auto extends SubCommand {
int grantedPlots = metaDataAccess.get().orElse(0); int grantedPlots = metaDataAccess.get().orElse(0);
if (diff < 0 && grantedPlots < sizeX * sizeZ) { if (diff < 0 && grantedPlots < sizeX * sizeZ) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(diff + grantedPlots)) Placeholder.miniMessage("amount", String.valueOf(diff + grantedPlots))
); );
return false; return false;
} else if (diff >= 0 && grantedPlots + diff < sizeX * sizeZ) { } else if (diff >= 0 && grantedPlots + diff < sizeX * sizeZ) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(diff + grantedPlots)) Placeholder.miniMessage("amount", String.valueOf(diff + grantedPlots))
); );
return false; return false;
} else { } else {
@ -134,15 +134,15 @@ public class Auto extends SubCommand {
metaDataAccess.set(left); metaDataAccess.set(left);
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_granted_plot"), TranslatableCaption.miniMessage("economy.removed_granted_plot"),
Template.of("usedGrants", String.valueOf(grantedPlots - left)), Placeholder.miniMessage("usedGrants", String.valueOf(grantedPlots - left)),
Template.of("remainingGrants", String.valueOf(left)) Placeholder.miniMessage("remainingGrants", String.valueOf(left))
); );
} }
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(player.getAllowedPlots()) Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots())
) )
); );
return false; return false;
@ -205,7 +205,7 @@ public class Auto extends SubCommand {
plotarea = this.plotAreaManager.getAllPlotAreas()[0]; plotarea = this.plotAreaManager.getAllPlotAreas()[0];
} }
if (plotarea == null) { if (plotarea == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
} }
@ -221,13 +221,13 @@ public class Auto extends SubCommand {
sizeZ = Integer.parseInt(split[1]); sizeZ = Integer.parseInt(split[1]);
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", getUsage()) Placeholder.miniMessage("value", getUsage())
); );
return true; return true;
} }
if (sizeX < 1 || sizeZ < 1) { if (sizeX < 1 || sizeZ < 1) {
player.sendMessage(TranslatableCaption.of("error.plot_size_negative")); player.sendMessage(TranslatableCaption.miniMessage("error.plot_size_negative"));
return true; return true;
} }
if (args.length > 1) { if (args.length > 1) {
@ -244,8 +244,8 @@ public class Auto extends SubCommand {
.callAuto(player, plotarea, schematic, sizeX, sizeZ); .callAuto(player, plotarea, schematic, sizeX, sizeZ);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Auto claim") Placeholder.miniMessage("value", "Auto claim")
); );
return true; return true;
} }
@ -255,14 +255,14 @@ public class Auto extends SubCommand {
schematic = event.getSchematic(); schematic = event.getSchematic();
if (!force && mega && !Permissions.hasPermission(player, Permission.PERMISSION_AUTO_MEGA)) { if (!force && mega && !Permissions.hasPermission(player, Permission.PERMISSION_AUTO_MEGA)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_AUTO_MEGA)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_AUTO_MEGA))
); );
} }
if (!force && sizeX * sizeZ > Settings.Claim.MAX_AUTO_AREA) { if (!force && sizeX * sizeZ > Settings.Claim.MAX_AUTO_AREA) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots_num"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots_num"),
Template.of("amount", String.valueOf(Settings.Claim.MAX_AUTO_AREA)) Placeholder.miniMessage("amount", String.valueOf(Settings.Claim.MAX_AUTO_AREA))
); );
return false; return false;
} }
@ -279,9 +279,9 @@ public class Auto extends SubCommand {
if (schematic != null && !schematic.isEmpty()) { if (schematic != null && !schematic.isEmpty()) {
if (!plotarea.hasSchematic(schematic)) { if (!plotarea.hasSchematic(schematic)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("schematics.schematic_invalid_named"), TranslatableCaption.miniMessage("schematics.schematic_invalid_named"),
Template.of("schemname", schematic), Placeholder.miniMessage("schemname", schematic),
Template.of("reason", "non-existent") Placeholder.miniMessage("reason", "non-existent")
); );
return true; return true;
} }
@ -291,8 +291,8 @@ public class Auto extends SubCommand {
) && !Permissions ) && !Permissions
.hasPermission(player, "plots.admin.command.schematic")) { .hasPermission(player, "plots.admin.command.schematic")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", "plots.claim.%s0") Placeholder.miniMessage("node", "plots.claim.%s0")
); );
return true; return true;
} }
@ -305,21 +305,21 @@ public class Auto extends SubCommand {
cost = (sizeX * sizeZ) * cost; cost = (sizeX * sizeZ) * cost;
if (cost > 0d) { if (cost > 0d) {
if (!this.econHandler.isSupported()) { if (!this.econHandler.isSupported()) {
player.sendMessage(TranslatableCaption.of("economy.vault_or_consumer_null")); player.sendMessage(TranslatableCaption.miniMessage("economy.vault_or_consumer_null"));
return false; return false;
} }
if (!force && this.econHandler.getMoney(player) < cost) { if (!force && this.econHandler.getMoney(player) < cost) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.cannot_afford_plot"), TranslatableCaption.miniMessage("economy.cannot_afford_plot"),
Template.of("money", this.econHandler.format(cost)), Placeholder.miniMessage("money", this.econHandler.format(cost)),
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player))) Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
); );
return false; return false;
} }
this.econHandler.withdrawMoney(player, cost); this.econHandler.withdrawMoney(player, cost);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_balance"), TranslatableCaption.miniMessage("economy.removed_balance"),
Template.of("money", this.econHandler.format(cost)) Placeholder.miniMessage("money", this.econHandler.format(cost))
); );
} }
} }
@ -332,7 +332,7 @@ public class Auto extends SubCommand {
plots = this.eventDispatcher.callAutoPlotsChosen(player, plots).getPlots(); plots = this.eventDispatcher.callAutoPlotsChosen(player, plots).getPlots();
if (plots.isEmpty()) { if (plots.isEmpty()) {
player.sendMessage(TranslatableCaption.of("errors.no_free_plots")); player.sendMessage(TranslatableCaption.miniMessage("errors.no_free_plots"));
return false; return false;
} else if (plots.size() == 1) { } else if (plots.size() == 1) {
this.claimSingle(player, plots.get(0), plotarea, schematic); this.claimSingle(player, plots.get(0), plotarea, schematic);
@ -352,8 +352,8 @@ public class Auto extends SubCommand {
); );
if (!force && mergeEvent.getEventResult() == Result.DENY) { if (!force && mergeEvent.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Auto merge") Placeholder.miniMessage("value", "Auto merge")
); );
return false; return false;
} }

View File

@ -37,7 +37,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.nio.file.Files; import java.nio.file.Files;
@ -73,8 +73,8 @@ public final class Backup extends Command {
private static boolean sendMessage(PlotPlayer<?> player) { private static boolean sendMessage(PlotPlayer<?> player) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot backup <save | list | load>") Placeholder.miniMessage("value", "/plot backup <save | list | load>")
); );
return true; return true;
} }
@ -138,42 +138,42 @@ public final class Backup extends Command {
) { ) {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_unowned").getComponent(player))
); );
} else if (plot.getVolume() > Integer.MAX_VALUE) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
} else if (plot.isMerged()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_merged").getComponent(player))
); );
} else if (!plot.isOwner(player.getUUID()) && !Permissions } else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
); );
} else { } else {
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_other").getComponent(player))
); );
} else { } else {
backupProfile.createBackup().whenComplete((backup, throwable) -> { backupProfile.createBackup().whenComplete((backup, throwable) -> {
if (throwable != null) { if (throwable != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_save_failed"), TranslatableCaption.miniMessage("backups.backup_save_failed"),
Template.of("reason", throwable.getMessage()) Placeholder.miniMessage("reason", throwable.getMessage())
); );
throwable.printStackTrace(); throwable.printStackTrace();
} else { } else {
player.sendMessage(TranslatableCaption.of("backups.backup_save_success")); player.sendMessage(TranslatableCaption.miniMessage("backups.backup_save_success"));
} }
}); });
} }
@ -192,51 +192,51 @@ public final class Backup extends Command {
) { ) {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_unowned").getComponent(player))
); );
} else if (plot.isMerged()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_merged").getComponent(player))
); );
} else if (plot.getVolume() > Integer.MAX_VALUE) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
} else if (!plot.isOwner(player.getUUID()) && !Permissions } else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
); );
} else { } else {
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_other").getComponent(player))
); );
} else { } else {
backupProfile.listBackups().whenComplete((backups, throwable) -> { backupProfile.listBackups().whenComplete((backups, throwable) -> {
if (throwable != null) { if (throwable != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_list_failed"), TranslatableCaption.miniMessage("backups.backup_list_failed"),
Template.of("reason", throwable.getMessage()) Placeholder.miniMessage("reason", throwable.getMessage())
); );
throwable.printStackTrace(); throwable.printStackTrace();
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_list_header"), TranslatableCaption.miniMessage("backups.backup_list_header"),
Template.of("plot", plot.getId().toCommaSeparatedString()) Placeholder.miniMessage("plot", plot.getId().toCommaSeparatedString())
); );
try { try {
for (int i = 0; i < backups.size(); i++) { for (int i = 0; i < backups.size(); i++) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_list_entry"), TranslatableCaption.miniMessage("backups.backup_list_entry"),
Template.of("number", Integer.toString(i + 1)), Placeholder.miniMessage("number", Integer.toString(i + 1)),
Template.of("value", DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant( Placeholder.miniMessage("value", DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant(
Instant.ofEpochMilli(backups.get(i).getCreationTime()), Instant.ofEpochMilli(backups.get(i).getCreationTime()),
ZoneId.systemDefault() ZoneId.systemDefault()
))) )))
@ -263,29 +263,29 @@ public final class Backup extends Command {
) { ) {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_unowned").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_unowned").getComponent(player))
); );
} else if (plot.isMerged()) { } else if (plot.isMerged()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_merged").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_merged").getComponent(player))
); );
} else if (plot.getVolume() > Integer.MAX_VALUE) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
} else if (!plot.isOwner(player.getUUID()) && !Permissions } else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_BACKUP_OTHER))
); );
} else if (args.length == 0) { } else if (args.length == 0) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "Usage: /plot backup save/list/load") Placeholder.miniMessage("value", "Usage: /plot backup save/list/load")
); );
} else { } else {
final int number; final int number;
@ -293,32 +293,32 @@ public final class Backup extends Command {
number = Integer.parseInt(args[0]); number = Integer.parseInt(args[0]);
} catch (final Exception e) { } catch (final Exception e) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_a_number"), TranslatableCaption.miniMessage("invalid.not_a_number"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
return; return;
} }
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
if (backupProfile instanceof NullBackupProfile) { if (backupProfile instanceof NullBackupProfile) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_other").getComponent(player)) Placeholder.miniMessage("plot", TranslatableCaption.miniMessage("generic.generic_other").getComponent(player))
); );
} else { } else {
backupProfile.listBackups().whenComplete((backups, throwable) -> { backupProfile.listBackups().whenComplete((backups, throwable) -> {
if (throwable != null) { if (throwable != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_load_failure"), TranslatableCaption.miniMessage("backups.backup_load_failure"),
Template.of("reason", throwable.getMessage()) Placeholder.miniMessage("reason", throwable.getMessage())
); );
throwable.printStackTrace(); throwable.printStackTrace();
} else { } else {
if (number < 1 || number > backups.size()) { if (number < 1 || number > backups.size()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of( Placeholder.miniMessage(
"plot", "plot",
TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player) TranslatableCaption.miniMessage("generic.generic_invalid_choice").getComponent(player)
) )
); );
} else { } else {
@ -327,10 +327,10 @@ public final class Backup extends Command {
if (backup == null || backup.getFile() == null || !Files if (backup == null || backup.getFile() == null || !Files
.exists(backup.getFile())) { .exists(backup.getFile())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"), TranslatableCaption.miniMessage("backups.backup_impossible"),
Template.of( Placeholder.miniMessage(
"plot", "plot",
TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player) TranslatableCaption.miniMessage("generic.generic_invalid_choice").getComponent(player)
) )
); );
} else { } else {
@ -339,11 +339,11 @@ public final class Backup extends Command {
.whenComplete((n, error) -> { .whenComplete((n, error) -> {
if (error != null) { if (error != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("backups.backup_load_failure"), TranslatableCaption.miniMessage("backups.backup_load_failure"),
Template.of("reason", error.getMessage()) Placeholder.miniMessage("reason", error.getMessage())
); );
} else { } else {
player.sendMessage(TranslatableCaption.of("backups.backup_load_success")); player.sendMessage(TranslatableCaption.miniMessage("backups.backup_load_success"));
} }
}) })
); );

View File

@ -32,7 +32,7 @@ import com.plotsquared.core.util.StringMan;
import com.sk89q.worldedit.command.util.SuggestionHelper; import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.biome.BiomeTypes;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.Collection; import java.util.Collection;
import java.util.Locale; import java.util.Locale;
@ -57,30 +57,30 @@ public class Biome extends SetCommand {
String biomes = StringMan.join( String biomes = StringMan.join(
BiomeType.REGISTRY.values(), BiomeType.REGISTRY.values(),
MINI_MESSAGE.serialize(MINI_MESSAGE.parse(TranslatableCaption MINI_MESSAGE.serialize(MINI_MESSAGE.parse(TranslatableCaption
.of("blocklist.block_list_separator") .miniMessage("blocklist.block_list_separator")
.getComponent(player))) .getComponent(player)))
); );
player.sendMessage(TranslatableCaption.of("biome.need_biome")); player.sendMessage(TranslatableCaption.miniMessage("biome.need_biome"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.subcommand_set_options_header"), TranslatableCaption.miniMessage("commandconfig.subcommand_set_options_header"),
Template.of("values", biomes) Placeholder.miniMessage("values", biomes)
); );
return false; return false;
} }
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
return false; return false;
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
plot.addRunning(); plot.addRunning();
plot.getPlotModificationManager().setBiome(biome, () -> { plot.getPlotModificationManager().setBiome(biome, () -> {
plot.removeRunning(); plot.removeRunning();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("biome.biome_set_to"), TranslatableCaption.miniMessage("biome.biome_set_to"),
Template.of("value", value.toLowerCase()) Placeholder.miniMessage("value", value.toLowerCase())
); );
}); });
return true; return true;

View File

@ -39,7 +39,7 @@ import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Set; import java.util.Set;
@ -73,8 +73,8 @@ public class Buy extends Command {
) { ) {
PlotArea area = player.getPlotAreaAbs(); PlotArea area = player.getPlotAreaAbs();
check(area, TranslatableCaption.of("errors.not_in_plot_world")); check(area, TranslatableCaption.miniMessage("errors.not_in_plot_world"));
check(this.econHandler.isEnabled(area), TranslatableCaption.of("economy.econ_disabled")); check(this.econHandler.isEnabled(area), TranslatableCaption.miniMessage("economy.econ_disabled"));
final Plot plot; final Plot plot;
if (args.length != 0) { if (args.length != 0) {
if (args.length != 1) { if (args.length != 1) {
@ -83,37 +83,37 @@ public class Buy extends Command {
} }
plot = check(Plot.getPlotFromString(player, args[0], true), null); plot = check(Plot.getPlotFromString(player, args[0], true), null);
} else { } else {
plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot")); plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
} }
checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned")); checkTrue(plot.hasOwner(), TranslatableCaption.miniMessage("info.plot_unowned"));
checkTrue(!plot.isOwner(player.getUUID()), TranslatableCaption.of("economy.cannot_buy_own")); checkTrue(!plot.isOwner(player.getUUID()), TranslatableCaption.miniMessage("economy.cannot_buy_own"));
Set<Plot> plots = plot.getConnectedPlots(); Set<Plot> plots = plot.getConnectedPlots();
checkTrue( checkTrue(
player.getPlotCount() + plots.size() <= player.getAllowedPlots(), player.getPlotCount() + plots.size() <= player.getAllowedPlots(),
TranslatableCaption.of("permission.cant_claim_more_plots"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(player.getAllowedPlots())) Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots()))
); );
double price = plot.getFlag(PriceFlag.class); double price = plot.getFlag(PriceFlag.class);
if (price <= 0) { if (price <= 0) {
throw new CommandException(TranslatableCaption.of("economy.not_for_sale")); throw new CommandException(TranslatableCaption.miniMessage("economy.not_for_sale"));
} }
checkTrue( checkTrue(
this.econHandler.isSupported(), this.econHandler.isSupported(),
TranslatableCaption.of("economy.vault_or_consumer_null") TranslatableCaption.miniMessage("economy.vault_or_consumer_null")
); );
checkTrue( checkTrue(
this.econHandler.getMoney(player) >= price, this.econHandler.getMoney(player) >= price,
TranslatableCaption.of("economy.cannot_afford_plot"), TranslatableCaption.miniMessage("economy.cannot_afford_plot"),
Template.of("money", this.econHandler.format(price)), Placeholder.miniMessage("money", this.econHandler.format(price)),
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player))) Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
); );
this.econHandler.withdrawMoney(player, price); this.econHandler.withdrawMoney(player, price);
// Failure // Failure
// Success // Success
confirm.run(this, () -> { confirm.run(this, () -> {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_balance"), TranslatableCaption.miniMessage("economy.removed_balance"),
Template.of("money", this.econHandler.format(price)) Placeholder.miniMessage("money", this.econHandler.format(price))
); );
this.econHandler.depositMoney(PlotSquared.platform().playerManager().getOfflinePlayer(plot.getOwnerAbs()), price); this.econHandler.depositMoney(PlotSquared.platform().playerManager().getOfflinePlayer(plot.getOwnerAbs()), price);
@ -121,10 +121,10 @@ public class Buy extends Command {
PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(plot.getOwnerAbs()); PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(plot.getOwnerAbs());
if (owner != null) { if (owner != null) {
owner.sendMessage( owner.sendMessage(
TranslatableCaption.of("economy.plot_sold"), TranslatableCaption.miniMessage("economy.plot_sold"),
Template.of("plot", plot.getId().toString()), Placeholder.miniMessage("plot", plot.getId().toString()),
Template.of("player", player.getName()), Placeholder.miniMessage("player", player.getName()),
Template.of("price", this.econHandler.format(price)) Placeholder.miniMessage("price", this.econHandler.format(price))
); );
} }
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class); PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(PriceFlag.class);
@ -134,8 +134,8 @@ public class Buy extends Command {
} }
plot.setOwner(player.getUUID()); plot.setOwner(player.getUUID());
player.sendMessage( player.sendMessage(
TranslatableCaption.of("working.claimed"), TranslatableCaption.miniMessage("working.claimed"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
whenDone.run(Buy.this, CommandResult.SUCCESS); whenDone.run(Buy.this, CommandResult.SUCCESS);
}, () -> { }, () -> {

View File

@ -37,7 +37,7 @@ import com.plotsquared.core.plot.flag.implementations.MiscCapFlag;
import com.plotsquared.core.plot.flag.implementations.MobCapFlag; import com.plotsquared.core.plot.flag.implementations.MobCapFlag;
import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag; import com.plotsquared.core.plot.flag.implementations.VehicleCapFlag;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ANIMAL; import static com.plotsquared.core.util.entity.EntityCategories.CAP_ANIMAL;
import static com.plotsquared.core.util.entity.EntityCategories.CAP_ENTITY; import static com.plotsquared.core.util.entity.EntityCategories.CAP_ENTITY;
@ -55,22 +55,22 @@ public class Caps extends SubCommand {
public boolean onCommand(final PlotPlayer<?> player, final String[] args) { public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.isAdded(player.getUUID()) && !Permissions if (!plot.isAdded(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_CAPS_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_CAPS_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_CAPS_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_CAPS_OTHER))
); );
return false; return false;
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
player.sendMessage(TranslatableCaption.of("info.plot_caps_header")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_caps_header"));
final int[] countedEntities = plot.countEntities(); final int[] countedEntities = plot.countEntities();
sendFormatted(plot, player, MobCapFlag.class, countedEntities, "mobs", CAP_MOB); sendFormatted(plot, player, MobCapFlag.class, countedEntities, "mobs", CAP_MOB);
sendFormatted(plot, player, HostileCapFlag.class, countedEntities, "hostile", CAP_MONSTER); sendFormatted(plot, player, HostileCapFlag.class, countedEntities, "hostile", CAP_MONSTER);
@ -90,14 +90,14 @@ public class Caps extends SubCommand {
final int max = plot.getFlag(capFlag); final int max = plot.getFlag(capFlag);
final String percentage = String.format("%.1f", 100 * ((float) current / max)); final String percentage = String.format("%.1f", 100 * ((float) current / max));
String maxBeautified = max >= Integer.MAX_VALUE String maxBeautified = max >= Integer.MAX_VALUE
? TranslatableCaption.of("info.infinite").getComponent(player) ? TranslatableCaption.miniMessage("info.infinite").getComponent(player)
: String.valueOf(max); : String.valueOf(max);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("info.plot_caps_format"), TranslatableCaption.miniMessage("info.plot_caps_format"),
Template.of("cap", name), Placeholder.miniMessage("cap", name),
Template.of("current", String.valueOf(current)), Placeholder.miniMessage("current", String.valueOf(current)),
Template.of("limit", maxBeautified), Placeholder.miniMessage("limit", maxBeautified),
Template.of("percentage", percentage) Placeholder.miniMessage("percentage", percentage)
); );
} }

View File

@ -28,7 +28,7 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
/** /**
* @deprecated In favor of "/plot toggle chat" and * @deprecated In favor of "/plot toggle chat" and
@ -45,13 +45,13 @@ public class Chat extends SubCommand {
@Override @Override
public boolean onCommand(PlotPlayer<?> player, String[] args) { public boolean onCommand(PlotPlayer<?> player, String[] args) {
PlotArea area = player.getPlotAreaAbs(); PlotArea area = player.getPlotAreaAbs();
check(area, TranslatableCaption.of("errors.not_in_plot_world")); check(area, TranslatableCaption.miniMessage("errors.not_in_plot_world"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.deprecated_commands"), TranslatableCaption.miniMessage("errors.deprecated_commands"),
Template.of("replacement", "/plot toggle chat") Placeholder.miniMessage("replacement", "/plot toggle chat")
); );
if (player.getPlotAreaAbs().isForcingPlotChat()) { if (player.getPlotAreaAbs().isForcingPlotChat()) {
player.sendMessage(TranslatableCaption.of("chat.plot_chat_forced")); player.sendMessage(TranslatableCaption.miniMessage("chat.plot_chat_forced"));
return true; return true;
} }
MainCommand.getInstance().toggle.chat(this, player, args, null, null); MainCommand.getInstance().toggle.chat(this, player, args, null, null);

View File

@ -45,7 +45,7 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PlotExpression; import com.plotsquared.core.util.PlotExpression;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@ -81,15 +81,15 @@ public class Claim extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
final PlayerClaimPlotEvent event = this.eventDispatcher.callClaim(player, plot, schematic); final PlayerClaimPlotEvent event = this.eventDispatcher.callClaim(player, plot, schematic);
schematic = event.getSchematic(); schematic = event.getSchematic();
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Claim") Placeholder.miniMessage("value", "Claim")
); );
return true; return true;
} }
@ -107,31 +107,31 @@ public class Claim extends SubCommand {
grants = metaDataAccess.get().orElse(0); grants = metaDataAccess.get().orElse(0);
if (grants <= 0) { if (grants <= 0) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(grants)) Placeholder.miniMessage("amount", String.valueOf(grants))
); );
metaDataAccess.remove(); metaDataAccess.remove();
} }
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(player.getAllowedPlots())) Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots()))
); );
return false; return false;
} }
} }
if (!plot.canClaim(player)) { if (!plot.canClaim(player)) {
player.sendMessage(TranslatableCaption.of("working.plot_is_claimed")); player.sendMessage(TranslatableCaption.miniMessage("working.plot_is_claimed"));
return false; return false;
} }
if (schematic != null && !schematic.isEmpty()) { if (schematic != null && !schematic.isEmpty()) {
if (area.isSchematicClaimSpecify()) { if (area.isSchematicClaimSpecify()) {
if (!area.hasSchematic(schematic)) { if (!area.hasSchematic(schematic)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("schematics.schematic_invalid_named"), TranslatableCaption.miniMessage("schematics.schematic_invalid_named"),
Template.of("schemname", schematic), Placeholder.miniMessage("schemname", schematic),
Template.of("reason", "non-existent") Placeholder.miniMessage("reason", "non-existent")
); );
} }
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLAIM_SCHEMATIC if (!Permissions.hasPermission(player, Permission.PERMISSION_CLAIM_SCHEMATIC
@ -140,8 +140,8 @@ public class Claim extends SubCommand {
"plots.admin.command.schematic" "plots.admin.command.schematic"
) && !force) { ) && !force) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_schematic_permission"), TranslatableCaption.miniMessage("permission.no_schematic_permission"),
Template.of("value", schematic) Placeholder.miniMessage("value", schematic)
); );
} }
} }
@ -151,22 +151,22 @@ public class Claim extends SubCommand {
double cost = costExr.evaluate(currentPlots); double cost = costExr.evaluate(currentPlots);
if (cost > 0d) { if (cost > 0d) {
if (!this.econHandler.isSupported()) { if (!this.econHandler.isSupported()) {
player.sendMessage(TranslatableCaption.of("economy.vault_or_consumer_null")); player.sendMessage(TranslatableCaption.miniMessage("economy.vault_or_consumer_null"));
return false; return false;
} }
if (this.econHandler.getMoney(player) < cost) { if (this.econHandler.getMoney(player) < cost) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.cannot_afford_plot"), TranslatableCaption.miniMessage("economy.cannot_afford_plot"),
Template.of("money", this.econHandler.format(cost)), Placeholder.miniMessage("money", this.econHandler.format(cost)),
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player))) Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
); );
return false; return false;
} }
this.econHandler.withdrawMoney(player, cost); this.econHandler.withdrawMoney(player, cost);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_balance"), TranslatableCaption.miniMessage("economy.removed_balance"),
Template.of("money", this.econHandler.format(cost)), Placeholder.miniMessage("money", this.econHandler.format(cost)),
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player))) Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
); );
} }
} }
@ -177,16 +177,16 @@ public class Claim extends SubCommand {
metaDataAccess.set(grants - 1); metaDataAccess.set(grants - 1);
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_granted_plot"), TranslatableCaption.miniMessage("economy.removed_granted_plot"),
Template.of("usedGrants", String.valueOf((grants - 1))), Placeholder.miniMessage("usedGrants", String.valueOf((grants - 1))),
Template.of("remainingGrants", String.valueOf(grants)) Placeholder.miniMessage("remainingGrants", String.valueOf(grants))
); );
} }
} }
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_BYPASS_BORDER)) {
int border = area.getBorder(); int border = area.getBorder();
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) { if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
player.sendMessage(TranslatableCaption.of("border.denied")); player.sendMessage(TranslatableCaption.miniMessage("border.denied"));
return false; return false;
} }
} }
@ -197,15 +197,15 @@ public class Claim extends SubCommand {
TaskManager.getPlatformImplementation().sync(() -> { TaskManager.getPlatformImplementation().sync(() -> {
if (!plot.claim(player, true, finalSchematic, false, false)) { if (!plot.claim(player, true, finalSchematic, false, false)) {
LOGGER.info("Failed to claim plot {}", plot.getId().toCommaSeparatedString()); LOGGER.info("Failed to claim plot {}", plot.getId().toCommaSeparatedString());
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed")); player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
plot.setOwnerAbs(null); plot.setOwnerAbs(null);
} else if (area.isAutoMerge()) { } else if (area.isAutoMerge()) {
PlotMergeEvent mergeEvent = Claim.this.eventDispatcher PlotMergeEvent mergeEvent = Claim.this.eventDispatcher
.callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player); .callMerge(plot, Direction.ALL, Integer.MAX_VALUE, player);
if (mergeEvent.getEventResult() == Result.DENY) { if (mergeEvent.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Auto merge on claim") Placeholder.miniMessage("value", "Auto merge on claim")
); );
} else { } else {
if (plot.getPlotModificationManager().autoMerge( if (plot.getPlotModificationManager().autoMerge(
@ -226,7 +226,7 @@ public class Claim extends SubCommand {
} }
}, () -> { }, () -> {
LOGGER.info("Failed to add plot to database: {}", plot.getId().toCommaSeparatedString()); LOGGER.info("Failed to add plot to database: {}", plot.getId().toCommaSeparatedString());
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed")); player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
plot.setOwnerAbs(null); plot.setOwnerAbs(null);
}); });
return true; return true;

View File

@ -43,7 +43,8 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -80,28 +81,28 @@ public class Clear extends Command {
sendUsage(player); sendUsage(player);
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot")); final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
Result eventResult = this.eventDispatcher.callClear(plot).getEventResult(); Result eventResult = this.eventDispatcher.callClear(plot).getEventResult();
if (eventResult == Result.DENY) { if (eventResult == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Clear") Placeholder.miniMessage("value", "Clear")
); );
return CompletableFuture.completedFuture(true); return CompletableFuture.completedFuture(true);
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return CompletableFuture.completedFuture(true); return CompletableFuture.completedFuture(true);
} }
boolean force = eventResult == Result.FORCE; boolean force = eventResult == Result.FORCE;
checkTrue( checkTrue(
force || plot.isOwner(player.getUUID()) || Permissions force || plot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, "plots.admin.command.clear"), .hasPermission(player, "plots.admin.command.clear"),
TranslatableCaption.of("permission.no_plot_perms") TranslatableCaption.miniMessage("permission.no_plot_perms")
); );
checkTrue(plot.getRunning() == 0, TranslatableCaption.of("errors.wait_for_timer")); checkTrue(plot.getRunning() == 0, TranslatableCaption.miniMessage("errors.wait_for_timer"));
checkTrue(force || !Settings.Done.RESTRICT_BUILDING || !DoneFlag.isDone(plot) || Permissions checkTrue(force || !Settings.Done.RESTRICT_BUILDING || !DoneFlag.isDone(plot) || Permissions
.hasPermission(player, "plots.continue"), TranslatableCaption.of("done.done_already_done")); .hasPermission(player, "plots.continue"), TranslatableCaption.miniMessage("done.done_already_done"));
confirm.run(this, () -> { confirm.run(this, () -> {
if (Settings.Teleport.ON_CLEAR) { if (Settings.Teleport.ON_CLEAR) {
plot.getPlayersInPlot().forEach(playerInPlot -> plot.teleportPlayer(playerInPlot, TeleportCause.COMMAND_CLEAR, plot.getPlayersInPlot().forEach(playerInPlot -> plot.teleportPlayer(playerInPlot, TeleportCause.COMMAND_CLEAR,
@ -135,14 +136,14 @@ public class Clear extends Command {
} }
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("working.clearing_done"), TranslatableCaption.miniMessage("working.clearing_done"),
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)), Placeholder.miniMessage("amount", String.valueOf(System.currentTimeMillis() - start)),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
}); });
}); });
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
} else { } else {
plot.addRunning(); plot.addRunning();
} }

View File

@ -42,13 +42,14 @@ import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@ -68,8 +69,8 @@ public class Cluster extends SubCommand {
if (args.length == 0) { if (args.length == 0) {
// return arguments // return arguments
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_available_args"), TranslatableCaption.miniMessage("cluster.cluster_available_args"),
Template.of( Placeholder.miniMessage(
"list", "list",
"<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>" "<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>"
) )
@ -78,77 +79,75 @@ public class Cluster extends SubCommand {
} }
String sub = args[0].toLowerCase(); String sub = args[0].toLowerCase();
switch (sub) { switch (sub) {
case "l": case "l", "list" -> {
case "list": {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_LIST)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_LIST)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_LIST)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_LIST))
); );
return false; return false;
} }
if (args.length != 1) { if (args.length != 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster list") Placeholder.miniMessage("value", "/plot cluster list")
); );
return false; return false;
} }
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
Set<PlotCluster> clusters = area.getClusters(); Set<PlotCluster> clusters = area.getClusters();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_list_heading"), TranslatableCaption.miniMessage("cluster.cluster_list_heading"),
Template.of("amount", clusters.size() + "") Placeholder.miniMessage("amount", clusters.size() + "")
); );
for (PlotCluster cluster : clusters) { for (PlotCluster cluster : clusters) {
// Ignore unmanaged clusters // Ignore unmanaged clusters
String name = "'" + cluster.getName() + "' : " + cluster; String name = "'" + cluster.getName() + "' : " + cluster;
if (player.getUUID().equals(cluster.owner)) { if (player.getUUID().equals(cluster.owner)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_list_element_owner"), TranslatableCaption.miniMessage("cluster.cluster_list_element_owner"),
Template.of("cluster", name) Placeholder.miniMessage("cluster", name)
); );
} else if (cluster.helpers.contains(player.getUUID())) { } else if (cluster.helpers.contains(player.getUUID())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_list_element_helpers"), TranslatableCaption.miniMessage("cluster.cluster_list_element_helpers"),
Template.of("cluster", name) Placeholder.miniMessage("cluster", name)
); );
} else if (cluster.invited.contains(player.getUUID())) { } else if (cluster.invited.contains(player.getUUID())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_list_element_invited"), TranslatableCaption.miniMessage("cluster.cluster_list_element_invited"),
Template.of("cluster", name) Placeholder.miniMessage("cluster", name)
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_list_element"), TranslatableCaption.miniMessage("cluster.cluster_list_element"),
Template.of("cluster", cluster.toString()) Placeholder.miniMessage("cluster", cluster.toString())
); );
} }
} }
return true; return true;
} }
case "c": case "c", "create" -> {
case "create": {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_CREATE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_CREATE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_CREATE)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_CREATE))
); );
return false; return false;
} }
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
if (args.length != 4) { if (args.length != 4) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster create <name> <id-bot> <id-top>") Placeholder.miniMessage("value", "/plot cluster create <name> <id-bot> <id-top>")
); );
return false; return false;
} }
@ -157,8 +156,8 @@ public class Cluster extends SubCommand {
player.getPlotCount(player.getLocation().getWorldName()); player.getPlotCount(player.getLocation().getWorldName());
if (currentClusters >= player.getAllowedPlots()) { if (currentClusters >= player.getAllowedPlots()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_clusters"), TranslatableCaption.miniMessage("permission.cant_claim_more_clusters"),
Template.of("amount", String.valueOf(player.getAllowedPlots())) Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots()))
); );
} }
PlotId pos1; PlotId pos1;
@ -168,15 +167,15 @@ public class Cluster extends SubCommand {
pos1 = PlotId.fromString(args[2]); pos1 = PlotId.fromString(args[2]);
pos2 = PlotId.fromString(args[3]); pos2 = PlotId.fromString(args[3]);
} catch (IllegalArgumentException ignored) { } catch (IllegalArgumentException ignored) {
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id")); player.sendMessage(TranslatableCaption.miniMessage("invalid.not_valid_plot_id"));
return false; return false;
} }
// check if name is taken // check if name is taken
String name = args[1]; String name = args[1];
if (area.getCluster(name) != null) { if (area.getCluster(name) != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("alias.alias_is_taken"), TranslatableCaption.miniMessage("alias.alias_is_taken"),
Template.of("alias", name) Placeholder.miniMessage("alias", name)
); );
return false; return false;
} }
@ -189,16 +188,16 @@ public class Cluster extends SubCommand {
PlotCluster cluster = area.getFirstIntersectingCluster(pos1, pos2); PlotCluster cluster = area.getFirstIntersectingCluster(pos1, pos2);
if (cluster != null) { if (cluster != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_intersection"), TranslatableCaption.miniMessage("cluster.cluster_intersection"),
Template.of("cluster", cluster.getName()) Placeholder.miniMessage("cluster", cluster.getName())
); );
return false; return false;
} }
// Check if it occupies existing plots // Check if it occupies existing plots
if (!area.contains(pos1) || !area.contains(pos2)) { if (!area.contains(pos1) || !area.contains(pos2)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_outside"), TranslatableCaption.miniMessage("cluster.cluster_outside"),
Template.of("area", String.valueOf(area)) Placeholder.miniMessage("area", String.valueOf(area))
); );
return false; return false;
} }
@ -210,8 +209,8 @@ public class Cluster extends SubCommand {
for (Plot plot : plots) { for (Plot plot : plots) {
if (!plot.isOwner(uuid)) { if (!plot.isOwner(uuid)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_CREATE_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_CREATE_OTHER))
); );
return false; return false;
} }
@ -232,8 +231,8 @@ public class Cluster extends SubCommand {
); );
if (current + cluster.getArea() > allowed) { if (current + cluster.getArea() > allowed) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea())) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()))
); );
return false; return false;
} }
@ -251,31 +250,29 @@ public class Cluster extends SubCommand {
} }
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_created"), TranslatableCaption.miniMessage("cluster.cluster_created"),
Template.of("name", name) Placeholder.miniMessage("name", name)
); );
return true; return true;
} }
case "disband": case "disband", "del", "delete" -> {
case "del":
case "delete": {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_DELETE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_DELETE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_DELETE)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_DELETE))
); );
return false; return false;
} }
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster delete [name]") Placeholder.miniMessage("value", "/plot cluster delete [name]")
); );
return false; return false;
} }
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
PlotCluster cluster; PlotCluster cluster;
@ -283,15 +280,15 @@ public class Cluster extends SubCommand {
cluster = area.getCluster(args[1]); cluster = area.getCluster(args[1]);
if (cluster == null) { if (cluster == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.invalid_cluster_name"), TranslatableCaption.miniMessage("cluster.invalid_cluster_name"),
Template.of("cluster", args[1]) Placeholder.miniMessage("cluster", args[1])
); );
return false; return false;
} }
} else { } else {
cluster = area.getCluster(player.getLocation()); cluster = area.getCluster(player.getLocation());
if (cluster == null) { if (cluster == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
return false; return false;
} }
} }
@ -299,32 +296,31 @@ public class Cluster extends SubCommand {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_CLUSTER_DELETE_OTHER)) { .hasPermission(player, Permission.PERMISSION_CLUSTER_DELETE_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_DELETE_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_DELETE_OTHER))
); );
return false; return false;
} }
} }
DBFunc.delete(cluster); DBFunc.delete(cluster);
player.sendMessage(TranslatableCaption.of("cluster.cluster_deleted"), Template.of( player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_deleted"), Placeholder.miniMessage(
"cluster", "cluster",
String.valueOf(cluster) String.valueOf(cluster)
)); ));
return true; return true;
} }
case "res": case "res", "resize" -> {
case "resize": {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE))
); );
return false; return false;
} }
if (args.length != 3) { if (args.length != 3) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster resize [name]") Placeholder.miniMessage("value", "/plot cluster resize [name]")
); );
return false; return false;
} }
@ -335,7 +331,7 @@ public class Cluster extends SubCommand {
pos1 = PlotId.fromString(args[2]); pos1 = PlotId.fromString(args[2]);
pos2 = PlotId.fromString(args[3]); pos2 = PlotId.fromString(args[3]);
} catch (IllegalArgumentException ignored) { } catch (IllegalArgumentException ignored) {
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id")); player.sendMessage(TranslatableCaption.miniMessage("invalid.not_valid_plot_id"));
return false; return false;
} }
if (pos2.getX() < pos1.getX() || pos2.getY() < pos1.getY()) { if (pos2.getX() < pos1.getX() || pos2.getY() < pos1.getY()) {
@ -345,20 +341,20 @@ public class Cluster extends SubCommand {
// check if in cluster // check if in cluster
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
PlotCluster cluster = area.getCluster(player.getLocation()); PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) { if (cluster == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
return false; return false;
} }
if (!cluster.hasHelperRights(player.getUUID())) { if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_OTHER)) { .hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_OTHER))
); );
return false; return false;
} }
@ -367,8 +363,8 @@ public class Cluster extends SubCommand {
PlotCluster intersect = area.getFirstIntersectingCluster(pos1, pos2); PlotCluster intersect = area.getFirstIntersectingCluster(pos1, pos2);
if (intersect != null) { if (intersect != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_intersection"), TranslatableCaption.miniMessage("cluster.cluster_intersection"),
Template.of("cluster", intersect.getName()) Placeholder.miniMessage("cluster", intersect.getName())
); );
return false; return false;
} }
@ -383,8 +379,8 @@ public class Cluster extends SubCommand {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_SHRINK)) { .hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_SHRINK)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_SHRINK))
); );
return false; return false;
} }
@ -394,8 +390,8 @@ public class Cluster extends SubCommand {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_EXPAND)) { .hasPermission(player, Permission.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_EXPAND)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_RESIZE_EXPAND))
); );
return false; return false;
} }
@ -413,49 +409,47 @@ public class Cluster extends SubCommand {
); );
if (current + cluster.getArea() > allowed) { if (current + cluster.getArea() > allowed) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER + "." + (current + cluster.getArea())) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER + "." + (current + cluster.getArea()))
); );
return false; return false;
} }
// resize cluster // resize cluster
DBFunc.resizeCluster(cluster, pos1, pos2); DBFunc.resizeCluster(cluster, pos1, pos2);
player.sendMessage(TranslatableCaption.of("cluster.cluster_resized")); player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_resized"));
return true; return true;
} }
case "add": case "add", "inv", "invite" -> {
case "inv":
case "invite": {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_INVITE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_INVITE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_CLUSTER_INVITE)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_CLUSTER_INVITE))
); );
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster invite <player>") Placeholder.miniMessage("value", "/plot cluster invite <player>")
); );
return false; return false;
} }
// check if in cluster // check if in cluster
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
} }
PlotCluster cluster = area.getCluster(player.getLocation()); PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) { if (cluster == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
return false; return false;
} }
if (!cluster.hasHelperRights(player.getUUID())) { if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_CLUSTER_INVITE_OTHER)) { .hasPermission(player, Permission.PERMISSION_CLUSTER_INVITE_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_INVITE_OTHER.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_INVITE_OTHER.toString())
); );
return false; return false;
} }
@ -464,11 +458,11 @@ public class Cluster extends SubCommand {
PlotSquared.get().getImpromptuUUIDPipeline() PlotSquared.get().getImpromptuUUIDPipeline()
.getSingle(args[1], (uuid, throwable) -> { .getSingle(args[1], (uuid, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (throwable != null) { } else if (throwable != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[1]) Placeholder.miniMessage("value", args[1])
); );
} else { } else {
if (!cluster.isAdded(uuid)) { if (!cluster.isAdded(uuid)) {
@ -479,48 +473,46 @@ public class Cluster extends SubCommand {
PlotSquared.platform().playerManager().getPlayerIfExists(uuid); PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if (otherPlayer != null) { if (otherPlayer != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_invited"), TranslatableCaption.miniMessage("cluster.cluster_invited"),
Template.of("cluster", cluster.getName()) Placeholder.miniMessage("cluster", cluster.getName())
); );
} }
} }
player.sendMessage(TranslatableCaption.of("cluster.cluster_added_user")); player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_added_user"));
} }
}); });
return true; return true;
} }
case "k": case "k", "remove", "kick" -> {
case "remove":
case "kick": {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_KICK)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_KICK)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_KICK.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_KICK.toString())
); );
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster kick <player>") Placeholder.miniMessage("value", "/plot cluster kick <player>")
); );
return false; return false;
} }
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
} }
PlotCluster cluster = area.getCluster(player.getLocation()); PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) { if (cluster == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
return false; return false;
} }
if (!cluster.hasHelperRights(player.getUUID())) { if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_CLUSTER_KICK_OTHER)) { .hasPermission(player, Permission.PERMISSION_CLUSTER_KICK_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_KICK_OTHER.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_KICK_OTHER.toString())
); );
return false; return false;
} }
@ -529,19 +521,19 @@ public class Cluster extends SubCommand {
PlotSquared.get().getImpromptuUUIDPipeline() PlotSquared.get().getImpromptuUUIDPipeline()
.getSingle(args[1], (uuid, throwable) -> { .getSingle(args[1], (uuid, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (throwable != null) { } else if (throwable != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[1]) Placeholder.miniMessage("value", args[1])
); );
} else { } else {
// Can't kick if the player is yourself, the owner, or not added to the cluster // Can't kick if the player is yourself, the owner, or not added to the cluster
if (uuid.equals(player.getUUID()) || uuid.equals(cluster.owner) if (uuid.equals(player.getUUID()) || uuid.equals(cluster.owner)
|| !cluster.isAdded(uuid)) { || !cluster.isAdded(uuid)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cannot_kick_player"), TranslatableCaption.miniMessage("cluster.cannot_kick_player"),
Template.of("value", cluster.getName()) Placeholder.miniMessage("value", cluster.getName())
); );
} else { } else {
if (cluster.helpers.contains(uuid)) { if (cluster.helpers.contains(uuid)) {
@ -555,8 +547,8 @@ public class Cluster extends SubCommand {
PlotSquared.platform().playerManager().getPlayerIfExists(uuid); PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if (player2 != null) { if (player2 != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_removed"), TranslatableCaption.miniMessage("cluster.cluster_removed"),
Template.of("cluster", cluster.getName()) Placeholder.miniMessage("cluster", cluster.getName())
); );
} }
for (final Plot plot : PlotQuery.newQuery().inWorld(player2.getLocation() for (final Plot plot : PlotQuery.newQuery().inWorld(player2.getLocation()
@ -566,56 +558,55 @@ public class Cluster extends SubCommand {
plot.unclaim(); plot.unclaim();
} }
} }
player.sendMessage(TranslatableCaption.of("cluster.cluster_kicked_user")); player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_kicked_user"));
} }
} }
}); });
return true; return true;
} }
case "quit": case "quit", "leave" -> {
case "leave": {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_LEAVE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_LEAVE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_LEAVE.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_LEAVE.toString())
); );
return false; return false;
} }
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster leave [name]") Placeholder.miniMessage("value", "/plot cluster leave [name]")
); );
return false; return false;
} }
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
} }
PlotCluster cluster; PlotCluster cluster;
if (args.length == 2) { if (args.length == 2) {
cluster = area.getCluster(args[1]); cluster = area.getCluster(args[1]);
if (cluster == null) { if (cluster == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.invalid_cluster_name"), TranslatableCaption.miniMessage("cluster.invalid_cluster_name"),
Template.of("cluster", args[1]) Placeholder.miniMessage("cluster", args[1])
); );
return false; return false;
} }
} else { } else {
cluster = area.getCluster(player.getLocation()); cluster = area.getCluster(player.getLocation());
if (cluster == null) { if (cluster == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
return false; return false;
} }
} }
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
if (!cluster.isAdded(uuid)) { if (!cluster.isAdded(uuid)) {
player.sendMessage(TranslatableCaption.of("cluster.cluster_not_added")); player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_not_added"));
return false; return false;
} }
if (uuid.equals(cluster.owner)) { if (uuid.equals(cluster.owner)) {
player.sendMessage(TranslatableCaption.of("cluster.cluster_cannot_leave")); player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_cannot_leave"));
return false; return false;
} }
if (cluster.helpers.contains(uuid)) { if (cluster.helpers.contains(uuid)) {
@ -625,8 +616,8 @@ public class Cluster extends SubCommand {
cluster.invited.remove(uuid); cluster.invited.remove(uuid);
DBFunc.removeInvited(cluster, uuid); DBFunc.removeInvited(cluster, uuid);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_removed"), TranslatableCaption.miniMessage("cluster.cluster_removed"),
Template.of("cluster", cluster.getName()) Placeholder.miniMessage("cluster", cluster.getName())
); );
for (final Plot plot : PlotQuery.newQuery().inWorld(player.getLocation().getWorldName()) for (final Plot plot : PlotQuery.newQuery().inWorld(player.getLocation().getWorldName())
.ownedBy(uuid)) { .ownedBy(uuid)) {
@ -637,86 +628,84 @@ public class Cluster extends SubCommand {
} }
return true; return true;
} }
case "members": { case "members" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_HELPERS)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_HELPERS)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_HELPERS.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_HELPERS.toString())
); );
return false; return false;
} }
if (args.length != 3) { if (args.length != 3) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster members <add | remove> <player>") Placeholder.miniMessage("value", "/plot cluster members <add | remove> <player>")
); );
return false; return false;
} }
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
} }
PlotCluster cluster = area.getCluster(player.getLocation()); PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) { if (cluster == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
return false; return false;
} }
PlotSquared.get().getImpromptuUUIDPipeline() PlotSquared.get().getImpromptuUUIDPipeline()
.getSingle(args[2], (uuid, throwable) -> { .getSingle(args[2], (uuid, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (throwable != null) { } else if (throwable != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[2]) Placeholder.miniMessage("value", args[2])
); );
} else { } else {
if (args[1].equalsIgnoreCase("add")) { if (args[1].equalsIgnoreCase("add")) {
cluster.helpers.add(uuid); cluster.helpers.add(uuid);
DBFunc.setHelper(cluster, uuid); DBFunc.setHelper(cluster, uuid);
player.sendMessage(TranslatableCaption.of("cluster.cluster_added_helper")); player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_added_helper"));
} else if (args[1].equalsIgnoreCase("remove")) { } else if (args[1].equalsIgnoreCase("remove")) {
cluster.helpers.remove(uuid); cluster.helpers.remove(uuid);
DBFunc.removeHelper(cluster, uuid); DBFunc.removeHelper(cluster, uuid);
player.sendMessage(TranslatableCaption.of("cluster.cluster_removed_helper")); player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_removed_helper"));
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster members <add | remove> <player>") Placeholder.miniMessage("value", "/plot cluster members <add | remove> <player>")
); );
} }
} }
}); });
return true; return true;
} }
case "spawn": case "spawn", "home", "tp" -> {
case "home":
case "tp": {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_TP)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_TP)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_TP.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_TP.toString())
); );
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster tp <name>") Placeholder.miniMessage("value", "/plot cluster tp <name>")
); );
return false; return false;
} }
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
PlotCluster cluster = area.getCluster(args[1]); PlotCluster cluster = area.getCluster(args[1]);
if (cluster == null) { if (cluster == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.invalid_cluster_name"), TranslatableCaption.miniMessage("cluster.invalid_cluster_name"),
Template.of("cluster", args[1]) Placeholder.miniMessage("cluster", args[1])
); );
return false; return false;
} }
@ -724,36 +713,33 @@ public class Cluster extends SubCommand {
if (!cluster.isAdded(uuid)) { if (!cluster.isAdded(uuid)) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_TP_OTHER)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_TP_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_TP_OTHER.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_TP_OTHER.toString())
); );
return false; return false;
} }
} }
cluster.getHome(home -> player.teleport(home, TeleportCause.COMMAND_CLUSTER_TELEPORT)); cluster.getHome(home -> player.teleport(home, TeleportCause.COMMAND_CLUSTER_TELEPORT));
player.sendMessage(TranslatableCaption.of("cluster.cluster_teleporting")); player.sendMessage(TranslatableCaption.miniMessage("cluster.cluster_teleporting"));
return true; return true;
} }
case "i": case "i", "info", "show", "information" -> {
case "info":
case "show":
case "information": {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_INFO)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_INFO)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_TP.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_TP.toString())
); );
return false; return false;
} }
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster info [name]") Placeholder.miniMessage("value", "/plot cluster info [name]")
); );
} }
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
PlotCluster cluster; PlotCluster cluster;
@ -761,15 +747,15 @@ public class Cluster extends SubCommand {
cluster = area.getCluster(args[1]); cluster = area.getCluster(args[1]);
if (cluster == null) { if (cluster == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.invalid_cluster_name"), TranslatableCaption.miniMessage("cluster.invalid_cluster_name"),
Template.of("cluster", args[1]) Placeholder.miniMessage("cluster", args[1])
); );
return false; return false;
} }
} else { } else {
cluster = area.getCluster(player.getLocation()); cluster = area.getCluster(player.getLocation());
if (cluster == null) { if (cluster == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
return false; return false;
} }
} }
@ -778,24 +764,20 @@ public class Cluster extends SubCommand {
PlotSquared.get().getImpromptuUUIDPipeline() PlotSquared.get().getImpromptuUUIDPipeline()
.getSingle(cluster.owner, (username, throwable) -> { .getSingle(cluster.owner, (username, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else { } else {
final String owner; final String owner;
if (username == null) { owner = Objects.requireNonNullElse(username, "unknown");
owner = "unknown";
} else {
owner = username;
}
String name = cluster.getName(); String name = cluster.getName();
String size = (cluster.getP2().getX() - cluster.getP1().getX() + 1) + "x" + ( String size = (cluster.getP2().getX() - cluster.getP1().getX() + 1) + "x" + (
cluster.getP2().getY() - cluster.getP1().getY() + 1); cluster.getP2().getY() - cluster.getP1().getY() + 1);
String rights = cluster.isAdded(player.getUUID()) + ""; String rights = cluster.isAdded(player.getUUID()) + "";
Caption message = TranslatableCaption.of("cluster.cluster_info"); Caption message = TranslatableCaption.miniMessage("cluster.cluster_info");
Template idTemplate = Template.of("id", id); Placeholder<?> idTemplate = Placeholder.miniMessage("id", id);
Template ownerTemplate = Template.of("owner", owner); Placeholder<?> ownerTemplate = Placeholder.miniMessage("owner", owner);
Template nameTemplate = Template.of("name", name); Placeholder<?> nameTemplate = Placeholder.miniMessage("name", name);
Template sizeTemplate = Template.of("size", size); Placeholder<?> sizeTemplate = Placeholder.miniMessage("size", size);
Template rightsTemplate = Template.of("rights", rights); Placeholder<?> rightsTemplate = Placeholder.miniMessage("rights", rights);
player.sendMessage( player.sendMessage(
message, message,
idTemplate, idTemplate,
@ -808,38 +790,36 @@ public class Cluster extends SubCommand {
}); });
return true; return true;
} }
case "sh": case "sh", "setspawn", "sethome" -> {
case "setspawn":
case "sethome": {
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_SETHOME)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_SETHOME)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_SETHOME.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_SETHOME.toString())
); );
return false; return false;
} }
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot cluster sethome") Placeholder.miniMessage("value", "/plot cluster sethome")
); );
return false; return false;
} }
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
} }
PlotCluster cluster = area.getCluster(player.getLocation()); PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) { if (cluster == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_cluster"));
return false; return false;
} }
if (!cluster.hasHelperRights(player.getUUID())) { if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions if (!Permissions
.hasPermission(player, Permission.PERMISSION_CLUSTER_SETHOME_OTHER)) { .hasPermission(player, Permission.PERMISSION_CLUSTER_SETHOME_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_CLUSTER_SETHOME_OTHER.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_CLUSTER_SETHOME_OTHER.toString())
); );
return false; return false;
} }
@ -852,13 +832,13 @@ public class Cluster extends SubCommand {
cluster, cluster,
relative.getX() + "," + relative.getY() + "," + relative.getZ() relative.getX() + "," + relative.getY() + "," + relative.getZ()
); );
player.sendMessage(TranslatableCaption.of("position.position_set")); player.sendMessage(TranslatableCaption.miniMessage("position.position_set"));
return true; return true;
} }
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_available_args"), TranslatableCaption.miniMessage("cluster.cluster_available_args"),
Template.of( Placeholder.miniMessage(
"list", "list",
"<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>" "<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>"
) )

View File

@ -32,7 +32,7 @@ import com.plotsquared.core.player.PlayerMetaDataKeys;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.task.TaskTime; import com.plotsquared.core.util.task.TaskTime;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
public class CmdConfirm { public class CmdConfirm {
@ -58,10 +58,10 @@ public class CmdConfirm {
removePending(player); removePending(player);
if (commandStr != null) { if (commandStr != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("confirm.requires_confirm"), TranslatableCaption.miniMessage("confirm.requires_confirm"),
Template.of("command", commandStr), Placeholder.miniMessage("command", commandStr),
Template.of("timeout", String.valueOf(Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS)), Placeholder.miniMessage("timeout", String.valueOf(Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS)),
Template.of("value", "/plot confirm") Placeholder.miniMessage("value", "/plot confirm")
); );
} }
TaskManager.runTaskLater(() -> { TaskManager.runTaskLater(() -> {

View File

@ -38,7 +38,7 @@ import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -213,7 +213,7 @@ public abstract class Command {
} }
Collections.reverse(path); Collections.reverse(path);
String descriptionKey = String.join(".", path); String descriptionKey = String.join(".", path);
this.description = TranslatableCaption.of(String.format("commands.description.%s", descriptionKey)); this.description = TranslatableCaption.miniMessage(String.format("commands.description.%s", descriptionKey));
} else { } else {
this.description = StaticCaption.of(declaration.description()); this.description = StaticCaption.of(declaration.description());
} }
@ -263,9 +263,9 @@ public abstract class Command {
max = c.size(); max = c.size();
} }
// Send the header // Send the header
Template curTemplate = Template.of("cur", String.valueOf(page + 1)); Placeholder<?> curTemplate = Placeholder.miniMessage("cur", String.valueOf(page + 1));
Template maxTemplate = Template.of("max", String.valueOf(totalPages + 1)); Placeholder<?> maxTemplate = Placeholder.miniMessage("max", String.valueOf(totalPages + 1));
Template amountTemplate = Template.of("amount", String.valueOf(c.size())); Placeholder<?> amountTemplate = Placeholder.miniMessage("amount", String.valueOf(c.size()));
player.sendMessage(header, curTemplate, maxTemplate, amountTemplate); player.sendMessage(header, curTemplate, maxTemplate, amountTemplate);
// Send the page content // Send the page content
List<T> subList = c.subList(page * size, max); List<T> subList = c.subList(page * size, max);
@ -274,13 +274,14 @@ public abstract class Command {
i++; i++;
final CaptionHolder msg = new CaptionHolder(); final CaptionHolder msg = new CaptionHolder();
add.run(i, obj, msg); add.run(i, obj, msg);
player.sendMessage(msg.get(), msg.getTemplates()); player.sendMessage(msg.get(), msg.getPlaceholders());
} }
// Send the footer // Send the footer
Template command1 = Template.of("command1", baseCommand + " " + page); Placeholder<?> command1 = Placeholder.miniMessage("command1", baseCommand + " " + page);
Template command2 = Template.of("command2", baseCommand + " " + (page + 2)); Placeholder<?> command2 = Placeholder.miniMessage("command2", baseCommand + " " + (page + 2));
Template clickable = Template.of("clickable", TranslatableCaption.of("list.clickable").getComponent(player)); Placeholder<?> clickable = Placeholder.miniMessage("clickable",
player.sendMessage(TranslatableCaption.of("list.page_turn"), command1, command2, clickable); TranslatableCaption.miniMessage("list.clickable").getComponent(player));
player.sendMessage(TranslatableCaption.miniMessage("list.page_turn"), command1, command2, clickable);
} }
/** /**
@ -327,12 +328,12 @@ public abstract class Command {
} catch (IllegalArgumentException ignored) { } catch (IllegalArgumentException ignored) {
} }
// Command recommendation // Command recommendation
player.sendMessage(TranslatableCaption.of("commandconfig.not_valid_subcommand")); player.sendMessage(TranslatableCaption.miniMessage("commandconfig.not_valid_subcommand"));
List<Command> commands = getCommands(player); List<Command> commands = getCommands(player);
if (commands.isEmpty()) { if (commands.isEmpty()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.did_you_mean"), TranslatableCaption.miniMessage("commandconfig.did_you_mean"),
Template.of("value", MainCommand.getInstance().help.getUsage()) Placeholder.miniMessage("value", MainCommand.getInstance().help.getUsage())
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
@ -352,8 +353,8 @@ public abstract class Command {
cmd = new StringComparison<>(args[0], this.allCommands).getMatchObject(); cmd = new StringComparison<>(args[0], this.allCommands).getMatchObject();
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.did_you_mean"), TranslatableCaption.miniMessage("commandconfig.did_you_mean"),
Template.of("value", cmd.getUsage()) Placeholder.miniMessage("value", cmd.getUsage())
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
@ -388,8 +389,8 @@ public abstract class Command {
if (failed) { if (failed) {
// TODO improve or remove the Argument system // TODO improve or remove the Argument system
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", StringMan.join(fullSplit, " ")) Placeholder.miniMessage("value", StringMan.join(fullSplit, " "))
); );
return false; return false;
} }
@ -477,8 +478,8 @@ public abstract class Command {
} else if (!Permissions.hasPermission(player, getPermission())) { } else if (!Permissions.hasPermission(player, getPermission())) {
if (message) { if (message) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", getPermission()) Placeholder.miniMessage("node", getPermission())
); );
} }
} else { } else {
@ -502,8 +503,8 @@ public abstract class Command {
public void sendUsage(PlotPlayer<?> player) { public void sendUsage(PlotPlayer<?> player) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", getUsage()) Placeholder.miniMessage("value", getUsage())
); );
} }
@ -607,13 +608,13 @@ public abstract class Command {
return this.getFullId().hashCode(); return this.getFullId().hashCode();
} }
public void checkTrue(boolean mustBeTrue, Caption message, Template... args) { public void checkTrue(boolean mustBeTrue, Caption message, Placeholder<?>... args) {
if (!mustBeTrue) { if (!mustBeTrue) {
throw new CommandException(message, args); throw new CommandException(message, args);
} }
} }
public <T> T check(T object, Caption message, Template... args) { public <T> T check(T object, Caption message, Placeholder<?>... args) {
if (object == null) { if (object == null) {
throw new CommandException(message, args); throw new CommandException(message, args);
} }
@ -629,17 +630,17 @@ public abstract class Command {
public static class CommandException extends RuntimeException { public static class CommandException extends RuntimeException {
private final Template[] args; private final Placeholder<?>[] placeholders;
private final Caption message; private final Caption message;
public CommandException(final @Nullable Caption message, final Template... args) { public CommandException(final @Nullable Caption message, final Placeholder<?>... placeholders) {
this.message = message; this.message = message;
this.args = args; this.placeholders = placeholders;
} }
public void perform(final @Nullable PlotPlayer<?> player) { public void perform(final @Nullable PlotPlayer<?> player) {
if (player != null && message != null) { if (player != null && message != null) {
player.sendMessage(message, args); player.sendMessage(message, placeholders);
} }
} }

View File

@ -26,7 +26,7 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.caption.Caption; import com.plotsquared.core.configuration.caption.Caption;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
/** /**
@ -41,7 +41,7 @@ public interface CommandCaller {
* @param caption Caption to send * @param caption Caption to send
* @param replacements Variable replacements * @param replacements Variable replacements
*/ */
void sendMessage(@NonNull Caption caption, @NonNull Template... replacements); void sendMessage(@NonNull Caption caption, @NonNull Placeholder<?>... replacements);
/** /**
* Check the player's permissions. <i>Will be cached if permission caching is enabled.</i> * Check the player's permissions. <i>Will be cached if permission caching is enabled.</i>

View File

@ -38,42 +38,42 @@ public enum CommandCategory implements Caption {
* Claiming CommandConfig. * Claiming CommandConfig.
* Such as: /plot claim * Such as: /plot claim
*/ */
CLAIMING(TranslatableCaption.of("category.command_category_claiming")), CLAIMING(TranslatableCaption.miniMessage("category.command_category_claiming")),
/** /**
* Teleportation CommandConfig. * Teleportation CommandConfig.
* Such as: /plot visit * Such as: /plot visit
*/ */
TELEPORT(TranslatableCaption.of("category.command_category_teleport")), TELEPORT(TranslatableCaption.miniMessage("category.command_category_teleport")),
/** /**
* Protection. * Protection.
*/ */
SETTINGS(TranslatableCaption.of("category.command_category_settings")), SETTINGS(TranslatableCaption.miniMessage("category.command_category_settings")),
/** /**
* Chat. * Chat.
*/ */
CHAT(TranslatableCaption.of("category.command_category_chat")), CHAT(TranslatableCaption.miniMessage("category.command_category_chat")),
/** /**
* Web. * Web.
*/ */
SCHEMATIC(TranslatableCaption.of("category.command_category_schematic")), SCHEMATIC(TranslatableCaption.miniMessage("category.command_category_schematic")),
/** /**
* Cosmetic. * Cosmetic.
*/ */
APPEARANCE(TranslatableCaption.of("category.command_category_appearance")), APPEARANCE(TranslatableCaption.miniMessage("category.command_category_appearance")),
/** /**
* Information CommandConfig. * Information CommandConfig.
* Such as: /plot info * Such as: /plot info
*/ */
INFO(TranslatableCaption.of("category.command_category_info")), INFO(TranslatableCaption.miniMessage("category.command_category_info")),
/** /**
* Debug CommandConfig. * Debug CommandConfig.
* Such as: /plot debug * Such as: /plot debug
*/ */
DEBUG(TranslatableCaption.of("category.command_category_debug")), DEBUG(TranslatableCaption.miniMessage("category.command_category_debug")),
/** /**
* Administration commands. * Administration commands.
*/ */
ADMINISTRATION(TranslatableCaption.of("category.command_category_administration")); ADMINISTRATION(TranslatableCaption.miniMessage("category.command_category_administration"));
/** /**
* The category name (Readable). * The category name (Readable).
*/ */

View File

@ -34,7 +34,7 @@ import com.plotsquared.core.plot.comment.CommentInbox;
import com.plotsquared.core.plot.comment.CommentManager; import com.plotsquared.core.plot.comment.CommentManager;
import com.plotsquared.core.plot.comment.PlotComment; import com.plotsquared.core.plot.comment.PlotComment;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale; import java.util.Locale;
@ -50,9 +50,9 @@ public class Comment extends SubCommand {
public boolean onCommand(PlotPlayer<?> player, String[] args) { public boolean onCommand(PlotPlayer<?> player, String[] args) {
if (args.length < 2) { if (args.length < 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.comment_syntax"), TranslatableCaption.miniMessage("comment.comment_syntax"),
Template.of("command", "/plot comment [X;Z]"), Placeholder.miniMessage("command", "/plot comment [X;Z]"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|")) Placeholder.miniMessage("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
); );
return false; return false;
} }
@ -70,9 +70,9 @@ public class Comment extends SubCommand {
} else { } else {
if (args.length < 3) { if (args.length < 3) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.comment_syntax"), TranslatableCaption.miniMessage("comment.comment_syntax"),
Template.of("command", "/plot comment [X;Z]"), Placeholder.miniMessage("command", "/plot comment [X;Z]"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|")) Placeholder.miniMessage("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
); );
return false; return false;
} }
@ -82,15 +82,15 @@ public class Comment extends SubCommand {
CommentInbox inbox = CommentManager.inboxes.get(args[index - 1].toLowerCase()); CommentInbox inbox = CommentManager.inboxes.get(args[index - 1].toLowerCase());
if (inbox == null) { if (inbox == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.comment_syntax"), TranslatableCaption.miniMessage("comment.comment_syntax"),
Template.of("command", "/plot comment [X;Z]"), Placeholder.miniMessage("command", "/plot comment [X;Z]"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|")) Placeholder.miniMessage("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
); );
return false; return false;
} }
if (!inbox.canWrite(plot, player)) { if (!inbox.canWrite(plot, player)) {
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox")); player.sendMessage(TranslatableCaption.miniMessage("comment.no_perm_inbox"));
return false; return false;
} }
@ -101,11 +101,11 @@ public class Comment extends SubCommand {
); );
boolean result = inbox.addComment(plot, comment); boolean result = inbox.addComment(plot, comment);
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("comment.no_plot_inbox")); player.sendMessage(TranslatableCaption.miniMessage("comment.no_plot_inbox"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.comment_syntax"), TranslatableCaption.miniMessage("comment.comment_syntax"),
Template.of("command", "/plot comment [X;Z]"), Placeholder.miniMessage("command", "/plot comment [X;Z]"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|")) Placeholder.miniMessage("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
); );
return false; return false;
} }
@ -116,7 +116,7 @@ public class Comment extends SubCommand {
} }
} }
player.sendMessage(TranslatableCaption.of("comment.comment_added")); player.sendMessage(TranslatableCaption.miniMessage("comment.comment_added"));
return true; return true;
} }

View File

@ -36,7 +36,7 @@ import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.task.TaskTime; import com.plotsquared.core.util.task.TaskTime;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
@ -73,31 +73,31 @@ public class Condense extends SubCommand {
public boolean onCommand(final PlotPlayer<?> player, String[] args) { public boolean onCommand(final PlotPlayer<?> player, String[] args) {
if (args.length != 2 && args.length != 3) { if (args.length != 2 && args.length != 3) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot condense <area> <start | stop | info> [radius]") Placeholder.miniMessage("value", "/plot condense <area> <start | stop | info> [radius]")
); );
return false; return false;
} }
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]); PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
if (area == null || !this.worldUtil.isWorld(area.getWorldName())) { if (area == null || !this.worldUtil.isWorld(area.getWorldName())) {
player.sendMessage(TranslatableCaption.of("invalid.invalid_area")); player.sendMessage(TranslatableCaption.miniMessage("invalid.invalid_area"));
return false; return false;
} }
switch (args[1].toLowerCase()) { switch (args[1].toLowerCase()) {
case "start" -> { case "start" -> {
if (args.length == 2) { if (args.length == 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot condense" + area + " start <radius>") Placeholder.miniMessage("value", "/plot condense" + area + " start <radius>")
); );
return false; return false;
} }
if (Condense.TASK) { if (Condense.TASK) {
player.sendMessage(TranslatableCaption.of("condense.task_already_started")); player.sendMessage(TranslatableCaption.miniMessage("condense.task_already_started"));
return false; return false;
} }
if (!MathMan.isInteger(args[2])) { if (!MathMan.isInteger(args[2])) {
player.sendMessage(TranslatableCaption.of("condense.invalid_radius")); player.sendMessage(TranslatableCaption.miniMessage("condense.invalid_radius"));
return false; return false;
} }
int radius = Integer.parseInt(args[2]); int radius = Integer.parseInt(args[2]);
@ -141,7 +141,7 @@ public class Condense extends SubCommand {
int size = allPlots.size(); int size = allPlots.size();
int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1); int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1);
if (radius < minimumRadius) { if (radius < minimumRadius) {
player.sendMessage(TranslatableCaption.of("condense.radius_too_small")); player.sendMessage(TranslatableCaption.miniMessage("condense.radius_too_small"));
return false; return false;
} }
List<PlotId> toMove = new ArrayList<>(getPlots(allPlots, radius)); List<PlotId> toMove = new ArrayList<>(getPlots(allPlots, radius));
@ -155,20 +155,20 @@ public class Condense extends SubCommand {
start = start.getNextId(); start = start.getNextId();
} }
if (free.isEmpty() || toMove.isEmpty()) { if (free.isEmpty() || toMove.isEmpty()) {
player.sendMessage(TranslatableCaption.of("condense.no_free_plots_found")); player.sendMessage(TranslatableCaption.miniMessage("condense.no_free_plots_found"));
return false; return false;
} }
player.sendMessage(TranslatableCaption.of("condense.task_started")); player.sendMessage(TranslatableCaption.miniMessage("condense.task_started"));
Condense.TASK = true; Condense.TASK = true;
Runnable run = new Runnable() { Runnable run = new Runnable() {
@Override @Override
public void run() { public void run() {
if (!Condense.TASK) { if (!Condense.TASK) {
player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.task_cancelled"));
} }
if (allPlots.isEmpty()) { if (allPlots.isEmpty()) {
Condense.TASK = false; Condense.TASK = false;
player.sendMessage(TranslatableCaption.of("condense.task_complete")); player.sendMessage(TranslatableCaption.miniMessage("condense.task_complete"));
return; return;
} }
final Runnable task = this; final Runnable task = this;
@ -186,9 +186,9 @@ public class Condense extends SubCommand {
result.set(origin.getPlotModificationManager().move(possible, player, () -> { result.set(origin.getPlotModificationManager().move(possible, player, () -> {
if (result.get()) { if (result.get()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("condense.moving"), TranslatableCaption.miniMessage("condense.moving"),
Template.of("origin", String.valueOf(origin)), Placeholder.miniMessage("origin", String.valueOf(origin)),
Template.of("possible", String.valueOf(possible)) Placeholder.miniMessage("possible", String.valueOf(possible))
); );
TaskManager.runTaskLater(task, TaskTime.ticks(1L)); TaskManager.runTaskLater(task, TaskTime.ticks(1L));
} }
@ -202,13 +202,13 @@ public class Condense extends SubCommand {
} }
if (free.isEmpty()) { if (free.isEmpty()) {
Condense.TASK = false; Condense.TASK = false;
player.sendMessage(TranslatableCaption.of("condense.task_failed")); player.sendMessage(TranslatableCaption.miniMessage("condense.task_failed"));
return; return;
} }
if (i >= free.size()) { if (i >= free.size()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("condense.skipping"), TranslatableCaption.miniMessage("condense.skipping"),
Template.of("plot", String.valueOf(origin)) Placeholder.miniMessage("plot", String.valueOf(origin))
); );
} }
} }
@ -218,23 +218,23 @@ public class Condense extends SubCommand {
} }
case "stop" -> { case "stop" -> {
if (!Condense.TASK) { if (!Condense.TASK) {
player.sendMessage(TranslatableCaption.of("condense.task_stopped")); player.sendMessage(TranslatableCaption.miniMessage("condense.task_stopped"));
return false; return false;
} }
Condense.TASK = false; Condense.TASK = false;
player.sendMessage(TranslatableCaption.of("condense.task_stopped")); player.sendMessage(TranslatableCaption.miniMessage("condense.task_stopped"));
return true; return true;
} }
case "info" -> { case "info" -> {
if (args.length == 2) { if (args.length == 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot condense " + area + " info <radius>") Placeholder.miniMessage("value", "/plot condense " + area + " info <radius>")
); );
return false; return false;
} }
if (!MathMan.isInteger(args[2])) { if (!MathMan.isInteger(args[2])) {
player.sendMessage(TranslatableCaption.of("condense.invalid_radius")); player.sendMessage(TranslatableCaption.miniMessage("condense.invalid_radius"));
return false; return false;
} }
int radius = Integer.parseInt(args[2]); int radius = Integer.parseInt(args[2]);
@ -242,37 +242,37 @@ public class Condense extends SubCommand {
int size = plots.size(); int size = plots.size();
int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1); int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1);
if (radius < minimumRadius) { if (radius < minimumRadius) {
player.sendMessage(TranslatableCaption.of("condense.radius_too_small")); player.sendMessage(TranslatableCaption.miniMessage("condense.radius_too_small"));
return false; return false;
} }
int maxMove = getPlots(plots, minimumRadius).size(); int maxMove = getPlots(plots, minimumRadius).size();
int userMove = getPlots(plots, radius).size(); int userMove = getPlots(plots, radius).size();
player.sendMessage(TranslatableCaption.of("condense.default_eval")); player.sendMessage(TranslatableCaption.miniMessage("condense.default_eval"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("condense.minimum_radius"), TranslatableCaption.miniMessage("condense.minimum_radius"),
Template.of("minimumRadius", String.valueOf(minimumRadius)) Placeholder.miniMessage("minimumRadius", String.valueOf(minimumRadius))
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("condense.minimum_radius"), TranslatableCaption.miniMessage("condense.minimum_radius"),
Template.of("maxMove", String.valueOf(maxMove)) Placeholder.miniMessage("maxMove", String.valueOf(maxMove))
); );
player.sendMessage(TranslatableCaption.of("condense.input_eval")); player.sendMessage(TranslatableCaption.miniMessage("condense.input_eval"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("condense.input_radius"), TranslatableCaption.miniMessage("condense.input_radius"),
Template.of("radius", String.valueOf(radius)) Placeholder.miniMessage("radius", String.valueOf(radius))
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("condense.estimated_moves"), TranslatableCaption.miniMessage("condense.estimated_moves"),
Template.of("userMove", String.valueOf(userMove)) Placeholder.miniMessage("userMove", String.valueOf(userMove))
); );
player.sendMessage(TranslatableCaption.of("condense.eta")); player.sendMessage(TranslatableCaption.miniMessage("condense.eta"));
player.sendMessage(TranslatableCaption.of("condense.radius_measured")); player.sendMessage(TranslatableCaption.miniMessage("condense.radius_measured"));
return true; return true;
} }
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot condense " + area.getWorldName() + " <start | stop | info> [radius]") Placeholder.miniMessage("value", "/plot condense " + area.getWorldName() + " <start | stop | info> [radius]")
); );
return false; return false;
} }

View File

@ -39,13 +39,13 @@ public class Confirm extends SubCommand {
public boolean onCommand(PlotPlayer<?> player, String[] args) { public boolean onCommand(PlotPlayer<?> player, String[] args) {
CmdInstance command = CmdConfirm.getPending(player); CmdInstance command = CmdConfirm.getPending(player);
if (command == null) { if (command == null) {
player.sendMessage(TranslatableCaption.of("confirm.failed_confirm")); player.sendMessage(TranslatableCaption.miniMessage("confirm.failed_confirm"));
return false; return false;
} }
CmdConfirm.removePending(player); CmdConfirm.removePending(player);
if ((System.currentTimeMillis() - command.timestamp) if ((System.currentTimeMillis() - command.timestamp)
> Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS * 1000) { > Settings.Confirmation.CONFIRMATION_TIMEOUT_SECONDS * 1000) {
player.sendMessage(TranslatableCaption.of("confirm.expired_confirm")); player.sendMessage(TranslatableCaption.miniMessage("confirm.expired_confirm"));
return false; return false;
} }
TaskManager.runTaskAsync(command.command); TaskManager.runTaskAsync(command.command);

View File

@ -37,7 +37,7 @@ import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.DoneFlag; import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@CommandDeclaration(command = "continue", @CommandDeclaration(command = "continue",
@ -57,32 +57,32 @@ public class Continue extends SubCommand {
public boolean onCommand(PlotPlayer<?> player, String[] args) { public boolean onCommand(PlotPlayer<?> player, String[] args) {
Plot plot = player.getCurrentPlot(); Plot plot = player.getCurrentPlot();
if ((plot == null) || !plot.hasOwner()) { if ((plot == null) || !plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_CONTINUE)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", TranslatableCaption.of("permission.no_plot_perms").getComponent(player)) Placeholder.miniMessage("node", TranslatableCaption.miniMessage("permission.no_plot_perms").getComponent(player))
); );
return false; return false;
} }
if (!DoneFlag.isDone(plot)) { if (!DoneFlag.isDone(plot)) {
player.sendMessage(TranslatableCaption.of("done.done_not_done")); player.sendMessage(TranslatableCaption.miniMessage("done.done_not_done"));
return false; return false;
} }
int size = plot.getConnectedPlots().size(); int size = plot.getConnectedPlots().size();
if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots() if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots()
< player.getPlotCount() + size)) { < player.getPlotCount() + size)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.cant_claim_more_plots"), TranslatableCaption.miniMessage("permission.cant_claim_more_plots"),
Template.of("amount", String.valueOf(player.getAllowedPlots())) Placeholder.miniMessage("amount", String.valueOf(player.getAllowedPlots()))
); );
return false; return false;
} }
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
return false; return false;
} }
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(DoneFlag.class); PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(DoneFlag.class);
@ -90,13 +90,13 @@ public class Continue extends SubCommand {
this.eventDispatcher.callFlagRemove(plotFlag, plot); this.eventDispatcher.callFlagRemove(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Done flag removal") Placeholder.miniMessage("value", "Done flag removal")
); );
return true; return true;
} }
plot.removeFlag(event.getFlag()); plot.removeFlag(event.getFlag());
player.sendMessage(TranslatableCaption.of("done.done_removed")); player.sendMessage(TranslatableCaption.miniMessage("done.done_removed"));
return true; return true;
} }

View File

@ -31,7 +31,7 @@ import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
@CommandDeclaration(command = "copy", @CommandDeclaration(command = "copy",
permission = "plots.copy", permission = "plots.copy",
@ -46,18 +46,18 @@ public class Copy extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot1 = location.getPlotAbs(); Plot plot1 = location.getPlotAbs();
if (plot1 == null) { if (plot1 == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot1.isOwner(player.getUUID()) && !Permissions if (!plot1.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN.toString())) { .hasPermission(player, Permission.PERMISSION_ADMIN.toString())) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
if (args.length != 1) { if (args.length != 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot copy <X;Z>") Placeholder.miniMessage("value", "/plot copy <X;Z>")
); );
return false; return false;
} }
@ -66,21 +66,21 @@ public class Copy extends SubCommand {
return false; return false;
} }
if (plot1.equals(plot2)) { if (plot1.equals(plot2)) {
player.sendMessage(TranslatableCaption.of("invalid.origin_cant_be_target")); player.sendMessage(TranslatableCaption.miniMessage("invalid.origin_cant_be_target"));
return false; return false;
} }
if (!plot1.getArea().isCompatible(plot2.getArea())) { if (!plot1.getArea().isCompatible(plot2.getArea())) {
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible")); player.sendMessage(TranslatableCaption.miniMessage("errors.plotworld_incompatible"));
return false; return false;
} }
plot1.getPlotModificationManager().copy(plot2, player).thenAccept(result -> { plot1.getPlotModificationManager().copy(plot2, player).thenAccept(result -> {
if (result) { if (result) {
player.sendMessage(TranslatableCaption.of("move.copy_success"), Template.of("origin", String.valueOf(plot1)), player.sendMessage(TranslatableCaption.miniMessage("move.copy_success"), Placeholder.miniMessage("origin", String.valueOf(plot1)),
Template.of("target", String.valueOf(plot2)) Placeholder.miniMessage("target", String.valueOf(plot2))
); );
} else { } else {
player.sendMessage(TranslatableCaption.of("move.requires_unowned")); player.sendMessage(TranslatableCaption.miniMessage("move.requires_unowned"));
} }
}); });

View File

@ -32,7 +32,7 @@ import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@CommandDeclaration(command = "createroadschematic", @CommandDeclaration(command = "createroadschematic",
@ -55,20 +55,20 @@ public class CreateRoadSchematic extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
if (!(location.getPlotArea() instanceof HybridPlotWorld)) { if (!(location.getPlotArea() instanceof HybridPlotWorld)) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
} }
this.hybridUtils.setupRoadSchematic(plot); this.hybridUtils.setupRoadSchematic(plot);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("schematics.schematic_road_created"), TranslatableCaption.miniMessage("schematics.schematic_road_created"),
Template.of("command", "/plot debugroadregen") Placeholder.miniMessage("command", "/plot debugroadregen")
); );
return true; return true;
} }

View File

@ -47,7 +47,7 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.FileUtils; import com.plotsquared.core.util.FileUtils;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.File; import java.io.File;
@ -91,13 +91,13 @@ public class DatabaseCommand extends SubCommand {
TaskManager.runTaskAsync(() -> { TaskManager.runTaskAsync(() -> {
try { try {
ArrayList<Plot> ps = new ArrayList<>(plots); ArrayList<Plot> ps = new ArrayList<>(plots);
player.sendMessage(TranslatableCaption.of("database.starting_conversion")); player.sendMessage(TranslatableCaption.miniMessage("database.starting_conversion"));
manager.createPlotsAndData(ps, () -> { manager.createPlotsAndData(ps, () -> {
player.sendMessage(TranslatableCaption.of("database.conversion_done")); player.sendMessage(TranslatableCaption.miniMessage("database.conversion_done"));
manager.close(); manager.close();
}); });
} catch (Exception e) { } catch (Exception e) {
player.sendMessage(TranslatableCaption.of("database.conversion_failed")); player.sendMessage(TranslatableCaption.miniMessage("database.conversion_failed"));
e.printStackTrace(); e.printStackTrace();
} }
}); });
@ -107,8 +107,8 @@ public class DatabaseCommand extends SubCommand {
public boolean onCommand(final PlotPlayer<?> player, String[] args) { public boolean onCommand(final PlotPlayer<?> player, String[] args) {
if (args.length < 1) { if (args.length < 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot database [area] <sqlite | mysql | import>") Placeholder.miniMessage("value", "/plot database [area] <sqlite | mysql | import>")
); );
return false; return false;
} }
@ -122,10 +122,10 @@ public class DatabaseCommand extends SubCommand {
} }
if (args.length < 1) { if (args.length < 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot database [area] <sqlite|mysql|import>") Placeholder.miniMessage("value", "/plot database [area] <sqlite|mysql|import>")
); );
player.sendMessage(TranslatableCaption.of("database.arg")); player.sendMessage(TranslatableCaption.miniMessage("database.arg"));
return false; return false;
} }
try { try {
@ -135,8 +135,8 @@ public class DatabaseCommand extends SubCommand {
case "import" -> { case "import" -> {
if (args.length < 2) { if (args.length < 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot database import <sqlite file> [prefix]") Placeholder.miniMessage("value", "/plot database import <sqlite file> [prefix]")
); );
return false; return false;
} }
@ -146,12 +146,12 @@ public class DatabaseCommand extends SubCommand {
); );
if (!file.exists()) { if (!file.exists()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("database.does_not_exist"), TranslatableCaption.miniMessage("database.does_not_exist"),
Template.of("value", String.valueOf(file)) Placeholder.miniMessage("value", String.valueOf(file))
); );
return false; return false;
} }
player.sendMessage(TranslatableCaption.of("database.starting_conversion")); player.sendMessage(TranslatableCaption.miniMessage("database.starting_conversion"));
implementation = new SQLite(file); implementation = new SQLite(file);
SQLManager manager = new SQLManager(implementation, args.length == 3 ? args[2] : "", SQLManager manager = new SQLManager(implementation, args.length == 3 ? args[2] : "",
this.eventDispatcher, this.plotListener, this.worldConfiguration this.eventDispatcher, this.plotListener, this.worldConfiguration
@ -190,9 +190,9 @@ public class DatabaseCommand extends SubCommand {
} }
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("database.skipping_duplicated_plot"), TranslatableCaption.miniMessage("database.skipping_duplicated_plot"),
Template.of("plot", String.valueOf(plot)), Placeholder.miniMessage("plot", String.valueOf(plot)),
Template.of("id", String.valueOf(plot.temp)) Placeholder.miniMessage("id", String.valueOf(plot.temp))
); );
continue; continue;
} }
@ -207,7 +207,7 @@ public class DatabaseCommand extends SubCommand {
} }
DBFunc.createPlotsAndData( DBFunc.createPlotsAndData(
plots, plots,
() -> player.sendMessage(TranslatableCaption.of("database.conversion_done")) () -> player.sendMessage(TranslatableCaption.miniMessage("database.conversion_done"))
); );
return true; return true;
} }
@ -252,19 +252,19 @@ public class DatabaseCommand extends SubCommand {
DatabaseCommand.insertPlots(manager, plots, player); DatabaseCommand.insertPlots(manager, plots, player);
return true; return true;
} catch (ClassNotFoundException | SQLException e) { } catch (ClassNotFoundException | SQLException e) {
player.sendMessage(TranslatableCaption.of("database.failed_to_save_plots")); player.sendMessage(TranslatableCaption.miniMessage("database.failed_to_save_plots"));
player.sendMessage(TranslatableCaption.of("errors.stacktrace_begin")); player.sendMessage(TranslatableCaption.miniMessage("errors.stacktrace_begin"));
e.printStackTrace(); e.printStackTrace();
player.sendMessage(TranslatableCaption.of(("errors.stacktrace_end"))); player.sendMessage(TranslatableCaption.miniMessage(("errors.stacktrace_end")));
player.sendMessage(TranslatableCaption.of("database.invalid_args")); player.sendMessage(TranslatableCaption.miniMessage("database.invalid_args"));
return false; return false;
} }
} catch (ClassNotFoundException | SQLException e) { } catch (ClassNotFoundException | SQLException e) {
player.sendMessage(TranslatableCaption.of("database.failed_to_open")); player.sendMessage(TranslatableCaption.miniMessage("database.failed_to_open"));
player.sendMessage(TranslatableCaption.of("errors.stacktrace_begin")); player.sendMessage(TranslatableCaption.miniMessage("errors.stacktrace_begin"));
e.printStackTrace(); e.printStackTrace();
player.sendMessage(TranslatableCaption.of("errors.stacktrace_end")); player.sendMessage(TranslatableCaption.miniMessage("errors.stacktrace_end"));
player.sendMessage(TranslatableCaption.of("database.invalid_args")); player.sendMessage(TranslatableCaption.miniMessage("database.invalid_args"));
return false; return false;
} }
} }

View File

@ -41,7 +41,8 @@ import com.plotsquared.core.uuid.UUIDMapping;
import com.sk89q.worldedit.world.entity.EntityType; import com.sk89q.worldedit.world.entity.EntityType;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection; import java.util.Collection;
@ -74,8 +75,8 @@ public class Debug extends SubCommand {
public boolean onCommand(PlotPlayer<?> player, String[] args) { public boolean onCommand(PlotPlayer<?> player, String[] args) {
if (args.length == 0) { if (args.length == 0) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot debug <loadedchunks | player | debug-players | entitytypes | msg>") Placeholder.miniMessage("value", "/plot debug <loadedchunks | player | debug-players | entitytypes | msg>")
); );
} }
if (args.length > 0) { if (args.length > 0) {
@ -90,7 +91,7 @@ public class Debug extends SubCommand {
} }
if (args.length > 0 && "loadedchunks".equalsIgnoreCase(args[0])) { if (args.length > 0 && "loadedchunks".equalsIgnoreCase(args[0])) {
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
player.sendMessage(TranslatableCaption.of("debug.fetching_loaded_chunks")); player.sendMessage(TranslatableCaption.miniMessage("debug.fetching_loaded_chunks"));
TaskManager.runTaskAsync(() -> player.sendMessage(StaticCaption TaskManager.runTaskAsync(() -> player.sendMessage(StaticCaption
.of("Loaded chunks: " + this.worldUtil .of("Loaded chunks: " + this.worldUtil
.getChunkChunks(player.getLocation().getWorldName()) .getChunkChunks(player.getLocation().getWorldName())
@ -101,24 +102,24 @@ public class Debug extends SubCommand {
if (args.length > 0 && "uuids".equalsIgnoreCase(args[0])) { if (args.length > 0 && "uuids".equalsIgnoreCase(args[0])) {
final Collection<UUIDMapping> mappings = PlotSquared.get().getImpromptuUUIDPipeline().getAllImmediately(); final Collection<UUIDMapping> mappings = PlotSquared.get().getImpromptuUUIDPipeline().getAllImmediately();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debug.cached_uuids"), TranslatableCaption.miniMessage("debug.cached_uuids"),
Template.of("value", String.valueOf(mappings.size())) Placeholder.miniMessage("value", String.valueOf(mappings.size()))
); );
return true; return true;
} }
if (args.length > 0 && "debug-players".equalsIgnoreCase(args[0])) { if (args.length > 0 && "debug-players".equalsIgnoreCase(args[0])) {
player.sendMessage(TranslatableCaption.of("debug.player_in_debugmode")); player.sendMessage(TranslatableCaption.miniMessage("debug.player_in_debugmode"));
for (final PlotPlayer<?> pp : PlotPlayer.getDebugModePlayers()) { for (final PlotPlayer<?> pp : PlotPlayer.getDebugModePlayers()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debug.player_in_debugmode_list"), TranslatableCaption.miniMessage("debug.player_in_debugmode_list"),
Template.of("value", pp.getName()) Placeholder.miniMessage("value", pp.getName())
); );
} }
return true; return true;
} }
if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) { if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) {
EntityCategories.init(); EntityCategories.init();
player.sendMessage(TranslatableCaption.of("debug.entity_categories")); player.sendMessage(TranslatableCaption.miniMessage("debug.entity_categories"));
EntityCategory.REGISTRY.forEach(category -> { EntityCategory.REGISTRY.forEach(category -> {
final StringBuilder builder = final StringBuilder builder =
new StringBuilder("§7- §6").append(category.getId()).append("§7: §6"); new StringBuilder("§7- §6").append(category.getId()).append("§7: §6");
@ -144,28 +145,30 @@ public class Debug extends SubCommand {
.getCaptionMap(TranslatableCaption.DEFAULT_NAMESPACE) .getCaptionMap(TranslatableCaption.DEFAULT_NAMESPACE)
.getCaptions(); .getCaptions();
TextComponent.Builder information = Component.text(); TextComponent.Builder information = Component.text();
Component header = MINI_MESSAGE.parse(TranslatableCaption.of("debug.debug_header").getComponent(player) + "\n"); Component header = MINI_MESSAGE.parse(TranslatableCaption.miniMessage("debug.debug_header").getComponent(player) + "\n");
String line = TranslatableCaption.of("debug.debug_line").getComponent(player) + "\n"; String line = TranslatableCaption.miniMessage("debug.debug_line").getComponent(player) + "\n";
String section = TranslatableCaption.of("debug.debug_section").getComponent(player) + "\n"; String section = TranslatableCaption.miniMessage("debug.debug_section").getComponent(player) + "\n";
information.append(header); information.append(header);
information.append(MINI_MESSAGE.parse(section, Template.of("val", "PlotArea"))); information.append(MINI_MESSAGE.deserialize(section,
PlaceholderResolver.placeholders(Placeholder.miniMessage("val", "PlotArea"))));
information.append(MINI_MESSAGE information.append(MINI_MESSAGE
.parse( .deserialize(
line, line,
Template.of("var", "Plot Worlds"), PlaceholderResolver.placeholders(Placeholder.miniMessage("var", "Plot Worlds"),
Template.of("val", StringMan.join(this.plotAreaManager.getAllPlotAreas(), ", ")) Placeholder.miniMessage("val", StringMan.join(this.plotAreaManager.getAllPlotAreas(), ", ")))
)); ));
information.append( information.append(
MINI_MESSAGE.parse( MINI_MESSAGE.deserialize(
line, line,
Template.of("var", "Owned Plots"), PlaceholderResolver.placeholders(Placeholder.miniMessage("var", "Owned Plots"),
Template.of("val", String.valueOf(PlotQuery.newQuery().allPlots().count())) Placeholder.miniMessage("val", String.valueOf(PlotQuery.newQuery().allPlots().count())))
)); ));
information.append(MINI_MESSAGE.parse(section, Template.of("val", "Messages"))); information.append(MINI_MESSAGE.deserialize(section,
information.append(MINI_MESSAGE.parse( PlaceholderResolver.placeholders(Placeholder.miniMessage("val", "Messages"))));
information.append(MINI_MESSAGE.deserialize(
line, line,
Template.of("var", "Total Messages"), PlaceholderResolver.placeholders(Placeholder.miniMessage("var", "Total Messages"),
Template.of("val", String.valueOf(captions.size())) Placeholder.miniMessage("val", String.valueOf(captions.size())))
)); ));
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(information.build()))); player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(information.build())));
return true; return true;

View File

@ -46,10 +46,10 @@ public class DebugAllowUnsafe extends SubCommand {
if (unsafeAllowed.contains(player.getUUID())) { if (unsafeAllowed.contains(player.getUUID())) {
unsafeAllowed.remove(player.getUUID()); unsafeAllowed.remove(player.getUUID());
player.sendMessage(TranslatableCaption.of("unsafe.debugallowunsafe_off")); player.sendMessage(TranslatableCaption.miniMessage("unsafe.debugallowunsafe_off"));
} else { } else {
unsafeAllowed.add(player.getUUID()); unsafeAllowed.add(player.getUUID());
player.sendMessage(TranslatableCaption.of("unsafe.debugallowunsafe_on")); player.sendMessage(TranslatableCaption.miniMessage("unsafe.debugallowunsafe_on"));
} }
return true; return true;
} }

View File

@ -43,7 +43,7 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Arrays; import java.util.Arrays;
@ -95,24 +95,24 @@ public class DebugExec extends SubCommand {
case "analyze" -> { case "analyze" -> {
Plot plot = player.getCurrentPlot(); Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
PlotAnalysis analysis = plot.getComplexity(null); PlotAnalysis analysis = plot.getComplexity(null);
if (analysis != null) { if (analysis != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugexec.changes_column"), TranslatableCaption.miniMessage("debugexec.changes_column"),
Template.of("value", String.valueOf(analysis.changes)) Placeholder.miniMessage("value", String.valueOf(analysis.changes))
); );
return true; return true;
} }
player.sendMessage(TranslatableCaption.of("debugexec.starting_task")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.starting_task"));
this.hybridUtils.analyzePlot(plot, new RunnableVal<>() { this.hybridUtils.analyzePlot(plot, new RunnableVal<>() {
@Override @Override
public void run(PlotAnalysis value) { public void run(PlotAnalysis value) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugexec.analyze_done"), TranslatableCaption.miniMessage("debugexec.analyze_done"),
Template.of("command", "/plot debugexec analyze") Placeholder.miniMessage("command", "/plot debugexec analyze")
); );
} }
}); });
@ -121,10 +121,10 @@ public class DebugExec extends SubCommand {
case "calibrate-analysis" -> { case "calibrate-analysis" -> {
if (args.length != 2) { if (args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot debugexec analyze <threshold>") Placeholder.miniMessage("value", "/plot debugexec analyze <threshold>")
); );
player.sendMessage(TranslatableCaption.of("debugexec.threshold_default")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.threshold_default"));
return false; return false;
} }
double threshold; double threshold;
@ -132,14 +132,14 @@ public class DebugExec extends SubCommand {
threshold = Integer.parseInt(args[1]) / 100d; threshold = Integer.parseInt(args[1]) / 100d;
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugexec.invalid_threshold"), TranslatableCaption.miniMessage("debugexec.invalid_threshold"),
Template.of("value", args[1]) Placeholder.miniMessage("value", args[1])
); );
player.sendMessage(TranslatableCaption.of("debugexec.threshold_default_double")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.threshold_default_double"));
return false; return false;
} }
PlotAnalysis.calcOptimalModifiers( PlotAnalysis.calcOptimalModifiers(
() -> player.sendMessage(TranslatableCaption.of("debugexec.calibration_done")), () -> player.sendMessage(TranslatableCaption.miniMessage("debugexec.calibration_done")),
threshold threshold
); );
return true; return true;
@ -149,25 +149,25 @@ public class DebugExec extends SubCommand {
ExpireManager.IMP = new ExpireManager(this.eventDispatcher); ExpireManager.IMP = new ExpireManager(this.eventDispatcher);
} }
if (ExpireManager.IMP.runAutomatedTask()) { if (ExpireManager.IMP.runAutomatedTask()) {
player.sendMessage(TranslatableCaption.of("debugexec.expiry_started")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.expiry_started"));
} else { } else {
player.sendMessage(TranslatableCaption.of("debugexec.expiry_already_started")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.expiry_already_started"));
} }
return true; return true;
} }
case "stop-expire" -> { case "stop-expire" -> {
if (ExpireManager.IMP == null || !ExpireManager.IMP.cancelTask()) { if (ExpireManager.IMP == null || !ExpireManager.IMP.cancelTask()) {
player.sendMessage(TranslatableCaption.of("debugexec.task_halted")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.task_halted"));
} else { } else {
player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.task_cancelled"));
} }
return true; return true;
} }
case "remove-flag" -> { case "remove-flag" -> {
if (args.length != 2) { if (args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot debugexec remove-flag <flag>") Placeholder.miniMessage("value", "/plot debugexec remove-flag <flag>")
); );
return false; return false;
} }
@ -184,24 +184,24 @@ public class DebugExec extends SubCommand {
} }
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugexec.cleared_flag"), TranslatableCaption.miniMessage("debugexec.cleared_flag"),
Template.of("value", flag) Placeholder.miniMessage("value", flag)
); );
return true; return true;
} }
case "start-rgar" -> { case "start-rgar" -> {
if (args.length != 2) { if (args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "Invalid syntax: /plot debugexec start-rgar <world>") Placeholder.miniMessage("value", "Invalid syntax: /plot debugexec start-rgar <world>")
); );
return false; return false;
} }
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]); PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
if (area == null) { if (area == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.not_valid_plot_world"), TranslatableCaption.miniMessage("errors.not_valid_plot_world"),
Template.of("value", args[1]) Placeholder.miniMessage("value", args[1])
); );
return false; return false;
} }
@ -212,18 +212,18 @@ public class DebugExec extends SubCommand {
result = this.hybridUtils.scheduleRoadUpdate(area, 0); result = this.hybridUtils.scheduleRoadUpdate(area, 0);
} }
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.mass_schematic_update_in_progress"));
return false; return false;
} }
return true; return true;
} }
case "stop-rgar" -> { case "stop-rgar" -> {
if (!HybridUtils.UPDATE) { if (!HybridUtils.UPDATE) {
player.sendMessage(TranslatableCaption.of("debugexec.task_not_running")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.task_not_running"));
return false; return false;
} }
HybridUtils.UPDATE = false; HybridUtils.UPDATE = false;
player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.task_cancelled"));
return true; return true;
} }
} }

View File

@ -70,14 +70,14 @@ public class DebugImportWorlds extends Command {
) throws CommandException { ) throws CommandException {
// UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8)) // UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8))
if (!(this.plotAreaManager instanceof SinglePlotAreaManager)) { if (!(this.plotAreaManager instanceof SinglePlotAreaManager)) {
player.sendMessage(TranslatableCaption.of("debugimportworlds.single_plot_area")); player.sendMessage(TranslatableCaption.miniMessage("debugimportworlds.single_plot_area"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
SinglePlotArea area = ((SinglePlotAreaManager) this.plotAreaManager).getArea(); SinglePlotArea area = ((SinglePlotAreaManager) this.plotAreaManager).getArea();
PlotId id = PlotId.of(0, 0); PlotId id = PlotId.of(0, 0);
File container = PlotSquared.platform().worldContainer(); File container = PlotSquared.platform().worldContainer();
if (container.equals(new File("."))) { if (container.equals(new File("."))) {
player.sendMessage(TranslatableCaption.of("debugimportworlds.world_container")); player.sendMessage(TranslatableCaption.miniMessage("debugimportworlds.world_container"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
for (File folder : container.listFiles()) { for (File folder : container.listFiles()) {
@ -87,7 +87,7 @@ public class DebugImportWorlds extends Command {
if (name.length() > 16) { if (name.length() > 16) {
uuid = UUID.fromString(name); uuid = UUID.fromString(name);
} else { } else {
player.sendMessage(TranslatableCaption.of("players.fetching_player")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_player"));
uuid = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(name, 60000L); uuid = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(name, 60000L);
} }
if (uuid == null) { if (uuid == null) {
@ -103,7 +103,7 @@ public class DebugImportWorlds extends Command {
} }
} }
} }
player.sendMessage(TranslatableCaption.of("players.done")); player.sendMessage(TranslatableCaption.miniMessage("players.done"));
return CompletableFuture.completedFuture(true); return CompletableFuture.completedFuture(true);
} }

View File

@ -38,7 +38,7 @@ import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.PremiumVerification; import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.File; import java.io.File;
@ -132,9 +132,9 @@ public class DebugPaste extends SubCommand {
.addFile(logFile); .addFile(logFile);
} catch (IOException ignored) { } catch (IOException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugpaste.latest_log"), TranslatableCaption.miniMessage("debugpaste.latest_log"),
Template.of("file", "latest.log"), Placeholder.miniMessage("file", "latest.log"),
Template.of("size", "14MB") Placeholder.miniMessage("size", "14MB")
); );
} }
@ -142,16 +142,16 @@ public class DebugPaste extends SubCommand {
incendoPaster.addFile(this.configFile); incendoPaster.addFile(this.configFile);
} catch (final IllegalArgumentException ignored) { } catch (final IllegalArgumentException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugpaste.empty_file"), TranslatableCaption.miniMessage("debugpaste.empty_file"),
Template.of("file", "settings.yml") Placeholder.miniMessage("file", "settings.yml")
); );
} }
try { try {
incendoPaster.addFile(this.worldfile); incendoPaster.addFile(this.worldfile);
} catch (final IllegalArgumentException ignored) { } catch (final IllegalArgumentException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugpaste.empty_file"), TranslatableCaption.miniMessage("debugpaste.empty_file"),
Template.of("file", "worlds.yml") Placeholder.miniMessage("file", "worlds.yml")
); );
} }
@ -163,8 +163,8 @@ public class DebugPaste extends SubCommand {
incendoPaster.addFile(MultiverseWorlds, "Multiverse-Core/worlds.yml"); incendoPaster.addFile(MultiverseWorlds, "Multiverse-Core/worlds.yml");
} catch (final IOException ignored) { } catch (final IOException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugpaste.skip_multiverse"), TranslatableCaption.miniMessage("debugpaste.skip_multiverse"),
Template.of("file", "worlds.yml") Placeholder.miniMessage("file", "worlds.yml")
); );
} }
@ -178,21 +178,21 @@ public class DebugPaste extends SubCommand {
final String link = final String link =
String.format("https://athion.net/ISPaster/paste/view/%s", pasteId); String.format("https://athion.net/ISPaster/paste/view/%s", pasteId);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugpaste.debug_report_created"), TranslatableCaption.miniMessage("debugpaste.debug_report_created"),
Template.of("url", link) Placeholder.miniMessage("url", link)
); );
} else { } else {
final String responseMessage = jsonObject.get("response").getAsString(); final String responseMessage = jsonObject.get("response").getAsString();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugpaste.creation_failed"), TranslatableCaption.miniMessage("debugpaste.creation_failed"),
Template.of("value", responseMessage) Placeholder.miniMessage("value", responseMessage)
); );
} }
} catch (final Throwable throwable) { } catch (final Throwable throwable) {
throwable.printStackTrace(); throwable.printStackTrace();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugpaste.creation_failed"), TranslatableCaption.miniMessage("debugpaste.creation_failed"),
Template.of("value", throwable.getMessage()) Placeholder.miniMessage("value", throwable.getMessage())
); );
} }
} catch (IOException e) { } catch (IOException e) {

View File

@ -35,7 +35,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.queue.QueueCoordinator; import com.plotsquared.core.queue.QueueCoordinator;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Arrays; import java.util.Arrays;
@ -66,16 +66,16 @@ public class DebugRoadRegen extends SubCommand {
Plot plot = location.getPlotAbs(); Plot plot = location.getPlotAbs();
if (args.length < 1) { if (args.length < 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", DebugRoadRegen.USAGE) Placeholder.miniMessage("value", DebugRoadRegen.USAGE)
); );
return false; return false;
} }
PlotArea area = player.getPlotAreaAbs(); PlotArea area = player.getPlotAreaAbs();
check(area, TranslatableCaption.of("errors.not_in_plot_world")); check(area, TranslatableCaption.miniMessage("errors.not_in_plot_world"));
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
String kind = args[0].toLowerCase(); String kind = args[0].toLowerCase();
@ -86,8 +86,8 @@ public class DebugRoadRegen extends SubCommand {
return regenRegion(player, Arrays.copyOfRange(args, 1, args.length)); return regenRegion(player, Arrays.copyOfRange(args, 1, args.length));
default: default:
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", DebugRoadRegen.USAGE) Placeholder.miniMessage("value", DebugRoadRegen.USAGE)
); );
return false; return false;
} }
@ -97,24 +97,24 @@ public class DebugRoadRegen extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
PlotArea area = location.getPlotArea(); PlotArea area = location.getPlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
} }
Plot plot = player.getCurrentPlot(); Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
} else if (plot.isMerged()) { } else if (plot.isMerged()) {
player.sendMessage(TranslatableCaption.of("debug.requires_unmerged")); player.sendMessage(TranslatableCaption.miniMessage("debug.requires_unmerged"));
} else { } else {
PlotManager manager = area.getPlotManager(); PlotManager manager = area.getPlotManager();
QueueCoordinator queue = area.getQueue(); QueueCoordinator queue = area.getQueue();
queue.setCompleteTask(() -> { queue.setCompleteTask(() -> {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugroadregen.regen_done"), TranslatableCaption.miniMessage("debugroadregen.regen_done"),
Template.of("value", plot.getId().toString()) Placeholder.miniMessage("value", plot.getId().toString())
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugroadregen.regen_all"), TranslatableCaption.miniMessage("debugroadregen.regen_all"),
Template.of("value", "/plot regenallroads") Placeholder.miniMessage("value", "/plot regenallroads")
); );
}); });
manager.createRoadEast(plot, queue); manager.createRoadEast(plot, queue);
@ -132,19 +132,19 @@ public class DebugRoadRegen extends SubCommand {
height = Integer.parseInt(args[0]); height = Integer.parseInt(args[0]);
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_valid_number"), TranslatableCaption.miniMessage("invalid.not_valid_number"),
Template.of("value", "0, 256") Placeholder.miniMessage("value", "0, 256")
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", DebugRoadRegen.USAGE) Placeholder.miniMessage("value", DebugRoadRegen.USAGE)
); );
return false; return false;
} }
} else if (args.length != 0) { } else if (args.length != 0) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", DebugRoadRegen.USAGE) Placeholder.miniMessage("value", DebugRoadRegen.USAGE)
); );
return false; return false;
} }
@ -152,25 +152,25 @@ public class DebugRoadRegen extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
PlotArea area = location.getPlotArea(); PlotArea area = location.getPlotArea();
if (area == null) { if (area == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
} }
Plot plot = player.getCurrentPlot(); Plot plot = player.getCurrentPlot();
PlotManager manager = area.getPlotManager(); PlotManager manager = area.getPlotManager();
if (!(manager instanceof HybridPlotManager)) { if (!(manager instanceof HybridPlotManager)) {
player.sendMessage(TranslatableCaption.of("errors.invalid_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.invalid_plot_world"));
return true; return true;
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugroadregen.schematic"), TranslatableCaption.miniMessage("debugroadregen.schematic"),
Template.of("command", "/plot createroadschematic") Placeholder.miniMessage("command", "/plot createroadschematic")
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugroadregen.regenallroads"), TranslatableCaption.miniMessage("debugroadregen.regenallroads"),
Template.of("command", "/plot regenallroads") Placeholder.miniMessage("command", "/plot regenallroads")
); );
boolean result = this.hybridUtils.scheduleSingleRegionRoadUpdate(plot, height); boolean result = this.hybridUtils.scheduleSingleRegionRoadUpdate(plot, height);
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.mass_schematic_update_in_progress"));
return false; return false;
} }
return true; return true;

View File

@ -43,10 +43,10 @@ public class DebugSaveTest extends SubCommand {
@Override @Override
public boolean onCommand(final PlotPlayer<?> player, String[] args) { public boolean onCommand(final PlotPlayer<?> player, String[] args) {
final List<Plot> plots = PlotQuery.newQuery().allPlots().asList(); final List<Plot> plots = PlotQuery.newQuery().allPlots().asList();
player.sendMessage(TranslatableCaption.of("debugsavetest.starting")); player.sendMessage(TranslatableCaption.miniMessage("debugsavetest.starting"));
DBFunc.createPlotsAndData( DBFunc.createPlotsAndData(
plots, plots,
() -> player.sendMessage(TranslatableCaption.of("debugsavetest.done")) () -> player.sendMessage(TranslatableCaption.miniMessage("debugsavetest.done"))
); );
return true; return true;
} }

View File

@ -40,7 +40,7 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PlotExpression; import com.plotsquared.core.util.PlotExpression;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@ -70,29 +70,29 @@ public class Delete extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
final Plot plot = location.getPlotAbs(); final Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
Result eventResult = this.eventDispatcher.callDelete(plot).getEventResult(); Result eventResult = this.eventDispatcher.callDelete(plot).getEventResult();
if (eventResult == Result.DENY) { if (eventResult == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Delete") Placeholder.miniMessage("value", "Delete")
); );
return true; return true;
} }
boolean force = eventResult == Result.FORCE; boolean force = eventResult == Result.FORCE;
if (!force && !plot.isOwner(player.getUUID()) && !Permissions if (!force && !plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DELETE)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DELETE)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
final PlotArea plotArea = plot.getArea(); final PlotArea plotArea = plot.getArea();
@ -102,7 +102,7 @@ public class Delete extends SubCommand {
player.getPlotCount(location.getWorldName()); player.getPlotCount(location.getWorldName());
Runnable run = () -> { Runnable run = () -> {
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
return; return;
} }
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
@ -120,22 +120,22 @@ public class Delete extends SubCommand {
if (value > 0d) { if (value > 0d) {
this.econHandler.depositMoney(player, value); this.econHandler.depositMoney(player, value);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.added_balance"), TranslatableCaption.miniMessage("economy.added_balance"),
Template.of("money", this.econHandler.format(value)) Placeholder.miniMessage("money", this.econHandler.format(value))
); );
} }
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("working.deleting_done"), TranslatableCaption.miniMessage("working.deleting_done"),
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)), Placeholder.miniMessage("amount", String.valueOf(System.currentTimeMillis() - start)),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
eventDispatcher.callPostDelete(plot); eventDispatcher.callPostDelete(plot);
}); });
if (result) { if (result) {
plot.addRunning(); plot.addRunning();
} else { } else {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
} }
}; };
if (hasConfirmation(player)) { if (hasConfirmation(player)) {

View File

@ -42,7 +42,7 @@ import com.plotsquared.core.util.PlayerManager;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.gamemode.GameModes;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection; import java.util.Collection;
@ -79,16 +79,16 @@ public class Deny extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
final Plot plot = location.getPlotAbs(); final Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DENY)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DENY)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return true; return true;
} }
@ -96,19 +96,19 @@ public class Deny extends SubCommand {
int size = plot.getDenied().size(); int size = plot.getDenied().size();
if (size >= maxDenySize) { if (size >= maxDenySize) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("members.plot_max_members_denied"), TranslatableCaption.miniMessage("members.plot_max_members_denied"),
Template.of("amount", String.valueOf(size)) Placeholder.miniMessage("amount", String.valueOf(size))
); );
return false; return false;
} }
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (throwable != null || uuids.isEmpty()) { } else if (throwable != null || uuids.isEmpty()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
} else { } else {
for (UUID uuid : uuids) { for (UUID uuid : uuids) {
@ -116,16 +116,16 @@ public class Deny extends SubCommand {
Permissions.hasPermission(player, Permission.PERMISSION_DENY_EVERYONE) || Permissions Permissions.hasPermission(player, Permission.PERMISSION_DENY_EVERYONE) || Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DENY))) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DENY))) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
} else if (plot.isOwner(uuid)) { } else if (plot.isOwner(uuid)) {
player.sendMessage(TranslatableCaption.of("deny.cant_remove_owner")); player.sendMessage(TranslatableCaption.miniMessage("deny.cant_remove_owner"));
return; return;
} else if (plot.getDenied().contains(uuid)) { } else if (plot.getDenied().contains(uuid)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("member.already_added"), TranslatableCaption.miniMessage("member.already_added"),
Template.of("player", PlayerManager.getName(uuid)) Placeholder.miniMessage("player", PlayerManager.getName(uuid))
); );
return; return;
} else { } else {
@ -148,7 +148,7 @@ public class Deny extends SubCommand {
} }
} }
} }
player.sendMessage(TranslatableCaption.of("deny.denied_added")); player.sendMessage(TranslatableCaption.miniMessage("deny.denied_added"));
} }
}); });
@ -175,7 +175,7 @@ public class Deny extends SubCommand {
} }
Location location = player.getLocation(); Location location = player.getLocation();
Location spawn = this.worldUtil.getSpawn(location.getWorldName()); Location spawn = this.worldUtil.getSpawn(location.getWorldName());
player.sendMessage(TranslatableCaption.of("deny.you_got_denied")); player.sendMessage(TranslatableCaption.miniMessage("deny.you_got_denied"));
if (plot.equals(spawn.getPlot())) { if (plot.equals(spawn.getPlot())) {
Location newSpawn = this.worldUtil.getSpawn(this.plotAreaManager.getAllWorlds()[0]); Location newSpawn = this.worldUtil.getSpawn(this.plotAreaManager.getAllWorlds()[0]);
if (plot.equals(newSpawn.getPlot())) { if (plot.equals(newSpawn.getPlot())) {

View File

@ -34,7 +34,7 @@ import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag; import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@CommandDeclaration(command = "setdescription", @CommandDeclaration(command = "setdescription",
@ -60,13 +60,13 @@ public class Desc extends SetCommand {
.getFlag(DescriptionFlag.class), plot); .getFlag(DescriptionFlag.class), plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Description removal") Placeholder.miniMessage("value", "Description removal")
); );
return false; return false;
} }
plot.removeFlag(event.getFlag()); plot.removeFlag(event.getFlag());
player.sendMessage(TranslatableCaption.of("desc.desc_unset")); player.sendMessage(TranslatableCaption.miniMessage("desc.desc_unset"));
return true; return true;
} }
PlotFlagAddEvent event = this.eventDispatcher.callFlagAdd(plot PlotFlagAddEvent event = this.eventDispatcher.callFlagAdd(plot
@ -75,17 +75,17 @@ public class Desc extends SetCommand {
.createFlagInstance(desc), plot); .createFlagInstance(desc), plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Description set") Placeholder.miniMessage("value", "Description set")
); );
return false; return false;
} }
boolean result = plot.setFlag(event.getFlag()); boolean result = plot.setFlag(event.getFlag());
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("flag.flag_not_added")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_added"));
return false; return false;
} }
player.sendMessage(TranslatableCaption.of("desc.desc_set")); player.sendMessage(TranslatableCaption.miniMessage("desc.desc_set"));
return true; return true;
} }

View File

@ -43,7 +43,7 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@CommandDeclaration(command = "done", @CommandDeclaration(command = "done",
@ -70,35 +70,35 @@ public class Done extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
final Plot plot = location.getPlotAbs(); final Plot plot = location.getPlotAbs();
if ((plot == null) || !plot.hasOwner()) { if ((plot == null) || !plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
PlotDoneEvent event = this.eventDispatcher.callDone(plot); PlotDoneEvent event = this.eventDispatcher.callDone(plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Done") Placeholder.miniMessage("value", "Done")
); );
return true; return true;
} }
boolean force = event.getEventResult() == Result.FORCE; boolean force = event.getEventResult() == Result.FORCE;
if (!force && !plot.isOwner(player.getUUID()) && !Permissions if (!force && !plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DONE)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DONE)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
if (DoneFlag.isDone(plot)) { if (DoneFlag.isDone(plot)) {
player.sendMessage(TranslatableCaption.of("done.done_already_done")); player.sendMessage(TranslatableCaption.miniMessage("done.done_already_done"));
return false; return false;
} }
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
return false; return false;
} }
plot.addRunning(); plot.addRunning();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("web.generating_link"), TranslatableCaption.miniMessage("web.generating_link"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done"); final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
if (ExpireManager.IMP == null || doneRequirements == null) { if (ExpireManager.IMP == null || doneRequirements == null) {
@ -120,7 +120,7 @@ public class Done extends SubCommand {
private void finish(Plot plot, PlotPlayer<?> player, boolean success) { private void finish(Plot plot, PlotPlayer<?> player, boolean success) {
if (!success) { if (!success) {
player.sendMessage(TranslatableCaption.of("done.done_insufficient_complexity")); player.sendMessage(TranslatableCaption.miniMessage("done.done_insufficient_complexity"));
return; return;
} }
long flagValue = System.currentTimeMillis() / 1000; long flagValue = System.currentTimeMillis() / 1000;
@ -128,11 +128,11 @@ public class Done extends SubCommand {
.createFlagInstance(Long.toString(flagValue)); .createFlagInstance(Long.toString(flagValue));
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage(TranslatableCaption.of("events.event_denied")); player.sendMessage(TranslatableCaption.miniMessage("events.event_denied"));
return; return;
} }
plot.setFlag(plotFlag); plot.setFlag(plotFlag);
player.sendMessage(TranslatableCaption.of("done.done_success")); player.sendMessage(TranslatableCaption.miniMessage("done.done_success"));
} }
} }

View File

@ -41,7 +41,7 @@ import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.net.URL; import java.net.URL;
@ -82,36 +82,36 @@ public class Download extends SubCommand {
public boolean onCommand(final PlotPlayer<?> player, String[] args) { public boolean onCommand(final PlotPlayer<?> player, String[] args) {
String world = player.getLocation().getWorldName(); String world = player.getLocation().getWorldName();
if (!this.plotAreaManager.hasPlotArea(world)) { if (!this.plotAreaManager.hasPlotArea(world)) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!DoneFlag.isDone(plot))) && !Permissions if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!DoneFlag.isDone(plot))) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
player.sendMessage(TranslatableCaption.of("done.done_not_done")); player.sendMessage(TranslatableCaption.miniMessage("done.done_not_done"));
return false; return false;
} }
if ((!plot.isOwner(player.getUUID())) && !Permissions if ((!plot.isOwner(player.getUUID())) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN.toString())) { .hasPermission(player, Permission.PERMISSION_ADMIN.toString())) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
return false; return false;
} }
if (args.length == 0 || (args.length == 1 && StringMan if (args.length == 0 || (args.length == 1 && StringMan
.isEqualIgnoreCaseToAny(args[0], "sch", "schem", "schematic"))) { .isEqualIgnoreCaseToAny(args[0], "sch", "schem", "schematic"))) {
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
plot.addRunning(); plot.addRunning();
@ -120,12 +120,12 @@ public class Download extends SubCommand {
.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) { .isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_DOWNLOAD_WORLD)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_DOWNLOAD_WORLD)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_DOWNLOAD_WORLD.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_DOWNLOAD_WORLD.toString())
); );
return false; return false;
} }
player.sendMessage(TranslatableCaption.of("schematics.mca_file_size")); player.sendMessage(TranslatableCaption.miniMessage("schematics.mca_file_size"));
plot.addRunning(); plot.addRunning();
this.worldUtil.saveWorld(world); this.worldUtil.saveWorld(world);
this.worldUtil.upload(plot, null, null, new RunnableVal<>() { this.worldUtil.upload(plot, null, null, new RunnableVal<>() {
@ -134,19 +134,19 @@ public class Download extends SubCommand {
plot.removeRunning(); plot.removeRunning();
if (url == null) { if (url == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("web.generating_link_failed"), TranslatableCaption.miniMessage("web.generating_link_failed"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
return; return;
} }
player.sendMessage(TranslatableCaption.of("web.generation_link_success_legacy_world"), Template.of("url", url.toString())); player.sendMessage(TranslatableCaption.miniMessage("web.generation_link_success_legacy_world"), Placeholder.miniMessage("url", url.toString()));
} }
}); });
} else { } else {
sendUsage(player); sendUsage(player);
return false; return false;
} }
player.sendMessage(TranslatableCaption.of("web.generating_link"), Template.of("plot", plot.getId().toString())); player.sendMessage(TranslatableCaption.miniMessage("web.generating_link"), Placeholder.miniMessage("plot", plot.getId().toString()));
return true; return true;
} }
@ -189,9 +189,9 @@ public class Download extends SubCommand {
@Override @Override
public void run(URL value) { public void run(URL value) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("web.generation_link_success"), TranslatableCaption.miniMessage("web.generation_link_success"),
Template.of("download", value.toString()), Placeholder.miniMessage("download", value.toString()),
Template.of("delete", "Not available") Placeholder.miniMessage("delete", "Not available")
); );
player.sendMessage(StaticCaption.of(value.toString())); player.sendMessage(StaticCaption.of(value.toString()));
} }
@ -204,14 +204,14 @@ public class Download extends SubCommand {
.whenComplete((result, throwable) -> { .whenComplete((result, throwable) -> {
if (throwable != null || !result.isSuccess()) { if (throwable != null || !result.isSuccess()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("web.generating_link_failed"), TranslatableCaption.miniMessage("web.generating_link_failed"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("web.generation_link_success"), TranslatableCaption.miniMessage("web.generation_link_success"),
Template.of("download", result.getDownloadUrl()), Placeholder.miniMessage("download", result.getDownloadUrl()),
Template.of("delete", result.getDeletionUrl()) Placeholder.miniMessage("delete", result.getDeletionUrl())
); );
} }
}); });

View File

@ -29,7 +29,7 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.CaptionUtility; import com.plotsquared.core.configuration.caption.CaptionUtility;
import com.plotsquared.core.configuration.caption.StaticCaption; import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.Placeholders;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.events.PlotFlagAddEvent; import com.plotsquared.core.events.PlotFlagAddEvent;
import com.plotsquared.core.events.PlotFlagRemoveEvent; import com.plotsquared.core.events.PlotFlagRemoveEvent;
@ -53,7 +53,8 @@ import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -85,8 +86,8 @@ public final class FlagCommand extends Command {
private static boolean sendMessage(PlotPlayer<?> player) { private static boolean sendMessage(PlotPlayer<?> player) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot flag <set | remove | add | list | info> <flag> <value>") Placeholder.miniMessage("value", "/plot flag <set | remove | add | list | info> <flag> <value>")
); );
return true; return true;
} }
@ -111,8 +112,8 @@ public final class FlagCommand extends Command {
} }
if (!result) { if (!result) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of( Placeholder.miniMessage(
"node", "node",
perm perm
) )
@ -131,16 +132,16 @@ public final class FlagCommand extends Command {
); );
final boolean result = Permissions.hasPermission(player, permission); final boolean result = Permissions.hasPermission(player, permission);
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), Template.of("node", permission)); player.sendMessage(TranslatableCaption.miniMessage("permission.no_permission"), Placeholder.miniMessage("node", permission));
return false; return false;
} }
} }
} catch (final FlagParseException e) { } catch (final FlagParseException e) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("flag.flag_parse_error"), TranslatableCaption.miniMessage("flag.flag_parse_error"),
Template.of("flag_name", flag.getName()), Placeholder.miniMessage("flag_name", flag.getName()),
Template.of("flag_value", e.getValue()), Placeholder.miniMessage("flag_value", e.getValue()),
Template.of("error", e.getErrorMessage().getComponent(player)) Placeholder.miniMessage("error", e.getErrorMessage().getComponent(player))
); );
return false; return false;
} catch (final Exception e) { } catch (final Exception e) {
@ -157,7 +158,7 @@ public final class FlagCommand extends Command {
perm = basePerm; perm = basePerm;
} }
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), Template.of("node", perm)); player.sendMessage(TranslatableCaption.miniMessage("permission.no_permission"), Placeholder.miniMessage("node", perm));
} }
return result; return result;
} }
@ -171,18 +172,18 @@ public final class FlagCommand extends Command {
final Location location = player.getLocation(); final Location location = player.getLocation();
final Plot plot = location.getPlotAbs(); final Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed")); player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_SET_FLAG_OTHER)) { .hasPermission(player, Permission.PERMISSION_SET_FLAG_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_SET_FLAG_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_SET_FLAG_OTHER))
); );
return false; return false;
} }
@ -216,14 +217,14 @@ public final class FlagCommand extends Command {
final String best = stringComparison.getBestMatch(); final String best = stringComparison.getBestMatch();
if (best != null) { if (best != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("flag.not_valid_flag_suggested"), TranslatableCaption.miniMessage("flag.not_valid_flag_suggested"),
Template.of("value", best) Placeholder.miniMessage("value", best)
); );
suggested = true; suggested = true;
} }
} catch (final Exception ignored) { /* Happens sometimes because of mean code */ } } catch (final Exception ignored) { /* Happens sometimes because of mean code */ }
if (!suggested) { if (!suggested) {
player.sendMessage(TranslatableCaption.of("flag.not_valid_flag")); player.sendMessage(TranslatableCaption.miniMessage("flag.not_valid_flag"));
} }
return null; return null;
} }
@ -325,8 +326,8 @@ public final class FlagCommand extends Command {
} }
if (args.length < 2) { if (args.length < 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot flag set <flag> <value>") Placeholder.miniMessage("value", "/plot flag set <flag> <value>")
); );
return; return;
} }
@ -338,8 +339,8 @@ public final class FlagCommand extends Command {
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Flag set") Placeholder.miniMessage("value", "Flag set")
); );
return; return;
} }
@ -354,16 +355,16 @@ public final class FlagCommand extends Command {
parsed = plotFlag.parse(value); parsed = plotFlag.parse(value);
} catch (final FlagParseException e) { } catch (final FlagParseException e) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("flag.flag_parse_error"), TranslatableCaption.miniMessage("flag.flag_parse_error"),
Template.of("flag_name", plotFlag.getName()), Placeholder.miniMessage("flag_name", plotFlag.getName()),
Template.of("flag_value", e.getValue()), Placeholder.miniMessage("flag_value", e.getValue()),
Template.of("error", e.getErrorMessage().getComponent(player)) Placeholder.miniMessage("error", e.getErrorMessage().getComponent(player))
); );
return; return;
} }
plot.setFlag(parsed); plot.setFlag(parsed);
player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])), player.sendMessage(TranslatableCaption.miniMessage("flag.flag_added"), Placeholder.miniMessage("flag", String.valueOf(args[0])),
Template.of("value", String.valueOf(parsed)) Placeholder.miniMessage("value", String.valueOf(parsed))
); );
} }
@ -383,8 +384,8 @@ public final class FlagCommand extends Command {
} }
if (args.length < 2) { if (args.length < 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot flag add <flag> <values>") Placeholder.miniMessage("value", "/plot flag add <flag> <values>")
); );
return; return;
} }
@ -396,8 +397,8 @@ public final class FlagCommand extends Command {
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Flag add") Placeholder.miniMessage("value", "Flag add")
); );
return; return;
} }
@ -417,21 +418,21 @@ public final class FlagCommand extends Command {
parsed = event.getFlag().parse(value); parsed = event.getFlag().parse(value);
} catch (FlagParseException e) { } catch (FlagParseException e) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("flag.flag_parse_error"), TranslatableCaption.miniMessage("flag.flag_parse_error"),
Template.of("flag_name", plotFlag.getName()), Placeholder.miniMessage("flag_name", plotFlag.getName()),
Template.of("flag_value", e.getValue()), Placeholder.miniMessage("flag_value", e.getValue()),
Template.of("error", e.getErrorMessage().getComponent(player)) Placeholder.miniMessage("error", e.getErrorMessage().getComponent(player))
); );
return; return;
} }
boolean result = boolean result =
player.getLocation().getPlotAbs().setFlag(localFlag.merge(parsed.getValue())); player.getLocation().getPlotAbs().setFlag(localFlag.merge(parsed.getValue()));
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("flag.flag_not_added")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_added"));
return; return;
} }
player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])), player.sendMessage(TranslatableCaption.miniMessage("flag.flag_added"), Placeholder.miniMessage("flag", String.valueOf(args[0])),
Template.of("value", String.valueOf(parsed)) Placeholder.miniMessage("value", String.valueOf(parsed))
); );
} }
@ -451,8 +452,8 @@ public final class FlagCommand extends Command {
} }
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot flag remove <flag> [values]") Placeholder.miniMessage("value", "/plot flag remove <flag> [values]")
); );
return; return;
} }
@ -464,8 +465,8 @@ public final class FlagCommand extends Command {
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flag, plot); PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Flag remove") Placeholder.miniMessage("value", "Flag remove")
); );
return; return;
} }
@ -474,8 +475,8 @@ public final class FlagCommand extends Command {
if (!force && !Permissions.hasPermission(player, Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase()))) { if (!force && !Permissions.hasPermission(player, Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase()))) {
if (args.length != 2) { if (args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase())) Placeholder.miniMessage("node", Permission.PERMISSION_SET_FLAG_KEY.format(args[0].toLowerCase()))
); );
return; return;
} }
@ -489,27 +490,27 @@ public final class FlagCommand extends Command {
parsedFlag = listFlag.parse(value); parsedFlag = listFlag.parse(value);
} catch (final FlagParseException e) { } catch (final FlagParseException e) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("flag.flag_parse_error"), TranslatableCaption.miniMessage("flag.flag_parse_error"),
Template.of("flag_name", flag.getName()), Placeholder.miniMessage("flag_name", flag.getName()),
Template.of("flag_value", e.getValue()), Placeholder.miniMessage("flag_value", e.getValue()),
Template.of("error", String.valueOf(e.getErrorMessage())) Placeholder.miniMessage("error", String.valueOf(e.getErrorMessage()))
); );
return; return;
} }
if (((List<?>) parsedFlag.getValue()).isEmpty()) { if (((List<?>) parsedFlag.getValue()).isEmpty()) {
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_removed"));
return; return;
} }
if (list.removeAll((List) parsedFlag.getValue())) { if (list.removeAll((List) parsedFlag.getValue())) {
if (list.isEmpty()) { if (list.isEmpty()) {
if (plot.removeFlag(flag)) { if (plot.removeFlag(flag)) {
player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of( player.sendMessage(TranslatableCaption.miniMessage("flag.flag_removed"), Placeholder.miniMessage("flag", args[0]), Placeholder.miniMessage(
"value", "value",
String.valueOf(flag) String.valueOf(flag)
)); ));
return; return;
} else { } else {
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_removed"));
return; return;
} }
} else { } else {
@ -517,31 +518,31 @@ public final class FlagCommand extends Command {
PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot);
if (addEvent.getEventResult() == Result.DENY) { if (addEvent.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Re-addition of " + plotFlag.getName()) Placeholder.miniMessage("value", "Re-addition of " + plotFlag.getName())
); );
return; return;
} }
if (plot.setFlag(addEvent.getFlag())) { if (plot.setFlag(addEvent.getFlag())) {
player.sendMessage(TranslatableCaption.of("flag.flag_partially_removed")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_partially_removed"));
return; return;
} else { } else {
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_removed"));
return; return;
} }
} }
} else { } else {
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_removed"));
return; return;
} }
} else { } else {
boolean result = plot.removeFlag(flag); boolean result = plot.removeFlag(flag);
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_not_removed"));
return; return;
} }
} }
player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of( player.sendMessage(TranslatableCaption.miniMessage("flag.flag_removed"), Placeholder.miniMessage("flag", args[0]), Placeholder.miniMessage(
"value", "value",
String.valueOf(flag) String.valueOf(flag)
)); ));
@ -576,20 +577,22 @@ public final class FlagCommand extends Command {
for (final Map.Entry<String, ArrayList<String>> entry : flags.entrySet()) { for (final Map.Entry<String, ArrayList<String>> entry : flags.entrySet()) {
Collections.sort(entry.getValue()); Collections.sort(entry.getValue());
Component category = Component category =
MINI_MESSAGE.parse( MINI_MESSAGE.deserialize(
TranslatableCaption.of("flag.flag_list_categories").getComponent(player), TranslatableCaption.miniMessage("flag.flag_list_categories").getComponent(player),
Template.of("category", entry.getKey()) PlaceholderResolver.placeholders(Placeholder.miniMessage("category", entry.getKey()))
); );
TextComponent.Builder builder = Component.text().append(category); TextComponent.Builder builder = Component.text().append(category);
final Iterator<String> flagIterator = entry.getValue().iterator(); final Iterator<String> flagIterator = entry.getValue().iterator();
while (flagIterator.hasNext()) { while (flagIterator.hasNext()) {
final String flag = flagIterator.next(); final String flag = flagIterator.next();
builder.append(MINI_MESSAGE builder.append(MINI_MESSAGE
.parse( .deserialize(
TranslatableCaption.of("flag.flag_list_flag").getComponent(player), TranslatableCaption.miniMessage("flag.flag_list_flag").getComponent(player),
Template.of("command", "/plot flag info " + flag), PlaceholderResolver.placeholders(
Template.of("flag", flag), Placeholder.miniMessage("command", "/plot flag info " + flag),
Template.of("suffix", flagIterator.hasNext() ? ", " : "") Placeholder.miniMessage("flag", flag),
Placeholder.miniMessage("suffix", flagIterator.hasNext() ? ", " : "")
)
)); ));
} }
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build()))); player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build())));
@ -612,41 +615,41 @@ public final class FlagCommand extends Command {
} }
if (args.length < 1) { if (args.length < 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot flag info <flag>") Placeholder.miniMessage("value", "/plot flag info <flag>")
); );
return; return;
} }
final PlotFlag<?, ?> plotFlag = getFlag(player, args[0]); final PlotFlag<?, ?> plotFlag = getFlag(player, args[0]);
if (plotFlag != null) { if (plotFlag != null) {
player.sendMessage(TranslatableCaption.of("flag.flag_info_header")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_info_header"));
// Flag name // Flag name
player.sendMessage(TranslatableCaption.of("flag.flag_info_name"), Template.of("flag", plotFlag.getName())); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_info_name"), Placeholder.miniMessage("flag", plotFlag.getName()));
// Flag category // Flag category
player.sendMessage( player.sendMessage(
TranslatableCaption.of("flag.flag_info_category"), TranslatableCaption.miniMessage("flag.flag_info_category"),
Templates.of(player, "value", plotFlag.getFlagCategory()) Placeholders.miniMessage(player, "value", plotFlag.getFlagCategory())
); );
// Flag description // Flag description
// TODO maybe merge and \n instead? // TODO maybe merge and \n instead?
player.sendMessage(TranslatableCaption.of("flag.flag_info_description")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_info_description"));
player.sendMessage(plotFlag.getFlagDescription()); player.sendMessage(plotFlag.getFlagDescription());
// Flag example // Flag example
player.sendMessage( player.sendMessage(
TranslatableCaption.of("flag.flag_info_example"), TranslatableCaption.miniMessage("flag.flag_info_example"),
Template.of("command", "/plot flag set"), Placeholder.miniMessage("command", "/plot flag set"),
Template.of("flag", plotFlag.getName()), Placeholder.miniMessage("flag", plotFlag.getName()),
Template.of("value", plotFlag.getExample()) Placeholder.miniMessage("value", plotFlag.getExample())
); );
// Default value // Default value
final String defaultValue = player.getLocation().getPlotArea().getFlagContainer() final String defaultValue = player.getLocation().getPlotArea().getFlagContainer()
.getFlagErased(plotFlag.getClass()).toString(); .getFlagErased(plotFlag.getClass()).toString();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("flag.flag_info_default_value"), TranslatableCaption.miniMessage("flag.flag_info_default_value"),
Template.of("value", defaultValue) Placeholder.miniMessage("value", defaultValue)
); );
// Footer. Done this way to prevent the duplicate-message-thingy from catching it // Footer. Done this way to prevent the duplicate-message-thingy from catching it
player.sendMessage(TranslatableCaption.of("flag.flag_info_footer")); player.sendMessage(TranslatableCaption.miniMessage("flag.flag_info_footer"));
} }
} }

View File

@ -40,7 +40,7 @@ import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -70,16 +70,16 @@ public class Grant extends Command {
) throws CommandException { ) throws CommandException {
checkTrue( checkTrue(
args.length >= 1 && args.length <= 2, args.length >= 1 && args.length <= 2,
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot grant <check | add> [player]") Placeholder.miniMessage("value", "/plot grant <check | add> [player]")
); );
final String arg0 = args[0].toLowerCase(); final String arg0 = args[0].toLowerCase();
switch (arg0) { switch (arg0) {
case "add", "check" -> { case "add", "check" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_GRANT.format(arg0))) { if (!Permissions.hasPermission(player, Permission.PERMISSION_GRANT.format(arg0))) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_GRANT.format(arg0)) Placeholder.miniMessage("node", Permission.PERMISSION_GRANT.format(arg0))
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
@ -88,11 +88,11 @@ public class Grant extends Command {
} }
PlayerManager.getUUIDsFromString(args[1], (uuids, throwable) -> { PlayerManager.getUUIDsFromString(args[1], (uuids, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (throwable != null || uuids.size() != 1) { } else if (throwable != null || uuids.size() != 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", String.valueOf(uuids)) Placeholder.miniMessage("value", String.valueOf(uuids))
); );
} else { } else {
final UUIDMapping uuid = uuids.toArray(new UUIDMapping[0])[0]; final UUIDMapping uuid = uuids.toArray(new UUIDMapping[0])[0];
@ -102,8 +102,8 @@ public class Grant extends Command {
PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) { PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) {
if (args[0].equalsIgnoreCase("check")) { if (args[0].equalsIgnoreCase("check")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("grants.granted_plots"), TranslatableCaption.miniMessage("grants.granted_plots"),
Template.of("amount", String.valueOf(access.get().orElse(0))) Placeholder.miniMessage("amount", String.valueOf(access.get().orElse(0)))
); );
} else { } else {
access.set(access.get().orElse(0) + 1); access.set(access.get().orElse(0) + 1);
@ -122,8 +122,8 @@ public class Grant extends Command {
granted = Ints.fromByteArray(array); granted = Ints.fromByteArray(array);
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("grants.granted_plots"), TranslatableCaption.miniMessage("grants.granted_plots"),
Template.of("amount", String.valueOf(granted)) Placeholder.miniMessage("amount", String.valueOf(granted))
); );
} else { // add } else { // add
int amount; int amount;
@ -137,8 +137,8 @@ public class Grant extends Command {
byte[] rawData = Ints.toByteArray(amount); byte[] rawData = Ints.toByteArray(amount);
DBFunc.addPersistentMeta(uuid.getUuid(), key, rawData, replace); DBFunc.addPersistentMeta(uuid.getUuid(), key, rawData, replace);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("grants.added"), TranslatableCaption.miniMessage("grants.added"),
Template.of("grants", String.valueOf(amount)) Placeholder.miniMessage("grants", String.valueOf(amount))
); );
} }
} }

View File

@ -35,7 +35,8 @@ import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import java.util.Collection; import java.util.Collection;
import java.util.Locale; import java.util.Locale;
@ -117,25 +118,29 @@ public class Help extends Command {
} }
if (cat == null && page == 0) { if (cat == null && page == 0) {
TextComponent.Builder builder = Component.text(); TextComponent.Builder builder = Component.text();
builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_header").getComponent(player))); builder.append(MINI_MESSAGE.parse(TranslatableCaption.miniMessage("help.help_header").getComponent(player)));
for (CommandCategory c : CommandCategory.values()) { for (CommandCategory c : CommandCategory.values()) {
builder.append(Component.newline()).append(MINI_MESSAGE builder.append(Component.newline()).append(MINI_MESSAGE
.parse( .deserialize(
TranslatableCaption.of("help.help_info_item").getComponent(player), TranslatableCaption.miniMessage("help.help_info_item").getComponent(player),
Template.of("command", "/plot help"), PlaceholderResolver.placeholders(
Template.of("category", c.name().toLowerCase()), Placeholder.miniMessage("command", "/plot help"),
Template.of("category_desc", c.getComponent(player)) Placeholder.miniMessage("category", c.name().toLowerCase()),
Placeholder.miniMessage("category_desc", c.getComponent(player))
)
)); ));
} }
builder.append(Component.newline()).append(MINI_MESSAGE builder.append(Component.newline()).append(MINI_MESSAGE
.parse( .deserialize(
TranslatableCaption.of("help.help_info_item").getComponent(player), TranslatableCaption.miniMessage("help.help_info_item").getComponent(player),
Template.of("command", "/plot help"), PlaceholderResolver.placeholders(
Template.of("category", "all"), Placeholder.miniMessage("command", "/plot help"),
Template.of("category_desc", "Display all commands") Placeholder.miniMessage("category", "all"),
Placeholder.miniMessage("category_desc", "Display all commands")
)
)); ));
builder.append(Component.newline()).append(MINI_MESSAGE.parse(TranslatableCaption builder.append(Component.newline()).append(MINI_MESSAGE.parse(TranslatableCaption
.of("help.help_footer") .miniMessage("help.help_footer")
.getComponent(player))); .getComponent(player)));
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.asComponent()))); player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.asComponent())));
return true; return true;

View File

@ -42,7 +42,7 @@ import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.query.SortingStrategy; import com.plotsquared.core.util.query.SortingStrategy;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
@ -74,13 +74,13 @@ public class HomeCommand extends Command {
) { ) {
List<Plot> plots = query.asList(); List<Plot> plots = query.asList();
if (plots.isEmpty()) { if (plots.isEmpty()) {
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots")); player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
return; return;
} else if (plots.size() < page || page < 1) { } else if (plots.size() < page || page < 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.number_not_in_range"), TranslatableCaption.miniMessage("invalid.number_not_in_range"),
Template.of("min", "1"), Placeholder.miniMessage("min", "1"),
Template.of("max", String.valueOf(plots.size())) Placeholder.miniMessage("max", String.valueOf(plots.size()))
); );
return; return;
} }
@ -114,8 +114,8 @@ public class HomeCommand extends Command {
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OWNED) && !Permissions if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OWNED) && !Permissions
.hasPermission(player, Permission.PERMISSION_HOME)) { .hasPermission(player, Permission.PERMISSION_HOME)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_VISIT_OWNED.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_VISIT_OWNED.toString())
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
@ -136,8 +136,8 @@ public class HomeCommand extends Command {
page = Integer.parseInt(identifier); page = Integer.parseInt(identifier);
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_a_number"), TranslatableCaption.miniMessage("invalid.not_a_number"),
Template.of("value", identifier) Placeholder.miniMessage("value", identifier)
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
@ -177,8 +177,8 @@ public class HomeCommand extends Command {
page = Integer.parseInt(identifier); page = Integer.parseInt(identifier);
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_a_number"), TranslatableCaption.miniMessage("invalid.not_a_number"),
Template.of("value", identifier) Placeholder.miniMessage("value", identifier)
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }

View File

@ -26,8 +26,8 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.plotsquared.core.configuration.caption.Placeholders;
import com.plotsquared.core.configuration.caption.StaticCaption; import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.permissions.Permission; import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.player.MetaDataAccess; import com.plotsquared.core.player.MetaDataAccess;
@ -43,7 +43,8 @@ import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -60,7 +61,7 @@ public class Inbox extends SubCommand {
public void displayComments(PlotPlayer<?> player, List<PlotComment> oldComments, int page) { public void displayComments(PlotPlayer<?> player, List<PlotComment> oldComments, int page) {
if (oldComments == null || oldComments.isEmpty()) { if (oldComments == null || oldComments.isEmpty()) {
player.sendMessage(TranslatableCaption.of("comment.inbox_empty")); player.sendMessage(TranslatableCaption.miniMessage("comment.inbox_empty"));
return; return;
} }
PlotComment[] comments = oldComments.toArray(new PlotComment[0]); PlotComment[] comments = oldComments.toArray(new PlotComment[0]);
@ -79,9 +80,11 @@ public class Inbox extends SubCommand {
max = comments.length; max = comments.length;
} }
TextComponent.Builder builder = Component.text(); TextComponent.Builder builder = Component.text();
builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("list.comment_list_header_paged").getComponent(player) + '\n', builder.append(MINI_MESSAGE.deserialize(TranslatableCaption.miniMessage("list.comment_list_header_paged").getComponent(player) + '\n',
Template.of("amount", String.valueOf(comments.length)), Template.of("cur", String.valueOf(page + 1)), PlaceholderResolver.placeholders(
Template.of("max", String.valueOf(totalPages + 1)), Template.of("word", "all") Placeholder.miniMessage("amount", String.valueOf(comments.length)), Placeholder.miniMessage("cur", String.valueOf(page + 1)),
Placeholder.miniMessage("max", String.valueOf(totalPages + 1)), Placeholder.miniMessage("word", "all")
)
)); ));
// This might work xD // This might work xD
@ -90,31 +93,34 @@ public class Inbox extends SubCommand {
Component commentColored; Component commentColored;
if (player.getName().equals(comment.senderName)) { if (player.getName().equals(comment.senderName)) {
commentColored = MINI_MESSAGE commentColored = MINI_MESSAGE
.parse( .deserialize(
TranslatableCaption.of("list.comment_list_by_lister").getComponent(player), TranslatableCaption.miniMessage("list.comment_list_by_lister").getComponent(player),
Template.of("comment", comment.comment) PlaceholderResolver.placeholders(
); Placeholder.miniMessage("comment", comment.comment)
));
} else { } else {
commentColored = MINI_MESSAGE commentColored = MINI_MESSAGE
.parse( .deserialize(
TranslatableCaption.of("list.comment_list_by_other").getComponent(player), TranslatableCaption.miniMessage("list.comment_list_by_other").getComponent(player),
Template.of("comment", comment.comment) PlaceholderResolver.placeholders(
); Placeholder.miniMessage("comment", comment.comment)
));
} }
Template number = Template.of("number", String.valueOf(x)); Placeholder<?> number = Placeholder.miniMessage("number", String.valueOf(x));
Template world = Template.of("world", comment.world); Placeholder<?> world = Placeholder.miniMessage("world", comment.world);
Template plot_id = Template.of("plot_id", comment.id.getX() + ";" + comment.id.getY()); Placeholder<?> plot_id = Placeholder.miniMessage("plot_id", comment.id.getX() + ";" + comment.id.getY());
Template commenter = Template.of("commenter", comment.senderName); Placeholder<?> commenter = Placeholder.miniMessage("commenter", comment.senderName);
Template commentTemplate = Template.of("comment", commentColored); Placeholder<?> commentTemplate = Placeholder.miniMessage("comment", commentColored.toString());
builder.append(MINI_MESSAGE builder.append(MINI_MESSAGE
.parse( .deserialize(
TranslatableCaption.of("list.comment_list_comment").getComponent(player), TranslatableCaption.miniMessage("list.comment_list_comment").getComponent(player),
PlaceholderResolver.placeholders(
number, number,
world, world,
plot_id, plot_id,
commenter, commenter,
commentTemplate commentTemplate
)); )));
} }
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build()))); player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.build())));
} }
@ -123,11 +129,11 @@ public class Inbox extends SubCommand {
public boolean onCommand(final PlotPlayer<?> player, String[] args) { public boolean onCommand(final PlotPlayer<?> player, String[] args) {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if (args.length == 0) { if (args.length == 0) {
@ -149,21 +155,21 @@ public class Inbox extends SubCommand {
} }
if (total != 0) { if (total != 0) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.inbox_item"), TranslatableCaption.miniMessage("comment.inbox_item"),
Template.of("value", inbox + " (" + total + '/' + unread + ')') Placeholder.miniMessage("value", inbox + " (" + total + '/' + unread + ')')
); );
return; return;
} }
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.inbox_item"), TranslatableCaption.miniMessage("comment.inbox_item"),
Template.of("value", inbox.toString()) Placeholder.miniMessage("value", inbox.toString())
); );
} }
})) { })) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.inbox_item"), TranslatableCaption.miniMessage("comment.inbox_item"),
Template.of("value", inbox.toString()) Placeholder.miniMessage("value", inbox.toString())
); );
} }
} }
@ -173,8 +179,8 @@ public class Inbox extends SubCommand {
final CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase()); final CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
if (inbox == null) { if (inbox == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.invalid_inbox"), TranslatableCaption.miniMessage("comment.invalid_inbox"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), ", ")) Placeholder.miniMessage("list", StringMan.join(CommentManager.inboxes.keySet(), ", "))
); );
return false; return false;
} }
@ -191,13 +197,13 @@ public class Inbox extends SubCommand {
switch (args[1].toLowerCase()) { switch (args[1].toLowerCase()) {
case "delete": case "delete":
if (!inbox.canModify(plot, player)) { if (!inbox.canModify(plot, player)) {
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify")); player.sendMessage(TranslatableCaption.miniMessage("comment.no_perm_inbox_modify"));
return false; return false;
} }
if (args.length != 3) { if (args.length != 3) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot inbox " + inbox + " delete <index>") Placeholder.miniMessage("value", "/plot inbox " + inbox + " delete <index>")
); );
return true; return true;
} }
@ -206,15 +212,15 @@ public class Inbox extends SubCommand {
index = Integer.parseInt(args[2]); index = Integer.parseInt(args[2]);
if (index < 1) { if (index < 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.not_valid_inbox_index"), TranslatableCaption.miniMessage("comment.not_valid_inbox_index"),
Templates.of("number", index) Placeholders.miniMessage("number", index)
); );
return false; return false;
} }
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot inbox " + inbox + " delete <index>") Placeholder.miniMessage("value", "/plot inbox " + inbox + " delete <index>")
); );
return false; return false;
} }
@ -224,8 +230,8 @@ public class Inbox extends SubCommand {
public void run(List<PlotComment> value) { public void run(List<PlotComment> value) {
if (index > value.size()) { if (index > value.size()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.not_valid_inbox_index"), TranslatableCaption.miniMessage("comment.not_valid_inbox_index"),
Templates.of("number", index) Placeholders.miniMessage("number", index)
); );
return; return;
} }
@ -234,29 +240,29 @@ public class Inbox extends SubCommand {
boolean success = plot.getPlotCommentContainer().removeComment(comment); boolean success = plot.getPlotCommentContainer().removeComment(comment);
if (success) { if (success) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.comment_removed_success"), TranslatableCaption.miniMessage("comment.comment_removed_success"),
Template.of("value", comment.comment) Placeholder.miniMessage("value", comment.comment)
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.comment_removed_failure")); TranslatableCaption.miniMessage("comment.comment_removed_failure"));
} }
} }
})) { })) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
return true; return true;
case "clear": case "clear":
if (!inbox.canModify(plot, player)) { if (!inbox.canModify(plot, player)) {
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify")); player.sendMessage(TranslatableCaption.miniMessage("comment.no_perm_inbox_modify"));
} }
inbox.clearInbox(plot); inbox.clearInbox(plot);
List<PlotComment> comments = plot.getPlotCommentContainer().getComments(inbox.toString()); List<PlotComment> comments = plot.getPlotCommentContainer().getComments(inbox.toString());
if (!comments.isEmpty()) { if (!comments.isEmpty()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("comment.comment_removed_success"), TranslatableCaption.miniMessage("comment.comment_removed_success"),
Template.of("value", String.valueOf(comments)) Placeholder.miniMessage("value", String.valueOf(comments))
); );
plot.getPlotCommentContainer().removeComments(comments); plot.getPlotCommentContainer().removeComments(comments);
} }
@ -273,7 +279,7 @@ public class Inbox extends SubCommand {
page = 1; page = 1;
} }
if (!inbox.canRead(plot, player)) { if (!inbox.canRead(plot, player)) {
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox")); player.sendMessage(TranslatableCaption.miniMessage("comment.no_perm_inbox"));
return false; return false;
} }
if (!inbox.getComments(plot, new RunnableVal<>() { if (!inbox.getComments(plot, new RunnableVal<>() {
@ -282,7 +288,7 @@ public class Inbox extends SubCommand {
displayComments(player, value, page); displayComments(player, value, page);
} }
})) { })) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
return true; return true;

View File

@ -36,7 +36,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.implementations.HideInfoFlag; import com.plotsquared.core.plot.flag.implementations.HideInfoFlag;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -76,7 +76,7 @@ public class Info extends SubCommand {
plot = player.getCurrentPlot(); plot = player.getCurrentPlot();
} }
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
@ -96,8 +96,8 @@ public class Info extends SubCommand {
if (!player if (!player
.hasPermission(Permission.PERMISSION_AREA_INFO_FORCE.toString())) { .hasPermission(Permission.PERMISSION_AREA_INFO_FORCE.toString())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_AREA_INFO_FORCE.toString()) Placeholder.miniMessage("node", Permission.PERMISSION_AREA_INFO_FORCE.toString())
); );
return true; return true;
} }
@ -106,7 +106,7 @@ public class Info extends SubCommand {
} }
} }
if (!allowed) { if (!allowed) {
player.sendMessage(TranslatableCaption.of("info.plot_info_hidden")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_info_hidden"));
return true; return true;
} }
} }
@ -118,12 +118,12 @@ public class Info extends SubCommand {
// Unclaimed? // Unclaimed?
if (!hasOwner && !containsEveryone && !trustedEveryone) { if (!hasOwner && !containsEveryone && !trustedEveryone) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("info.plot_info_unclaimed"), TranslatableCaption.miniMessage("info.plot_info_unclaimed"),
Template.of("plot", plot.getId().getX() + ";" + plot.getId().getY()) Placeholder.miniMessage("plot", plot.getId().getX() + ";" + plot.getId().getY())
); );
return true; return true;
} }
Caption info = TranslatableCaption.of("info.plot_info_format"); Caption info = TranslatableCaption.miniMessage("info.plot_info_format");
boolean full; boolean full;
if (arg != null) { if (arg != null) {
info = getCaption(arg); info = getCaption(arg);
@ -169,19 +169,19 @@ public class Info extends SubCommand {
private Caption getCaption(String string) { private Caption getCaption(String string) {
return switch (string) { return switch (string) {
case "trusted" -> TranslatableCaption.of("info.plot_info_trusted"); case "trusted" -> TranslatableCaption.miniMessage("info.plot_info_trusted");
case "alias" -> TranslatableCaption.of("info.plot_info_alias"); case "alias" -> TranslatableCaption.miniMessage("info.plot_info_alias");
case "biome" -> TranslatableCaption.of("info.plot_info_biome"); case "biome" -> TranslatableCaption.miniMessage("info.plot_info_biome");
case "denied" -> TranslatableCaption.of("info.plot_info_denied"); case "denied" -> TranslatableCaption.miniMessage("info.plot_info_denied");
case "flags" -> TranslatableCaption.of("info.plot_info_flags"); case "flags" -> TranslatableCaption.miniMessage("info.plot_info_flags");
case "id" -> TranslatableCaption.of("info.plot_info_id"); case "id" -> TranslatableCaption.miniMessage("info.plot_info_id");
case "size" -> TranslatableCaption.of("info.plot_info_size"); case "size" -> TranslatableCaption.miniMessage("info.plot_info_size");
case "members" -> TranslatableCaption.of("info.plot_info_members"); case "members" -> TranslatableCaption.miniMessage("info.plot_info_members");
case "owner" -> TranslatableCaption.of("info.plot_info_owner"); case "owner" -> TranslatableCaption.miniMessage("info.plot_info_owner");
case "rating" -> TranslatableCaption.of("info.plot_info_rating"); case "rating" -> TranslatableCaption.miniMessage("info.plot_info_rating");
case "likes" -> TranslatableCaption.of("info.plot_info_likes"); case "likes" -> TranslatableCaption.miniMessage("info.plot_info_likes");
case "seen" -> TranslatableCaption.of("info.plot_info_seen"); case "seen" -> TranslatableCaption.miniMessage("info.plot_info_seen");
case "creationdate" -> TranslatableCaption.of("info.plot_info_creationdate"); case "creationdate" -> TranslatableCaption.miniMessage("info.plot_info_creationdate");
default -> null; default -> null;
}; };
} }

View File

@ -38,7 +38,7 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PlayerManager; import com.plotsquared.core.util.PlayerManager;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection; import java.util.Collection;
@ -74,22 +74,22 @@ public class Kick extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot = location.getPlot(); Plot plot = location.getPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_KICK)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_KICK)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (throwable != null || uuids.isEmpty()) { } else if (throwable != null || uuids.isEmpty()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
} else { } else {
Set<PlotPlayer<?>> players = new HashSet<>(); Set<PlotPlayer<?>> players = new HashSet<>();
@ -112,28 +112,28 @@ public class Kick extends SubCommand {
players.remove(player); // Don't ever kick the calling player players.remove(player); // Don't ever kick the calling player
if (players.isEmpty()) { if (players.isEmpty()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
return; return;
} }
for (PlotPlayer<?> player2 : players) { for (PlotPlayer<?> player2 : players) {
if (!plot.equals(player2.getCurrentPlot())) { if (!plot.equals(player2.getCurrentPlot())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
return; return;
} }
if (Permissions.hasPermission(player2, Permission.PERMISSION_ADMIN_ENTRY_DENIED)) { if (Permissions.hasPermission(player2, Permission.PERMISSION_ADMIN_ENTRY_DENIED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cannot_kick_player"), TranslatableCaption.miniMessage("cluster.cannot_kick_player"),
Template.of("name", player2.getName()) Placeholder.miniMessage("name", player2.getName())
); );
return; return;
} }
Location spawn = this.worldUtil.getSpawn(location.getWorldName()); Location spawn = this.worldUtil.getSpawn(location.getWorldName());
player2.sendMessage(TranslatableCaption.of("kick.you_got_kicked")); player2.sendMessage(TranslatableCaption.miniMessage("kick.you_got_kicked"));
if (plot.equals(spawn.getPlot())) { if (plot.equals(spawn.getPlot())) {
Location newSpawn = this.worldUtil.getSpawn(this.plotAreaManager.getAllWorlds()[0]); Location newSpawn = this.worldUtil.getSpawn(this.plotAreaManager.getAllWorlds()[0]);
if (plot.equals(newSpawn.getPlot())) { if (plot.equals(newSpawn.getPlot())) {

View File

@ -32,7 +32,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID; import java.util.UUID;
@ -59,10 +59,10 @@ public class Leave extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone RunnableVal2<Command, CommandResult> whenDone
) throws CommandException { ) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot")); final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
checkTrue(plot.hasOwner(), TranslatableCaption.of("info.plot_unowned")); checkTrue(plot.hasOwner(), TranslatableCaption.miniMessage("info.plot_unowned"));
if (plot.isOwner(player.getUUID())) { if (plot.isOwner(player.getUUID())) {
player.sendMessage(TranslatableCaption.of("member.plot_cant_leave_owner")); player.sendMessage(TranslatableCaption.miniMessage("member.plot_cant_leave_owner"));
} else { } else {
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
if (plot.isAdded(uuid)) { if (plot.isAdded(uuid)) {
@ -73,12 +73,12 @@ public class Leave extends Command {
this.eventDispatcher.callMember(player, plot, uuid, false); this.eventDispatcher.callMember(player, plot, uuid, false);
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("member.plot_left"), TranslatableCaption.miniMessage("member.plot_left"),
Template.of("player", player.getName()) Placeholder.miniMessage("player", player.getName())
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("members.not_added_trusted") TranslatableCaption.miniMessage("members.not_added_trusted")
); );
} }
} }

View File

@ -41,7 +41,7 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection; import java.util.Collection;
@ -115,17 +115,17 @@ public class Like extends SubCommand {
.isBasePlot() && (!plot.getLikes().containsKey(uuid))) { .isBasePlot() && (!plot.getLikes().containsKey(uuid))) {
plot.teleportPlayer(player, TeleportCause.COMMAND_LIKE, result -> { plot.teleportPlayer(player, TeleportCause.COMMAND_LIKE, result -> {
}); });
player.sendMessage(TranslatableCaption.of("tutorial.rate_this")); player.sendMessage(TranslatableCaption.miniMessage("tutorial.rate_this"));
return true; return true;
} }
} }
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots")); player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
return true; return true;
} }
case "purge" -> { case "purge" -> {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!Permissions if (!Permissions
@ -133,34 +133,34 @@ public class Like extends SubCommand {
return false; return false;
} }
plot.clearRatings(); plot.clearRatings();
player.sendMessage(TranslatableCaption.of("ratings.ratings_purged")); player.sendMessage(TranslatableCaption.miniMessage("ratings.ratings_purged"));
return true; return true;
} }
} }
} }
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("ratings.rating_not_owned")); player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_owned"));
return false; return false;
} }
if (plot.isOwner(player.getUUID())) { if (plot.isOwner(player.getUUID())) {
player.sendMessage(TranslatableCaption.of("ratings.rating_not_your_own")); player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_your_own"));
return false; return false;
} }
if (Settings.Done.REQUIRED_FOR_RATINGS && !DoneFlag.isDone(plot)) { if (Settings.Done.REQUIRED_FOR_RATINGS && !DoneFlag.isDone(plot)) {
player.sendMessage(TranslatableCaption.of("ratings.rating_not_done")); player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_done"));
return false; return false;
} }
final Runnable run = () -> { final Runnable run = () -> {
final Boolean oldRating = plot.getLikes().get(uuid); final Boolean oldRating = plot.getLikes().get(uuid);
if (oldRating != null) { if (oldRating != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("ratings.rating_already_exists"), TranslatableCaption.miniMessage("ratings.rating_already_exists"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
return; return;
} }
@ -177,13 +177,13 @@ public class Like extends SubCommand {
plot.addRating(uuid, event.getRating()); plot.addRating(uuid, event.getRating());
if (like) { if (like) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("ratings.rating_liked"), TranslatableCaption.miniMessage("ratings.rating_liked"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("ratings.rating_disliked"), TranslatableCaption.miniMessage("ratings.rating_disliked"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
} }
} }

View File

@ -30,7 +30,7 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.Caption; import com.plotsquared.core.configuration.caption.Caption;
import com.plotsquared.core.configuration.caption.CaptionHolder; import com.plotsquared.core.configuration.caption.CaptionHolder;
import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.Placeholders;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.permissions.Permission; import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
@ -53,7 +53,8 @@ import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
@ -129,8 +130,8 @@ public class ListCmd extends SubCommand {
public void noArgs(PlotPlayer<?> player) { public void noArgs(PlotPlayer<?> player) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.subcommand_set_options_header"), TranslatableCaption.miniMessage("commandconfig.subcommand_set_options_header"),
Templates.of("values", Arrays.toString(getArgumentList(player))) Placeholders.miniMessage("values", Arrays.toString(getArgumentList(player)))
); );
} }
@ -165,8 +166,8 @@ public class ListCmd extends SubCommand {
final Consumer<PlotQuery> plotConsumer = query -> { final Consumer<PlotQuery> plotConsumer = query -> {
if (query == null) { if (query == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.did_you_mean"), TranslatableCaption.miniMessage("commandconfig.did_you_mean"),
Template.of( Placeholder.miniMessage(
"value", "value",
new StringComparison<>(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch() new StringComparison<>(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch()
) )
@ -185,7 +186,7 @@ public class ListCmd extends SubCommand {
final List<Plot> plots = query.asList(); final List<Plot> plots = query.asList();
if (plots.isEmpty()) { if (plots.isEmpty()) {
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots")); player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
return; return;
} }
displayPlots(player, plots, 12, page, args); displayPlots(player, plots, 12, page, args);
@ -195,8 +196,8 @@ public class ListCmd extends SubCommand {
case "mine" -> { case "mine" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_MINE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_MINE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.mine") Placeholders.miniMessage("node", "plots.list.mine")
); );
return false; return false;
} }
@ -210,8 +211,8 @@ public class ListCmd extends SubCommand {
case "shared" -> { case "shared" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_SHARED)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_SHARED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.shared") Placeholders.miniMessage("node", "plots.list.shared")
); );
return false; return false;
} }
@ -223,15 +224,15 @@ public class ListCmd extends SubCommand {
case "world" -> { case "world" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.world") Placeholders.miniMessage("node", "plots.list.world")
); );
return false; return false;
} }
if (!Permissions.hasPermission(player, "plots.list.world." + world)) { if (!Permissions.hasPermission(player, "plots.list.world." + world)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.world." + world) Placeholders.miniMessage("node", "plots.list.world." + world)
); );
return false; return false;
} }
@ -240,8 +241,8 @@ public class ListCmd extends SubCommand {
case "expired" -> { case "expired" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_EXPIRED)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_EXPIRED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.expired") Placeholders.miniMessage("node", "plots.list.expired")
); );
return false; return false;
} }
@ -254,15 +255,15 @@ public class ListCmd extends SubCommand {
case "area" -> { case "area" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_AREA)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_AREA)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.area") Placeholders.miniMessage("node", "plots.list.area")
); );
return false; return false;
} }
if (!Permissions.hasPermission(player, "plots.list.world." + world)) { if (!Permissions.hasPermission(player, "plots.list.world." + world)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.world." + world) Placeholders.miniMessage("node", "plots.list.world." + world)
); );
return false; return false;
} }
@ -275,8 +276,8 @@ public class ListCmd extends SubCommand {
case "all" -> { case "all" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_ALL)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_ALL)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.all") Placeholders.miniMessage("node", "plots.list.all")
); );
return false; return false;
} }
@ -285,8 +286,8 @@ public class ListCmd extends SubCommand {
case "done" -> { case "done" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_DONE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_DONE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.done") Placeholders.miniMessage("node", "plots.list.done")
); );
return false; return false;
} }
@ -300,8 +301,8 @@ public class ListCmd extends SubCommand {
case "top" -> { case "top" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_TOP)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_TOP)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.top") Placeholders.miniMessage("node", "plots.list.top")
); );
return false; return false;
} }
@ -311,8 +312,8 @@ public class ListCmd extends SubCommand {
case "forsale" -> { case "forsale" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_FOR_SALE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_FOR_SALE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.forsale") Placeholders.miniMessage("node", "plots.list.forsale")
); );
return false; return false;
} }
@ -324,8 +325,8 @@ public class ListCmd extends SubCommand {
case "unowned" -> { case "unowned" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_UNOWNED)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_UNOWNED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.unowned") Placeholders.miniMessage("node", "plots.list.unowned")
); );
return false; return false;
} }
@ -334,15 +335,15 @@ public class ListCmd extends SubCommand {
case "fuzzy" -> { case "fuzzy" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_FUZZY)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_FUZZY)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.fuzzy") Placeholders.miniMessage("node", "plots.list.fuzzy")
); );
return false; return false;
} }
if (args.length < (page == -1 ? 2 : 3)) { if (args.length < (page == -1 ? 2 : 3)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Templates.of("value", "/plot list fuzzy <search...> [#]") Placeholders.miniMessage("value", "/plot list fuzzy <search...> [#]")
); );
return false; return false;
} }
@ -359,15 +360,15 @@ public class ListCmd extends SubCommand {
if (this.plotAreaManager.hasPlotArea(args[0])) { if (this.plotAreaManager.hasPlotArea(args[0])) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_WORLD)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.world") Placeholders.miniMessage("node", "plots.list.world")
); );
return false; return false;
} }
if (!Permissions.hasPermission(player, "plots.list.world." + args[0])) { if (!Permissions.hasPermission(player, "plots.list.world." + args[0])) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.world." + args[0]) Placeholders.miniMessage("node", "plots.list.world." + args[0])
); );
return false; return false;
} }
@ -376,7 +377,7 @@ public class ListCmd extends SubCommand {
} }
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(args[0], (uuid, throwable) -> { PlotSquared.get().getImpromptuUUIDPipeline().getSingle(args[0], (uuid, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (throwable != null) { } else if (throwable != null) {
if (uuid == null) { if (uuid == null) {
try { try {
@ -386,12 +387,12 @@ public class ListCmd extends SubCommand {
} }
} }
if (uuid == null) { if (uuid == null) {
player.sendMessage(TranslatableCaption.of("errors.invalid_player"), Templates.of("value", args[0])); player.sendMessage(TranslatableCaption.miniMessage("errors.invalid_player"), Placeholders.miniMessage("value", args[0]));
} else { } else {
if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_PLAYER)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_LIST_PLAYER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.list.player") Placeholders.miniMessage("node", "plots.list.player")
); );
} else { } else {
sort[0] = false; sort[0] = false;
@ -416,28 +417,30 @@ public class ListCmd extends SubCommand {
public void run(Integer i, Plot plot, CaptionHolder caption) { public void run(Integer i, Plot plot, CaptionHolder caption) {
Caption color; Caption color;
if (plot.getOwner() == null) { if (plot.getOwner() == null) {
color = TranslatableCaption.of("info.plot_list_no_owner"); color = TranslatableCaption.miniMessage("info.plot_list_no_owner");
} else if (plot.isOwner(player.getUUID())) { } else if (plot.isOwner(player.getUUID())) {
color = TranslatableCaption.of("info.plot_list_owned_by"); color = TranslatableCaption.miniMessage("info.plot_list_owned_by");
} else if (plot.isAdded(player.getUUID())) { } else if (plot.isAdded(player.getUUID())) {
color = TranslatableCaption.of("info.plot_list_added_to"); color = TranslatableCaption.miniMessage("info.plot_list_added_to");
} else if (plot.isDenied(player.getUUID())) { } else if (plot.isDenied(player.getUUID())) {
color = TranslatableCaption.of("info.plot_list_denied_on"); color = TranslatableCaption.miniMessage("info.plot_list_denied_on");
} else { } else {
color = TranslatableCaption.of("info.plot_list_default"); color = TranslatableCaption.miniMessage("info.plot_list_default");
} }
Component trusted = MINI_MESSAGE.parse( Component trusted = MINI_MESSAGE.deserialize(
TranslatableCaption.of("info.plot_info_trusted").getComponent(player), TranslatableCaption.miniMessage("info.plot_info_trusted").getComponent(player),
Template.of("trusted", PlayerManager.getPlayerList(plot.getTrusted(), player)) PlaceholderResolver.placeholders(Placeholder.miniMessage("trusted",
PlayerManager.getPlayerList(plot.getTrusted(), player).toString()))
); );
Component members = MINI_MESSAGE.parse( Component members = MINI_MESSAGE.deserialize(
TranslatableCaption.of("info.plot_info_members").getComponent(player), TranslatableCaption.miniMessage("info.plot_info_members").getComponent(player),
Template.of("members", PlayerManager.getPlayerList(plot.getMembers(), player)) PlaceholderResolver.placeholders(Placeholder.miniMessage("trusted",
PlayerManager.getPlayerList(plot.getTrusted(), player).toString()))
); );
Template command_tp = Template.of("command_tp", "/plot visit " + plot.getArea() + ";" + plot.getId()); Placeholder<?> command_tp = Placeholder.miniMessage("command_tp", "/plot visit " + plot.getArea() + ";" + plot.getId());
Template command_info = Template.of("command_info", "/plot info " + plot.getArea() + ";" + plot.getId()); Placeholder<?> command_info = Placeholder.miniMessage("command_info", "/plot info " + plot.getArea() + ";" + plot.getId());
Template hover_info = Placeholder<?> hover_info =
Template.of( Placeholder.miniMessage(
"hover_info", "hover_info",
MINI_MESSAGE.serialize(Component MINI_MESSAGE.serialize(Component
.text() .text()
@ -446,27 +449,28 @@ public class ListCmd extends SubCommand {
.append(members) .append(members)
.asComponent()) .asComponent())
); );
Template numberTemplate = Template.of("number", String.valueOf(i)); Placeholder<?> numberTemplate = Placeholder.miniMessage("number", String.valueOf(i));
Template plotTemplate = Template.of( Placeholder<?> plotTemplate = Placeholder.miniMessage(
"plot", "plot",
MINI_MESSAGE.parse(color.getComponent(player), Template.of("plot", plot.toString())) MINI_MESSAGE.deserialize(color.getComponent(player),
PlaceholderResolver.placeholders(Placeholder.miniMessage("plot", plot.toString()))).toString()
); );
String prefix = ""; String prefix = "";
String online = TranslatableCaption.of("info.plot_list_player_online").getComponent(player); String online = TranslatableCaption.miniMessage("info.plot_list_player_online").getComponent(player);
String offline = TranslatableCaption.of("info.plot_list_player_offline").getComponent(player); String offline = TranslatableCaption.miniMessage("info.plot_list_player_offline").getComponent(player);
TextComponent.Builder builder = Component.text(); TextComponent.Builder builder = Component.text();
try { try {
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners()) final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS); .get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
for (final UUIDMapping uuidMapping : names) { for (final UUIDMapping uuidMapping : names) {
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.getUuid()); PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.getUuid());
Template prefixTemplate = Template.of("prefix", prefix); Placeholder<?> prefixTemplate = Placeholder.miniMessage("prefix", prefix);
Template playerTemplate = Template.of("player", uuidMapping.getUsername()); Placeholder<?> playerTemplate = Placeholder.miniMessage("player", uuidMapping.getUsername());
if (pp != null) { if (pp != null) {
builder.append(MINI_MESSAGE.parse(online, prefixTemplate, playerTemplate)); builder.append(MINI_MESSAGE.deserialize(online, PlaceholderResolver.placeholders(prefixTemplate, playerTemplate)));
} else { } else {
builder.append(MINI_MESSAGE.parse(offline, prefixTemplate, playerTemplate)); builder.append(MINI_MESSAGE.deserialize(offline, PlaceholderResolver.placeholders(prefixTemplate, playerTemplate)));
} }
prefix = ", "; prefix = ", ";
} }
@ -481,17 +485,17 @@ public class ListCmd extends SubCommand {
} }
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Templates.of("value", playerBuilder.toString()) Placeholders.miniMessage("value", playerBuilder.toString())
); );
} catch (TimeoutException e) { } catch (TimeoutException e) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} }
Template players = Template.of("players", builder.asComponent()); Placeholder<?> players = Placeholder.miniMessage("players", builder.asComponent().toString());
caption.set(TranslatableCaption.of("info.plot_list_item")); caption.set(TranslatableCaption.miniMessage("info.plot_list_item"));
caption.setTemplates(command_tp, command_info, hover_info, numberTemplate, plotTemplate, players); caption.setPlaceholders(command_tp, command_info, hover_info, numberTemplate, plotTemplate, players);
} }
}, "/plot list " + args[0], TranslatableCaption.of("list.plot_list_header_paged")); }, "/plot list " + args[0], TranslatableCaption.miniMessage("list.plot_list_header_paged"));
} }
@Override @Override

View File

@ -42,7 +42,7 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.net.MalformedURLException; import java.net.MalformedURLException;
@ -74,25 +74,25 @@ public class Load extends SubCommand {
public boolean onCommand(final PlotPlayer<?> player, final String[] args) { public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
final String world = player.getLocation().getWorldName(); final String world = player.getLocation().getWorldName();
if (!this.plotAreaManager.hasPlotArea(world)) { if (!this.plotAreaManager.hasPlotArea(world)) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_LOAD)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_LOAD)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
return false; return false;
} }
@ -104,8 +104,8 @@ public class Load extends SubCommand {
if (schematics == null) { if (schematics == null) {
// No schematics found: // No schematics found:
player.sendMessage( player.sendMessage(
TranslatableCaption.of("web.load_null"), TranslatableCaption.miniMessage("web.load_null"),
Template.of("command", "/plot load") Placeholder.miniMessage("command", "/plot load")
); );
return false; return false;
} }
@ -115,8 +115,8 @@ public class Load extends SubCommand {
} catch (Exception ignored) { } catch (Exception ignored) {
// use /plot load <index> // use /plot load <index>
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_valid_number"), TranslatableCaption.miniMessage("invalid.not_valid_number"),
Template.of("value", "(1, " + schematics.size() + ')') Placeholder.miniMessage("value", "(1, " + schematics.size() + ')')
); );
return false; return false;
} }
@ -125,18 +125,18 @@ public class Load extends SubCommand {
url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schematic); url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schematic);
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
e.printStackTrace(); e.printStackTrace();
player.sendMessage(TranslatableCaption.of("web.load_failed")); player.sendMessage(TranslatableCaption.miniMessage("web.load_failed"));
return false; return false;
} }
plot.addRunning(); plot.addRunning();
player.sendMessage(TranslatableCaption.of("working.generating_component")); player.sendMessage(TranslatableCaption.miniMessage("working.generating_component"));
TaskManager.runTaskAsync(() -> { TaskManager.runTaskAsync(() -> {
Schematic taskSchematic = this.schematicHandler.getSchematic(url); Schematic taskSchematic = this.schematicHandler.getSchematic(url);
if (taskSchematic == null) { if (taskSchematic == null) {
plot.removeRunning(); plot.removeRunning();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("schematics.schematic_invalid"), TranslatableCaption.miniMessage("schematics.schematic_invalid"),
Template.of("reason", "non-existent or not in gzip format") Placeholder.miniMessage("reason", "non-existent or not in gzip format")
); );
return; return;
} }
@ -154,9 +154,9 @@ public class Load extends SubCommand {
public void run(Boolean value) { public void run(Boolean value) {
plot.removeRunning(); plot.removeRunning();
if (value) { if (value) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_paste_success"));
} else { } else {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_paste_failed"));
} }
} }
} }
@ -166,8 +166,8 @@ public class Load extends SubCommand {
} }
plot.removeRunning(); plot.removeRunning();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot load <index>") Placeholder.miniMessage("value", "/plot load <index>")
); );
return false; return false;
} }
@ -181,7 +181,7 @@ public class Load extends SubCommand {
List<String> schematics1 = this.schematicHandler.getSaves(player.getUUID()); List<String> schematics1 = this.schematicHandler.getSaves(player.getUUID());
plot.removeRunning(); plot.removeRunning();
if ((schematics1 == null) || schematics1.isEmpty()) { if ((schematics1 == null) || schematics1.isEmpty()) {
player.sendMessage(TranslatableCaption.of("web.load_failed")); player.sendMessage(TranslatableCaption.miniMessage("web.load_failed"));
return; return;
} }
metaDataAccess.set(schematics1); metaDataAccess.set(schematics1);
@ -217,8 +217,8 @@ public class Load extends SubCommand {
} }
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("web.load_list"), TranslatableCaption.miniMessage("web.load_list"),
Template.of("command", "/plot load #") Placeholder.miniMessage("command", "/plot load #")
); );
} }
} }

View File

@ -43,6 +43,7 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PlotExpression; import com.plotsquared.core.util.PlotExpression;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -274,7 +275,7 @@ public class MainCommand extends Command {
} }
tp = true; tp = true;
} else { } else {
player.sendMessage(TranslatableCaption.of("border.denied")); player.sendMessage(TranslatableCaption.miniMessage("border.denied"));
} }
// Trim command // Trim command
args = Arrays.copyOfRange(args, 1, args.length); args = Arrays.copyOfRange(args, 1, args.length);
@ -303,7 +304,7 @@ public class MainCommand extends Command {
}; };
args = Arrays.copyOfRange(args, 1, args.length); args = Arrays.copyOfRange(args, 1, args.length);
} else { } else {
player.sendMessage(TranslatableCaption.of("errors.invalid_command_flag")); player.sendMessage(TranslatableCaption.miniMessage("errors.invalid_command_flag"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
} }
@ -317,12 +318,12 @@ public class MainCommand extends Command {
String message = e.getMessage(); String message = e.getMessage();
if (message != null) { if (message != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.error"), TranslatableCaption.miniMessage("errors.error"),
net.kyori.adventure.text.minimessage.Template.of("value", message) Placeholder.miniMessage("value", message)
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.error_console")); TranslatableCaption.miniMessage("errors.error_console"));
} }
} }
// Reset command scope // // Reset command scope //

View File

@ -42,7 +42,8 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PlotExpression; import com.plotsquared.core.util.PlotExpression;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID; import java.util.UUID;
@ -88,15 +89,15 @@ public class Merge extends SubCommand {
Location location = player.getLocationFull(); Location location = player.getLocationFull();
final Plot plot = location.getPlotAbs(); final Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
Direction direction = null; Direction direction = null;
@ -121,12 +122,12 @@ public class Merge extends SubCommand {
} }
if (direction == null) { if (direction == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]") Placeholder.miniMessage("value", "/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]")
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("help.direction"), TranslatableCaption.miniMessage("help.direction"),
Template.of("dir", direction(location.getYaw())) Placeholder.miniMessage("dir", direction(location.getYaw()))
); );
return false; return false;
} }
@ -136,8 +137,8 @@ public class Merge extends SubCommand {
this.eventDispatcher.callMerge(plot, direction, max, player); this.eventDispatcher.callMerge(plot, direction, max, player);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Merge") Placeholder.miniMessage("value", "Merge")
); );
return false; return false;
} }
@ -147,8 +148,8 @@ public class Merge extends SubCommand {
if (!force && size - 1 > maxSize) { if (!force && size - 1 > maxSize) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_MERGE + "." + (size + 1)) Placeholder.miniMessage("node", Permission.PERMISSION_MERGE + "." + (size + 1))
); );
return false; return false;
} }
@ -160,7 +161,7 @@ public class Merge extends SubCommand {
if (!force && !plot.isOwner(uuid)) { if (!force && !plot.isOwner(uuid)) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_MERGE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_MERGE)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} else { } else {
uuid = plot.getOwnerAbs(); uuid = plot.getOwnerAbs();
@ -174,8 +175,8 @@ public class Merge extends SubCommand {
if (!force && !terrain && !Permissions if (!force && !terrain && !Permissions
.hasPermission(player, Permission.PERMISSION_MERGE_KEEP_ROAD)) { .hasPermission(player, Permission.PERMISSION_MERGE_KEEP_ROAD)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_MERGE_KEEP_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_MERGE_KEEP_ROAD))
); );
return true; return true;
} }
@ -183,23 +184,23 @@ public class Merge extends SubCommand {
if (this.econHandler.isEnabled(plotArea) && price > 0d) { if (this.econHandler.isEnabled(plotArea) && price > 0d) {
this.econHandler.withdrawMoney(player, price); this.econHandler.withdrawMoney(player, price);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_balance"), TranslatableCaption.miniMessage("economy.removed_balance"),
Template.of("money", this.econHandler.format(price)), Placeholder.miniMessage("money", this.econHandler.format(price)),
Template.of("balance", this.econHandler.format(this.econHandler.getMoney(player))) Placeholder.miniMessage("balance", this.econHandler.format(this.econHandler.getMoney(player)))
); );
} }
player.sendMessage(TranslatableCaption.of("merge.success_merge")); player.sendMessage(TranslatableCaption.miniMessage("merge.success_merge"));
eventDispatcher.callPostMerge(player, plot); eventDispatcher.callPostMerge(player, plot);
return true; return true;
} }
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge")); player.sendMessage(TranslatableCaption.miniMessage("merge.no_available_automerge"));
return false; return false;
} }
if (!force && this.econHandler.isEnabled(plotArea) && price > 0d if (!force && this.econHandler.isEnabled(plotArea) && price > 0d
&& this.econHandler.getMoney(player) < price) { && this.econHandler.getMoney(player) < price) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.cannot_afford_merge"), TranslatableCaption.miniMessage("economy.cannot_afford_merge"),
Template.of("money", this.econHandler.format(price)) Placeholder.miniMessage("money", this.econHandler.format(price))
); );
return false; return false;
} }
@ -212,8 +213,8 @@ public class Merge extends SubCommand {
if (!force && !terrain && !Permissions if (!force && !terrain && !Permissions
.hasPermission(player, Permission.PERMISSION_MERGE_KEEP_ROAD)) { .hasPermission(player, Permission.PERMISSION_MERGE_KEEP_ROAD)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_MERGE_KEEP_ROAD)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_MERGE_KEEP_ROAD))
); );
return true; return true;
} }
@ -221,24 +222,24 @@ public class Merge extends SubCommand {
if (this.econHandler.isEnabled(plotArea) && price > 0d) { if (this.econHandler.isEnabled(plotArea) && price > 0d) {
this.econHandler.withdrawMoney(player, price); this.econHandler.withdrawMoney(player, price);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_balance"), TranslatableCaption.miniMessage("economy.removed_balance"),
Template.of("money", this.econHandler.format(price)) Placeholder.miniMessage("money", this.econHandler.format(price))
); );
} }
player.sendMessage(TranslatableCaption.of("merge.success_merge")); player.sendMessage(TranslatableCaption.miniMessage("merge.success_merge"));
eventDispatcher.callPostMerge(player, plot); eventDispatcher.callPostMerge(player, plot);
return true; return true;
} }
Plot adjacent = plot.getRelative(direction); Plot adjacent = plot.getRelative(direction);
if (adjacent == null || !adjacent.hasOwner() || adjacent if (adjacent == null || !adjacent.hasOwner() || adjacent
.isMerged((direction.getIndex() + 2) % 4) || (!force && adjacent.isOwner(uuid))) { .isMerged((direction.getIndex() + 2) % 4) || (!force && adjacent.isOwner(uuid))) {
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge")); player.sendMessage(TranslatableCaption.miniMessage("merge.no_available_automerge"));
return false; return false;
} }
if (!force && !Permissions.hasPermission(player, Permission.PERMISSION_MERGE_OTHER)) { if (!force && !Permissions.hasPermission(player, Permission.PERMISSION_MERGE_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_MERGE_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_MERGE_OTHER))
); );
return false; return false;
} }
@ -252,36 +253,38 @@ public class Merge extends SubCommand {
isOnline = true; isOnline = true;
final Direction dir = direction; final Direction dir = direction;
Runnable run = () -> { Runnable run = () -> {
accepter.sendMessage(TranslatableCaption.of("merge.merge_accepted")); accepter.sendMessage(TranslatableCaption.miniMessage("merge.merge_accepted"));
plot.getPlotModificationManager().autoMerge(dir, maxSize - size, owner, player, terrain); plot.getPlotModificationManager().autoMerge(dir, maxSize - size, owner, player, terrain);
PlotPlayer<?> plotPlayer = PlotSquared.platform().playerManager().getPlayerIfExists(player.getUUID()); PlotPlayer<?> plotPlayer = PlotSquared.platform().playerManager().getPlayerIfExists(player.getUUID());
if (plotPlayer == null) { if (plotPlayer == null) {
accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid")); accepter.sendMessage(TranslatableCaption.miniMessage("merge.merge_not_valid"));
return; return;
} }
if (this.econHandler.isEnabled(plotArea) && price > 0d) { if (this.econHandler.isEnabled(plotArea) && price > 0d) {
if (!force && this.econHandler.getMoney(player) < price) { if (!force && this.econHandler.getMoney(player) < price) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.cannot_afford_merge"), TranslatableCaption.miniMessage("economy.cannot_afford_merge"),
Template.of("money", this.econHandler.format(price)) Placeholder.miniMessage("money", this.econHandler.format(price))
); );
return; return;
} }
this.econHandler.withdrawMoney(player, price); this.econHandler.withdrawMoney(player, price);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_balance"), TranslatableCaption.miniMessage("economy.removed_balance"),
Template.of("money", this.econHandler.format(price)) Placeholder.miniMessage("money", this.econHandler.format(price))
); );
} }
player.sendMessage(TranslatableCaption.of("merge.success_merge")); player.sendMessage(TranslatableCaption.miniMessage("merge.success_merge"));
eventDispatcher.callPostMerge(player, plot); eventDispatcher.callPostMerge(player, plot);
}; };
if (!force && hasConfirmation(player)) { if (!force && hasConfirmation(player)) {
CmdConfirm.addPending(accepter, MINI_MESSAGE.serialize(MINI_MESSAGE CmdConfirm.addPending(accepter, MINI_MESSAGE.serialize(MINI_MESSAGE
.parse( .deserialize(
TranslatableCaption.of("merge.merge_request_confirm").getComponent(player), TranslatableCaption.miniMessage("merge.merge_request_confirm").getComponent(player),
Template.of("player", player.getName()), PlaceholderResolver.placeholders(
Template.of("location", plot.getWorldName() + ";" + plot.getId()) Placeholder.miniMessage("player", player.getName()),
Placeholder.miniMessage("location", plot.getWorldName() + ";" + plot.getId())
)
)), )),
run run
); );
@ -290,10 +293,10 @@ public class Merge extends SubCommand {
} }
} }
if (!force && !isOnline) { if (!force && !isOnline) {
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge")); player.sendMessage(TranslatableCaption.miniMessage("merge.no_available_automerge"));
return false; return false;
} }
player.sendMessage(TranslatableCaption.of("merge.merge_requested")); player.sendMessage(TranslatableCaption.miniMessage("merge.merge_requested"));
return true; return true;
} }

View File

@ -46,11 +46,11 @@ public class Middle extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot = location.getPlot(); Plot plot = location.getPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
plot.getCenter(center -> player.teleport(center, TeleportCause.COMMAND_MIDDLE)); plot.getCenter(center -> player.teleport(center, TeleportCause.COMMAND_MIDDLE));
player.sendMessage(TranslatableCaption.of("teleport.teleported_to_plot")); player.sendMessage(TranslatableCaption.miniMessage("teleport.teleported_to_plot"));
return true; return true;
} }

View File

@ -36,7 +36,7 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -64,12 +64,12 @@ public class Move extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot1 = location.getPlotAbs(); Plot plot1 = location.getPlotAbs();
if (plot1 == null) { if (plot1 == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (!plot1.isOwner(player.getUUID()) && !Permissions if (!plot1.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN)) { .hasPermission(player, Permission.PERMISSION_ADMIN)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
boolean override = false; boolean override = false;
@ -92,16 +92,16 @@ public class Move extends SubCommand {
plot2 = area.getPlotAbs(plot1.getId()); plot2 = area.getPlotAbs(plot1.getId());
} }
if (plot1.equals(plot2)) { if (plot1.equals(plot2)) {
player.sendMessage(TranslatableCaption.of("invalid.origin_cant_be_target")); player.sendMessage(TranslatableCaption.miniMessage("invalid.origin_cant_be_target"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN))) { .hasPermission(player, Permission.PERMISSION_ADMIN))) {
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible")); player.sendMessage(TranslatableCaption.miniMessage("errors.plotworld_incompatible"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (plot1.isMerged() || plot2.isMerged()) { if (plot1.isMerged() || plot2.isMerged()) {
player.sendMessage(TranslatableCaption.of("move.move_merged")); player.sendMessage(TranslatableCaption.miniMessage("move.move_merged"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
@ -109,13 +109,13 @@ public class Move extends SubCommand {
}, false).thenApply(result -> { }, false).thenApply(result -> {
if (result) { if (result) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("move.move_success"), TranslatableCaption.miniMessage("move.move_success"),
Template.of("origin", plot1.toString()), Placeholder.miniMessage("origin", plot1.toString()),
Template.of("target", plot2.toString()) Placeholder.miniMessage("target", plot2.toString())
); );
return true; return true;
} else { } else {
player.sendMessage(TranslatableCaption.of("move.requires_unowned")); player.sendMessage(TranslatableCaption.miniMessage("move.requires_unowned"));
return false; return false;
} }
}); });

View File

@ -41,7 +41,7 @@ import com.plotsquared.core.plot.flag.implementations.MusicFlag;
import com.plotsquared.core.util.InventoryUtil; import com.plotsquared.core.util.InventoryUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.item.ItemTypes;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Arrays; import java.util.Arrays;
@ -73,14 +73,14 @@ public class Music extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
final Plot plot = location.getPlotAbs(); final Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.isAdded(player.getUUID()) && !Permissions if (!plot.isAdded(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_MUSIC_OTHER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_MUSIC_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_MUSIC_OTHER)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_ADMIN_MUSIC_OTHER))
); );
return true; return true;
} }
@ -88,7 +88,7 @@ public class Music extends SubCommand {
this.inventoryUtil, this.inventoryUtil,
player, player,
2, 2,
TranslatableCaption.of("plotjukebox.jukebox_header").getComponent(player) TranslatableCaption.miniMessage("plotjukebox.jukebox_header").getComponent(player)
) { ) {
@Override @Override
public boolean onClick(int index) { public boolean onClick(int index) {
@ -102,16 +102,16 @@ public class Music extends SubCommand {
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(plotFlag, plot); PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
getPlayer().sendMessage( getPlayer().sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Music removal") Placeholder.miniMessage("value", "Music removal")
); );
return true; return true;
} }
plot.removeFlag(event.getFlag()); plot.removeFlag(event.getFlag());
getPlayer().sendMessage( getPlayer().sendMessage(
TranslatableCaption.of("flag.flag_removed"), TranslatableCaption.miniMessage("flag.flag_removed"),
Template.of("flag", "music"), Placeholder.miniMessage("flag", "music"),
Template.of("value", "music_disc") Placeholder.miniMessage("value", "music_disc")
); );
} else if (item.getName().toLowerCase(Locale.ENGLISH).contains("disc")) { } else if (item.getName().toLowerCase(Locale.ENGLISH).contains("disc")) {
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class) PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class)
@ -119,17 +119,17 @@ public class Music extends SubCommand {
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
getPlayer().sendMessage( getPlayer().sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Music addition") Placeholder.miniMessage("value", "Music addition")
); );
return true; return true;
} }
plot.setFlag(event.getFlag()); plot.setFlag(event.getFlag());
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", "music"), getPlayer().sendMessage(TranslatableCaption.miniMessage("flag.flag_added"), Placeholder.miniMessage("flag", "music"),
Template.of("value", String.valueOf(event.getFlag().getValue())) Placeholder.miniMessage("value", String.valueOf(event.getFlag().getValue()))
); );
} else { } else {
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_not_added")); getPlayer().sendMessage(TranslatableCaption.miniMessage("flag.flag_not_added"));
} }
return false; return false;
} }
@ -138,15 +138,15 @@ public class Music extends SubCommand {
for (final String disc : DISCS) { for (final String disc : DISCS) {
final String name = String.format("<gold>%s</gold>", disc); final String name = String.format("<gold>%s</gold>", disc);
final String[] lore = {TranslatableCaption.of("plotjukebox.click_to_play").getComponent(player)}; final String[] lore = {TranslatableCaption.miniMessage("plotjukebox.click_to_play").getComponent(player)};
final PlotItemStack item = new PlotItemStack(disc, 1, name, lore); final PlotItemStack item = new PlotItemStack(disc, 1, name, lore);
inv.setItem(index++, item); inv.setItem(index++, item);
} }
// Always add the cancel button // Always add the cancel button
// if (player.getMeta("music") != null) { // if (player.getMeta("music") != null) {
String name = TranslatableCaption.of("plotjukebox.cancel_music").getComponent(player); String name = TranslatableCaption.miniMessage("plotjukebox.cancel_music").getComponent(player);
String[] lore = {TranslatableCaption.of("plotjukebox.reset_music").getComponent(player)}; String[] lore = {TranslatableCaption.miniMessage("plotjukebox.reset_music").getComponent(player)};
inv.setItem(index, new PlotItemStack("bedrock", 1, name, lore)); inv.setItem(index, new PlotItemStack("bedrock", 1, name, lore));
// } // }

View File

@ -31,7 +31,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -52,10 +52,10 @@ public class Near extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone RunnableVal2<Command, CommandResult> whenDone
) throws CommandException { ) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot")); final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.miniMessage("errors.not_in_plot"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("near.plot_near"), TranslatableCaption.miniMessage("near.plot_near"),
Template.of("list", StringMan.join(plot.getPlayersInPlot(), ", ")) Placeholder.miniMessage("list", StringMan.join(plot.getPlayersInPlot(), ", "))
); );
return CompletableFuture.completedFuture(true); return CompletableFuture.completedFuture(true);
} }

View File

@ -42,7 +42,7 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PlayerManager; import com.plotsquared.core.util.PlayerManager;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -72,8 +72,8 @@ public class Owner extends SetCommand {
public boolean set(final PlotPlayer<?> player, final Plot plot, String value) { public boolean set(final PlotPlayer<?> player, final Plot plot, String value) {
if (value == null || value.isEmpty()) { if (value == null || value.isEmpty()) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot setowner <owner>") Placeholder.miniMessage("value", "/plot setowner <owner>")
); );
return false; return false;
} }
@ -84,8 +84,8 @@ public class Owner extends SetCommand {
if (uuid == null && !value.equalsIgnoreCase("none") && !value.equalsIgnoreCase("null") if (uuid == null && !value.equalsIgnoreCase("none") && !value.equalsIgnoreCase("null")
&& !value.equalsIgnoreCase("-")) { && !value.equalsIgnoreCase("-")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", value) Placeholder.miniMessage("value", value)
); );
return; return;
} }
@ -98,8 +98,8 @@ public class Owner extends SetCommand {
); );
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Owner change") Placeholder.miniMessage("value", "Owner change")
); );
return; return;
} }
@ -121,8 +121,8 @@ public class Owner extends SetCommand {
); );
if (unlinkEvent.getEventResult() == Result.DENY) { if (unlinkEvent.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Unlink on owner change") Placeholder.miniMessage("value", "Unlink on owner change")
); );
return; return;
} }
@ -135,14 +135,14 @@ public class Owner extends SetCommand {
current.getPlotModificationManager().removeSign(); current.getPlotModificationManager().removeSign();
} }
eventDispatcher.callPostOwnerChange(player, plot, oldOwner); eventDispatcher.callPostOwnerChange(player, plot, oldOwner);
player.sendMessage(TranslatableCaption.of("owner.set_owner")); player.sendMessage(TranslatableCaption.miniMessage("owner.set_owner"));
return; return;
} }
final PlotPlayer<?> other = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); final PlotPlayer<?> other = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if (plot.isOwner(uuid)) { if (plot.isOwner(uuid)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("member.already_owner"), TranslatableCaption.miniMessage("member.already_owner"),
Template.of("player", PlayerManager.getName(uuid, false)) Placeholder.miniMessage("player", PlayerManager.getName(uuid, false))
); );
return; return;
} }
@ -150,8 +150,8 @@ public class Owner extends SetCommand {
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_SET_OWNER)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_SET_OWNER)) {
if (other == null) { if (other == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player_offline"), TranslatableCaption.miniMessage("errors.invalid_player_offline"),
Template.of("player", PlayerManager.getName(uuid)) Placeholder.miniMessage("player", PlayerManager.getName(uuid))
); );
return; return;
} }
@ -166,7 +166,7 @@ public class Owner extends SetCommand {
grants = metaDataAccess.get().orElse(0); grants = metaDataAccess.get().orElse(0);
if (grants <= 0) { if (grants <= 0) {
metaDataAccess.remove(); metaDataAccess.remove();
player.sendMessage(TranslatableCaption.of("permission.cant_transfer_more_plots")); player.sendMessage(TranslatableCaption.miniMessage("permission.cant_transfer_more_plots"));
return; return;
} }
} }
@ -182,16 +182,16 @@ public class Owner extends SetCommand {
plot.removeDenied(finalUUID); plot.removeDenied(finalUUID);
} }
plot.getPlotModificationManager().setSign(finalName); plot.getPlotModificationManager().setSign(finalName);
player.sendMessage(TranslatableCaption.of("owner.set_owner")); player.sendMessage(TranslatableCaption.miniMessage("owner.set_owner"));
eventDispatcher.callPostOwnerChange(player, plot, oldOwner); eventDispatcher.callPostOwnerChange(player, plot, oldOwner);
if (other != null) { if (other != null) {
other.sendMessage( other.sendMessage(
TranslatableCaption.of("owner.now_owner"), TranslatableCaption.miniMessage("owner.now_owner"),
Template.of("plot", plot.getArea() + ";" + plot.getId()) Placeholder.miniMessage("plot", plot.getArea() + ";" + plot.getId())
); );
} }
} else { } else {
player.sendMessage(TranslatableCaption.of("owner.set_owner_cancelled")); player.sendMessage(TranslatableCaption.miniMessage("owner.set_owner_cancelled"));
} }
}; };
if (hasConfirmation(player)) { if (hasConfirmation(player)) {

View File

@ -30,7 +30,7 @@ import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.PremiumVerification; import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
@CommandDeclaration(command = "plugin", @CommandDeclaration(command = "plugin",
permission = "plots.use", permission = "plots.use",
@ -46,7 +46,7 @@ public class PluginCmd extends SubCommand {
StaticCaption.of("<gray>>> </gray><gold><bold>" + PlotSquared StaticCaption.of("<gray>>> </gray><gold><bold>" + PlotSquared
.platform() .platform()
.pluginName() + " <reset><gray>(<gold>Version</gold><gray>: </gray><gold><version></gold><gray>)</gray>"), .pluginName() + " <reset><gray>(<gold>Version</gold><gray>: </gray><gold><version></gold><gray>)</gray>"),
Template.of("version", String.valueOf(PlotSquared.get().getVersion())) Placeholder.miniMessage("version", String.valueOf(PlotSquared.get().getVersion()))
); );
player.sendMessage(StaticCaption.of( player.sendMessage(StaticCaption.of(
"<gray>>> </gray><gold><bold>Authors<reset><gray>: </gray><gold>Citymonstret </gold><gray>& </gray><gold>Empire92 </gold><gray>& </gray><gold>MattBDev </gold><gray>& </gray><gold>dordsor21 </gold><gray>& </gray><gold>NotMyFault </gold><gray>& </gray><gold>SirYwell</gold>")); "<gray>>> </gray><gold><bold>Authors<reset><gray>: </gray><gold>Citymonstret </gold><gray>& </gray><gold>Empire92 </gold><gray>& </gray><gold>MattBDev </gold><gray>& </gray><gold>dordsor21 </gold><gray>& </gray><gold>NotMyFault </gold><gray>& </gray><gold>SirYwell</gold>"));
@ -56,7 +56,7 @@ public class PluginCmd extends SubCommand {
"<gray>>> </gray><gold><bold>Discord<reset><gray>: </gray><gold><click:open_url:https://discord.gg/intellectualsites>https://discord.gg/intellectualsites</gold>")); "<gray>>> </gray><gold><bold>Discord<reset><gray>: </gray><gold><click:open_url:https://discord.gg/intellectualsites>https://discord.gg/intellectualsites</gold>"));
player.sendMessage( player.sendMessage(
StaticCaption.of("<gray>>> </gray><gold><bold>Premium<reset><gray>: <gold><value></gold>"), StaticCaption.of("<gray>>> </gray><gold><bold>Premium<reset><gray>: <gold><value></gold>"),
Template.of("value", String.valueOf(PremiumVerification.isPremium())) Placeholder.miniMessage("value", String.valueOf(PremiumVerification.isPremium()))
); );
}); });
return true; return true;

View File

@ -39,7 +39,7 @@ import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@ -102,8 +102,8 @@ public class Purge extends SubCommand {
area = this.plotAreaManager.getPlotAreaByString(split[1]); area = this.plotAreaManager.getPlotAreaByString(split[1]);
if (area == null) { if (area == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.not_valid_plot_world"), TranslatableCaption.miniMessage("errors.not_valid_plot_world"),
Template.of("value", split[1]) Placeholder.miniMessage("value", split[1])
); );
return false; return false;
} }
@ -114,8 +114,8 @@ public class Purge extends SubCommand {
id = PlotId.fromString(split[1]); id = PlotId.fromString(split[1]);
} catch (IllegalArgumentException ignored) { } catch (IllegalArgumentException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_valid_plot_id"), TranslatableCaption.miniMessage("invalid.not_valid_plot_id"),
Template.of("value", split[1]) Placeholder.miniMessage("value", split[1])
); );
return false; return false;
} }
@ -125,8 +125,8 @@ public class Purge extends SubCommand {
UUIDMapping ownerMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(split[1]); UUIDMapping ownerMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(split[1]);
if (ownerMapping == null) { if (ownerMapping == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", split[1]) Placeholder.miniMessage("value", split[1])
); );
return false; return false;
} }
@ -137,8 +137,8 @@ public class Purge extends SubCommand {
UUIDMapping addedMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(split[1]); UUIDMapping addedMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(split[1]);
if (addedMapping == null) { if (addedMapping == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", split[1]) Placeholder.miniMessage("value", split[1])
); );
return false; return false;
} }
@ -198,7 +198,7 @@ public class Purge extends SubCommand {
} }
} }
if (toDelete.isEmpty()) { if (toDelete.isEmpty()) {
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots")); player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
return false; return false;
} }
String cmd = String cmd =
@ -242,8 +242,8 @@ public class Purge extends SubCommand {
TaskManager.runTask(() -> { TaskManager.runTask(() -> {
DBFunc.purgeIds(ids); DBFunc.purgeIds(ids);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("purge.purge_success"), TranslatableCaption.miniMessage("purge.purge_success"),
Template.of("amount", ids.size() + "/" + toDelete.size()) Placeholder.miniMessage("amount", ids.size() + "/" + toDelete.size())
); );
}); });
} }

View File

@ -45,7 +45,7 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection; import java.util.Collection;
@ -108,17 +108,17 @@ public class Rate extends SubCommand {
.isAdded(uuid)) { .isAdded(uuid)) {
p.teleportPlayer(player, TeleportCause.COMMAND_RATE, result -> { p.teleportPlayer(player, TeleportCause.COMMAND_RATE, result -> {
}); });
player.sendMessage(TranslatableCaption.of("tutorial.rate_this")); player.sendMessage(TranslatableCaption.miniMessage("tutorial.rate_this"));
return true; return true;
} }
} }
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots")); player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
return false; return false;
} }
case "purge" -> { case "purge" -> {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!Permissions if (!Permissions
@ -126,26 +126,26 @@ public class Rate extends SubCommand {
return false; return false;
} }
plot.clearRatings(); plot.clearRatings();
player.sendMessage(TranslatableCaption.of("ratings.ratings_purged")); player.sendMessage(TranslatableCaption.miniMessage("ratings.ratings_purged"));
return true; return true;
} }
} }
} }
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("ratings.rating_not_owned")); player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_owned"));
return false; return false;
} }
if (plot.isOwner(player.getUUID())) { if (plot.isOwner(player.getUUID())) {
player.sendMessage(TranslatableCaption.of("ratings.rating_not_your_own")); player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_your_own"));
return false; return false;
} }
if (Settings.Done.REQUIRED_FOR_RATINGS && !DoneFlag.isDone(plot)) { if (Settings.Done.REQUIRED_FOR_RATINGS && !DoneFlag.isDone(plot)) {
player.sendMessage(TranslatableCaption.of("ratings.rating_not_done")); player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_done"));
return false; return false;
} }
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) { if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
@ -154,8 +154,8 @@ public class Rate extends SubCommand {
public void run() { public void run() {
if (plot.getRatings().containsKey(player.getUUID())) { if (plot.getRatings().containsKey(player.getUUID())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("ratings.rating_already_exists"), TranslatableCaption.miniMessage("ratings.rating_already_exists"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
return; return;
} }
@ -174,8 +174,8 @@ public class Rate extends SubCommand {
if (event.getRating() != null) { if (event.getRating() != null) {
plot.addRating(this.getPlayer().getUUID(), event.getRating()); plot.addRating(this.getPlayer().getUUID(), event.getRating());
getPlayer().sendMessage( getPlayer().sendMessage(
TranslatableCaption.of("ratings.rating_applied"), TranslatableCaption.miniMessage("ratings.rating_applied"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
} }
return false; return false;
@ -185,31 +185,31 @@ public class Rate extends SubCommand {
} }
}; };
inventory.setItem(0, new PlotItemStack(Settings.Ratings.BLOCK_0, 1, inventory.setItem(0, new PlotItemStack(Settings.Ratings.BLOCK_0, 1,
TranslatableCaption.of("ratings.0-8").getComponent(player) TranslatableCaption.miniMessage("ratings.0-8").getComponent(player)
)); ));
inventory.setItem(1, new PlotItemStack(Settings.Ratings.BLOCK_1, 1, inventory.setItem(1, new PlotItemStack(Settings.Ratings.BLOCK_1, 1,
TranslatableCaption.of("ratings.1-8").getComponent(player) TranslatableCaption.miniMessage("ratings.1-8").getComponent(player)
)); ));
inventory.setItem(2, new PlotItemStack(Settings.Ratings.BLOCK_2, 2, inventory.setItem(2, new PlotItemStack(Settings.Ratings.BLOCK_2, 2,
TranslatableCaption.of("ratings.2-8").getComponent(player) TranslatableCaption.miniMessage("ratings.2-8").getComponent(player)
)); ));
inventory.setItem(3, new PlotItemStack(Settings.Ratings.BLOCK_3, 3, inventory.setItem(3, new PlotItemStack(Settings.Ratings.BLOCK_3, 3,
TranslatableCaption.of("ratings.3-8").getComponent(player) TranslatableCaption.miniMessage("ratings.3-8").getComponent(player)
)); ));
inventory.setItem(4, new PlotItemStack(Settings.Ratings.BLOCK_4, 4, inventory.setItem(4, new PlotItemStack(Settings.Ratings.BLOCK_4, 4,
TranslatableCaption.of("ratings.4-8").getComponent(player) TranslatableCaption.miniMessage("ratings.4-8").getComponent(player)
)); ));
inventory.setItem(5, new PlotItemStack(Settings.Ratings.BLOCK_5, 5, inventory.setItem(5, new PlotItemStack(Settings.Ratings.BLOCK_5, 5,
TranslatableCaption.of("ratings.5-8").getComponent(player) TranslatableCaption.miniMessage("ratings.5-8").getComponent(player)
)); ));
inventory.setItem(6, new PlotItemStack(Settings.Ratings.BLOCK_6, 6, inventory.setItem(6, new PlotItemStack(Settings.Ratings.BLOCK_6, 6,
TranslatableCaption.of("ratings.6-8").getComponent(player) TranslatableCaption.miniMessage("ratings.6-8").getComponent(player)
)); ));
inventory.setItem(7, new PlotItemStack(Settings.Ratings.BLOCK_7, 7, inventory.setItem(7, new PlotItemStack(Settings.Ratings.BLOCK_7, 7,
TranslatableCaption.of("ratings.7-8").getComponent(player) TranslatableCaption.miniMessage("ratings.7-8").getComponent(player)
)); ));
inventory.setItem(8, new PlotItemStack(Settings.Ratings.BLOCK_8, 8, inventory.setItem(8, new PlotItemStack(Settings.Ratings.BLOCK_8, 8,
TranslatableCaption.of("ratings.8-8").getComponent(player) TranslatableCaption.miniMessage("ratings.8-8").getComponent(player)
)); ));
inventory.openInventory(); inventory.openInventory();
} }
@ -228,7 +228,7 @@ public class Rate extends SubCommand {
return true; return true;
} }
if (args.length < 1) { if (args.length < 1) {
player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid")); player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_valid"));
return true; return true;
} }
String arg = args[0]; String arg = args[0];
@ -236,19 +236,19 @@ public class Rate extends SubCommand {
if (MathMan.isInteger(arg) && arg.length() < 3 && !arg.isEmpty()) { if (MathMan.isInteger(arg) && arg.length() < 3 && !arg.isEmpty()) {
rating = Integer.parseInt(arg); rating = Integer.parseInt(arg);
if (rating > 10 || rating < 1) { if (rating > 10 || rating < 1) {
player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid")); player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_valid"));
return false; return false;
} }
} else { } else {
player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid")); player.sendMessage(TranslatableCaption.miniMessage("ratings.rating_not_valid"));
return false; return false;
} }
final UUID uuid = player.getUUID(); final UUID uuid = player.getUUID();
final Runnable run = () -> { final Runnable run = () -> {
if (plot.getRatings().containsKey(uuid)) { if (plot.getRatings().containsKey(uuid)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("ratings.rating_already_exists"), TranslatableCaption.miniMessage("ratings.rating_already_exists"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
return; return;
} }
@ -257,8 +257,8 @@ public class Rate extends SubCommand {
if (event.getRating() != null) { if (event.getRating() != null) {
plot.addRating(uuid, event.getRating()); plot.addRating(uuid, event.getRating());
player.sendMessage( player.sendMessage(
TranslatableCaption.of("ratings.rating_applied"), TranslatableCaption.miniMessage("ratings.rating_applied"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
} }
}; };

View File

@ -33,7 +33,7 @@ import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@CommandDeclaration(command = "regenallroads", @CommandDeclaration(command = "regenallroads",
@ -64,44 +64,44 @@ public class RegenAllRoads extends SubCommand {
height = Integer.parseInt(args[1]); height = Integer.parseInt(args[1]);
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_valid_number"), TranslatableCaption.miniMessage("invalid.not_valid_number"),
Template.of("value", "(0, 256)") Placeholder.miniMessage("value", "(0, 256)")
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot regenallroads <world> [height]") Placeholder.miniMessage("value", "/plot regenallroads <world> [height]")
); );
return false; return false;
} }
} else if (args.length != 1) { } else if (args.length != 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot regenallroads <world> [height]") Placeholder.miniMessage("value", "/plot regenallroads <world> [height]")
); );
return false; return false;
} }
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]); PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
if (area == null) { if (area == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.not_valid_plot_world"), TranslatableCaption.miniMessage("errors.not_valid_plot_world"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
return false; return false;
} }
String name = args[0]; String name = args[0];
PlotManager manager = area.getPlotManager(); PlotManager manager = area.getPlotManager();
if (!(manager instanceof HybridPlotManager)) { if (!(manager instanceof HybridPlotManager)) {
player.sendMessage(TranslatableCaption.of("errors.invalid_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.invalid_plot_world"));
return false; return false;
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("debugroadregen.schematic"), TranslatableCaption.miniMessage("debugroadregen.schematic"),
Template.of("command", "/plot createroadschematic") Placeholder.miniMessage("command", "/plot createroadschematic")
); );
player.sendMessage(TranslatableCaption.of("debugroadregen.regenallroads_started")); player.sendMessage(TranslatableCaption.miniMessage("debugroadregen.regenallroads_started"));
boolean result = this.hybridUtils.scheduleRoadUpdate(area, height); boolean result = this.hybridUtils.scheduleRoadUpdate(area, height);
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress")); player.sendMessage(TranslatableCaption.miniMessage("debugexec.mass_schematic_update_in_progress"));
return false; return false;
} }
return true; return true;

View File

@ -120,10 +120,10 @@ public class Reload extends SubCommand {
} }
}); });
this.worldConfiguration.save(this.worldFile); this.worldConfiguration.save(this.worldFile);
player.sendMessage(TranslatableCaption.of("reload.reloaded_configs")); player.sendMessage(TranslatableCaption.miniMessage("reload.reloaded_configs"));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
player.sendMessage(TranslatableCaption.of("reload.reload_failed")); player.sendMessage(TranslatableCaption.miniMessage("reload.reload_failed"));
} }
return true; return true;
} }

View File

@ -36,7 +36,7 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PlayerManager; import com.plotsquared.core.util.PlayerManager;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection; import java.util.Collection;
@ -65,28 +65,28 @@ public class Remove extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_REMOVE)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_REMOVE)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return true; return true;
} }
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
int count = 0; int count = 0;
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
return; return;
} else if (throwable != null) { } else if (throwable != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
return; return;
} else if (!uuids.isEmpty()) { } else if (!uuids.isEmpty()) {
@ -122,13 +122,13 @@ public class Remove extends SubCommand {
} }
if (count == 0) { if (count == 0) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("member.removed_players"), TranslatableCaption.miniMessage("member.removed_players"),
Template.of("amount", count + "") Placeholder.miniMessage("amount", count + "")
); );
} }
}); });

View File

@ -31,8 +31,8 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
public enum RequiredType { public enum RequiredType {
CONSOLE(TranslatableCaption.of("console.not_console")), CONSOLE(TranslatableCaption.miniMessage("console.not_console")),
PLAYER(TranslatableCaption.of("console.is_console")), PLAYER(TranslatableCaption.miniMessage("console.is_console")),
NONE(StaticCaption.of("Something went wrong: RequiredType=NONE")); // this caption should never be sent NONE(StaticCaption.of("Something went wrong: RequiredType=NONE")); // this caption should never be sent
private final Caption caption; private final Caption caption;

View File

@ -39,7 +39,7 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.net.URL; import java.net.URL;
@ -73,29 +73,29 @@ public class Save extends SubCommand {
public boolean onCommand(final PlotPlayer<?> player, final String[] args) { public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
final String world = player.getLocation().getWorldName(); final String world = player.getLocation().getWorldName();
if (!this.plotAreaManager.hasPlotArea(world)) { if (!this.plotAreaManager.hasPlotArea(world)) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_SAVE)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_SAVE)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
return false; return false;
} }
plot.addRunning(); plot.addRunning();
@ -117,13 +117,13 @@ public class Save extends SubCommand {
public void run(URL url) { public void run(URL url) {
plot.removeRunning(); plot.removeRunning();
if (url == null) { if (url == null) {
player.sendMessage(TranslatableCaption.of("backups.backup_save_failed")); player.sendMessage(TranslatableCaption.miniMessage("backups.backup_save_failed"));
return; return;
} }
player.sendMessage(TranslatableCaption.of("web.save_success")); player.sendMessage(TranslatableCaption.miniMessage("web.save_success"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.deprecated_commands"), TranslatableCaption.miniMessage("errors.deprecated_commands"),
Template.of("replacement", "/plot download") Placeholder.miniMessage("replacement", "/plot download")
); );
try (final MetaDataAccess<List<String>> schematicAccess = try (final MetaDataAccess<List<String>> schematicAccess =
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_SCHEMATICS)) { player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_SCHEMATICS)) {

View File

@ -43,7 +43,7 @@ import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.net.URL; import java.net.URL;
@ -79,8 +79,8 @@ public class SchematicCmd extends SubCommand {
public boolean onCommand(final PlotPlayer<?> player, String[] args) { public boolean onCommand(final PlotPlayer<?> player, String[] args) {
if (args.length < 1) { if (args.length < 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "Possible values: save, paste, exportall, list") Placeholder.miniMessage("value", "Possible values: save, paste, exportall, list")
); );
return true; return true;
} }
@ -89,39 +89,39 @@ public class SchematicCmd extends SubCommand {
case "paste" -> { case "paste" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_PASTE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_PASTE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_PASTE)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_PASTE))
); );
return false; return false;
} }
if (args.length < 2) { if (args.length < 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "Possible values: save, paste, exportall, list") Placeholder.miniMessage("value", "Possible values: save, paste, exportall, list")
); );
break; break;
} }
Location loc = player.getLocation(); Location loc = player.getLocation();
final Plot plot = loc.getPlotAbs(); final Plot plot = loc.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, "plots.admin.command.schematic.paste")) { .hasPermission(player, "plots.admin.command.schematic.paste")) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
if (this.running) { if (this.running) {
player.sendMessage(TranslatableCaption.of("error.task_in_process")); player.sendMessage(TranslatableCaption.miniMessage("error.task_in_process"));
return false; return false;
} }
final String location = args[1]; final String location = args[1];
@ -137,8 +137,8 @@ public class SchematicCmd extends SubCommand {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("schematics.schematic_invalid"), TranslatableCaption.miniMessage("schematics.schematic_invalid"),
Template.of("reason", "non-existent url: " + location) Placeholder.miniMessage("reason", "non-existent url: " + location)
); );
SchematicCmd.this.running = false; SchematicCmd.this.running = false;
return; return;
@ -153,8 +153,8 @@ public class SchematicCmd extends SubCommand {
if (schematic == null) { if (schematic == null) {
SchematicCmd.this.running = false; SchematicCmd.this.running = false;
player.sendMessage( player.sendMessage(
TranslatableCaption.of("schematics.schematic_invalid"), TranslatableCaption.miniMessage("schematics.schematic_invalid"),
Template.of("reason", "non-existent or not in gzip format") Placeholder.miniMessage("reason", "non-existent or not in gzip format")
); );
return; return;
} }
@ -171,9 +171,9 @@ public class SchematicCmd extends SubCommand {
public void run(Boolean value) { public void run(Boolean value) {
SchematicCmd.this.running = false; SchematicCmd.this.running = false;
if (value) { if (value) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_paste_success"));
} else { } else {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_paste_failed"));
} }
} }
} }
@ -184,108 +184,108 @@ public class SchematicCmd extends SubCommand {
Location loc = player.getLocation(); Location loc = player.getLocation();
final Plot plot = loc.getPlotAbs(); final Plot plot = loc.getPlotAbs();
if (!(player instanceof ConsolePlayer)) { if (!(player instanceof ConsolePlayer)) {
player.sendMessage(TranslatableCaption.of("console.not_console")); player.sendMessage(TranslatableCaption.miniMessage("console.not_console"));
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_world_args")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_exportall_world_args"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "Use /plot schematic exportall <area>") Placeholder.miniMessage("value", "Use /plot schematic exportall <area>")
); );
return false; return false;
} }
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]); PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
if (area == null) { if (area == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.not_valid_plot_world"), TranslatableCaption.miniMessage("errors.not_valid_plot_world"),
Template.of("value", args[1]) Placeholder.miniMessage("value", args[1])
); );
return false; return false;
} }
Collection<Plot> plots = area.getPlots(); Collection<Plot> plots = area.getPlots();
if (plots.isEmpty()) { if (plots.isEmpty()) {
player.sendMessage(TranslatableCaption.of("schematic.schematic_exportall_world")); player.sendMessage(TranslatableCaption.miniMessage("schematic.schematic_exportall_world"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "Use /plot sch exportall <area>") Placeholder.miniMessage("value", "Use /plot sch exportall <area>")
); );
return false; return false;
} }
boolean result = this.schematicHandler.exportAll(plots, null, null, boolean result = this.schematicHandler.exportAll(plots, null, null,
() -> player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_finished")) () -> player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_exportall_finished"))
); );
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("error.task_in_process")); player.sendMessage(TranslatableCaption.miniMessage("error.task_in_process"));
return false; return false;
} else { } else {
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_started")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_exportall_started"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("schematics.plot_to_schem"), TranslatableCaption.miniMessage("schematics.plot_to_schem"),
Template.of("amount", String.valueOf(plots.size())) Placeholder.miniMessage("amount", String.valueOf(plots.size()))
); );
} }
} }
case "export", "save" -> { case "export", "save" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_SAVE)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_SAVE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_SAVE)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_SAVE))
); );
return false; return false;
} }
if (this.running) { if (this.running) {
player.sendMessage(TranslatableCaption.of("error.task_in_process")); player.sendMessage(TranslatableCaption.miniMessage("error.task_in_process"));
return false; return false;
} }
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, "plots.admin.command.schematic.save")) { .hasPermission(player, "plots.admin.command.schematic.save")) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
ArrayList<Plot> plots = Lists.newArrayList(plot); ArrayList<Plot> plots = Lists.newArrayList(plot);
boolean result = this.schematicHandler.exportAll(plots, null, null, () -> { boolean result = this.schematicHandler.exportAll(plots, null, null, () -> {
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_single_finished")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_exportall_single_finished"));
SchematicCmd.this.running = false; SchematicCmd.this.running = false;
}); });
if (!result) { if (!result) {
player.sendMessage(TranslatableCaption.of("error.task_in_process")); player.sendMessage(TranslatableCaption.miniMessage("error.task_in_process"));
return false; return false;
} else { } else {
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_started")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_exportall_started"));
} }
} }
case "list" -> { case "list" -> {
if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_LIST)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_SCHEMATIC_LIST)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_LIST)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_SCHEMATIC_LIST))
); );
return false; return false;
} }
final String string = StringMan.join(this.schematicHandler.getSchematicNames(), "$2, $1"); final String string = StringMan.join(this.schematicHandler.getSchematicNames(), "$2, $1");
player.sendMessage( player.sendMessage(
TranslatableCaption.of("schematics.schematic_list"), TranslatableCaption.miniMessage("schematics.schematic_list"),
Template.of("list", string) Placeholder.miniMessage("list", string)
); );
} }
default -> player.sendMessage( default -> player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "Possible values: save, paste, exportall, list") Placeholder.miniMessage("value", "Possible values: save, paste, exportall, list")
); );
} }
return true; return true;

View File

@ -47,7 +47,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.block.BlockCategory;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
@ -129,8 +129,8 @@ public class Set extends SubCommand {
continue; continue;
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.component_illegal_block"), TranslatableCaption.miniMessage("invalid.component_illegal_block"),
Template.of("value", forbiddenType) Placeholder.miniMessage("value", forbiddenType)
); );
return true; return true;
} }
@ -141,20 +141,20 @@ public class Set extends SubCommand {
if (component.equalsIgnoreCase(args[0])) { if (component.equalsIgnoreCase(args[0])) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_SET_COMPONENT.format(component))) { if (!Permissions.hasPermission(player, Permission.PERMISSION_SET_COMPONENT.format(component))) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_SET_COMPONENT.format(component)) Placeholder.miniMessage("node", Permission.PERMISSION_SET_COMPONENT.format(component))
); );
return false; return false;
} }
if (args.length < 2) { if (args.length < 2) {
player.sendMessage(TranslatableCaption.of("need.need_block")); player.sendMessage(TranslatableCaption.miniMessage("need.need_block"));
return true; return true;
} }
Pattern pattern = PatternUtil.parse(player, material, false); Pattern pattern = PatternUtil.parse(player, material, false);
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer")); player.sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
return false; return false;
} }
@ -164,8 +164,8 @@ public class Set extends SubCommand {
queue.setCompleteTask(() -> { queue.setCompleteTask(() -> {
plot.removeRunning(); plot.removeRunning();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("working.component_complete"), TranslatableCaption.miniMessage("working.component_complete"),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
}); });
if (Settings.QUEUE.NOTIFY_PROGRESS) { if (Settings.QUEUE.NOTIFY_PROGRESS) {
@ -180,7 +180,7 @@ public class Set extends SubCommand {
current.getPlotModificationManager().setComponent(component, pattern, player, queue); current.getPlotModificationManager().setComponent(component, pattern, player, queue);
} }
queue.enqueue(); queue.enqueue();
player.sendMessage(TranslatableCaption.of("working.generating_component")); player.sendMessage(TranslatableCaption.miniMessage("working.generating_component"));
}); });
return true; return true;
} }
@ -205,9 +205,9 @@ public class Set extends SubCommand {
newValues.addAll(Arrays.asList(plot.getManager().getPlotComponents(plot.getId()))); newValues.addAll(Arrays.asList(plot.getManager().getPlotComponents(plot.getId())));
} }
player.sendMessage(StaticCaption.of(TranslatableCaption player.sendMessage(StaticCaption.of(TranslatableCaption
.of("commandconfig.subcommand_set_options_header_only") .miniMessage("commandconfig.subcommand_set_options_header_only")
.getComponent(player) + StringMan .getComponent(player) + StringMan
.join(newValues, TranslatableCaption.of("blocklist.block_list_separator").getComponent(player)))); .join(newValues, TranslatableCaption.miniMessage("blocklist.block_list_separator").getComponent(player))));
return false; return false;
} }
@ -227,11 +227,11 @@ public class Set extends SubCommand {
// Additional checks // Additional checks
Plot plot = player.getCurrentPlot(); Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
// components // components

View File

@ -32,7 +32,7 @@ import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
public abstract class SetCommand extends SubCommand { public abstract class SetCommand extends SubCommand {
@ -41,26 +41,26 @@ public abstract class SetCommand extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot = location.getPlotAbs(); Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) { if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_ADMIN_COMMAND.format(getFullId())) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))
); );
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed")); player.sendMessage(TranslatableCaption.miniMessage("working.plot_not_claimed"));
return false; return false;
} }
} }
if (!plot.isOwner(player.getUUID())) { if (!plot.isOwner(player.getUUID())) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) { if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", Permission.PERMISSION_ADMIN_COMMAND.format(getFullId())) Placeholder.miniMessage("node", Permission.PERMISSION_ADMIN_COMMAND.format(getFullId()))
); );
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return false; return false;
} }
} }

View File

@ -30,7 +30,7 @@ import com.plotsquared.core.location.BlockLoc;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
@CommandDeclaration(command = "sethome", @CommandDeclaration(command = "sethome",
permission = "plots.set.home", permission = "plots.set.home",
@ -43,14 +43,14 @@ public class SetHome extends SetCommand {
@Override @Override
public boolean set(PlotPlayer<?> player, Plot plot, String value) { public boolean set(PlotPlayer<?> player, Plot plot, String value) {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
switch (value.toLowerCase()) { switch (value.toLowerCase()) {
case "unset", "reset", "remove", "none" -> { case "unset", "reset", "remove", "none" -> {
Plot base = plot.getBasePlot(false); Plot base = plot.getBasePlot(false);
base.setHome(null); base.setHome(null);
player.sendMessage(TranslatableCaption.of("position.position_unset")); player.sendMessage(TranslatableCaption.miniMessage("position.position_unset"));
return true; return true;
} }
case "" -> { case "" -> {
@ -61,13 +61,13 @@ public class SetHome extends SetCommand {
location.getZ() - bottom.getZ(), location.getYaw(), location.getPitch() location.getZ() - bottom.getZ(), location.getYaw(), location.getPitch()
); );
base.setHome(rel); base.setHome(rel);
player.sendMessage(TranslatableCaption.of("position.position_set")); player.sendMessage(TranslatableCaption.miniMessage("position.position_set"));
return true; return true;
} }
default -> { default -> {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "Use /plot set home [none]") Placeholder.miniMessage("value", "Use /plot set home [none]")
); );
return false; return false;
} }

View File

@ -36,7 +36,7 @@ import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.setup.SetupProcess; import com.plotsquared.core.setup.SetupProcess;
import com.plotsquared.core.setup.SetupStep; import com.plotsquared.core.setup.SetupStep;
import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.SetupUtils;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
@ -61,7 +61,7 @@ public class Setup extends SubCommand {
public void displayGenerators(PlotPlayer<?> player) { public void displayGenerators(PlotPlayer<?> player) {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
message.append(TranslatableCaption.of("setup.choose_generator").getComponent(player)); message.append(TranslatableCaption.miniMessage("setup.choose_generator").getComponent(player));
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) { for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
if (entry.getKey().equals(PlotSquared.platform().pluginName())) { if (entry.getKey().equals(PlotSquared.platform().pluginName())) {
message.append("\n<dark_gray> - </dark_gray><dark_green>").append(entry.getKey()).append( message.append("\n<dark_gray> - </dark_gray><dark_green>").append(entry.getKey()).append(
@ -82,10 +82,10 @@ public class Setup extends SubCommand {
SetupProcess process = metaDataAccess.get().orElse(null); SetupProcess process = metaDataAccess.get().orElse(null);
if (process == null) { if (process == null) {
if (args.length > 0) { if (args.length > 0) {
player.sendMessage(TranslatableCaption.of("setup.setup_not_started")); player.sendMessage(TranslatableCaption.miniMessage("setup.setup_not_started"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "Use /plot setup to start a setup process.") Placeholder.miniMessage("value", "Use /plot setup to start a setup process.")
); );
return true; return true;
} }
@ -103,7 +103,7 @@ public class Setup extends SubCommand {
process.getCurrentStep().announce(player); process.getCurrentStep().announce(player);
} else if ("cancel".equalsIgnoreCase(args[0])) { } else if ("cancel".equalsIgnoreCase(args[0])) {
metaDataAccess.remove(); metaDataAccess.remove();
player.sendMessage(TranslatableCaption.of("setup.setup_cancelled")); player.sendMessage(TranslatableCaption.miniMessage("setup.setup_cancelled"));
} else { } else {
process.handleInput(player, args[0]); process.handleInput(player, args[0]);
if (process.getCurrentStep() != null) { if (process.getCurrentStep() != null) {

View File

@ -33,7 +33,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -53,12 +53,12 @@ public class Swap extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
Plot plot1 = location.getPlotAbs(); Plot plot1 = location.getPlotAbs();
if (plot1 == null) { if (plot1 == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (!plot1.isOwner(player.getUUID()) && !Permissions if (!plot1.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN)) { .hasPermission(player, Permission.PERMISSION_ADMIN)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (args.length != 1) { if (args.length != 1) {
@ -70,27 +70,27 @@ public class Swap extends SubCommand {
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (plot1.equals(plot2)) { if (plot1.equals(plot2)) {
player.sendMessage(TranslatableCaption.of("invalid.origin_cant_be_target")); player.sendMessage(TranslatableCaption.miniMessage("invalid.origin_cant_be_target"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (!plot1.getArea().isCompatible(plot2.getArea())) { if (!plot1.getArea().isCompatible(plot2.getArea())) {
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible")); player.sendMessage(TranslatableCaption.miniMessage("errors.plotworld_incompatible"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (plot1.isMerged() || plot2.isMerged()) { if (plot1.isMerged() || plot2.isMerged()) {
player.sendMessage(TranslatableCaption.of("swap.swap_merged")); player.sendMessage(TranslatableCaption.miniMessage("swap.swap_merged"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
return plot1.getPlotModificationManager().move(plot2, player, () -> { return plot1.getPlotModificationManager().move(plot2, player, () -> {
}, true).thenApply(result -> { }, true).thenApply(result -> {
if (result) { if (result) {
player.sendMessage(TranslatableCaption.of("swap.swap_success"), Template.of("origin", String.valueOf(plot1)), player.sendMessage(TranslatableCaption.miniMessage("swap.swap_success"), Placeholder.miniMessage("origin", String.valueOf(plot1)),
Template.of("target", String.valueOf(plot2)) Placeholder.miniMessage("target", String.valueOf(plot2))
); );
return true; return true;
} else { } else {
player.sendMessage(TranslatableCaption.of("swap.swap_overlap")); player.sendMessage(TranslatableCaption.miniMessage("swap.swap_overlap"));
return false; return false;
} }
}); });

View File

@ -31,7 +31,7 @@ import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.Collection; import java.util.Collection;
import java.util.Locale; import java.util.Locale;
@ -53,13 +53,13 @@ public class Target extends SubCommand {
public boolean onCommand(PlotPlayer<?> player, String[] args) { public boolean onCommand(PlotPlayer<?> player, String[] args) {
Location location = player.getLocation(); Location location = player.getLocation();
if (!location.isPlotArea()) { if (!location.isPlotArea()) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot_world"));
return false; return false;
} }
if (args.length == 0) { if (args.length == 0) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Template.of("value", "/plot target <<X;Z> | nearest>") Placeholder.miniMessage("value", "/plot target <<X;Z> | nearest>")
); );
return false; return false;
} }
@ -74,7 +74,7 @@ public class Target extends SubCommand {
} }
} }
if (target == null) { if (target == null) {
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots")); player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
return false; return false;
} }
} else if ((target = Plot.getPlotFromString(player, args[0], true)) == null) { } else if ((target = Plot.getPlotFromString(player, args[0], true)) == null) {
@ -82,8 +82,8 @@ public class Target extends SubCommand {
} }
target.getCenter(player::setCompassTarget); target.getCenter(player::setCompassTarget);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("compass.compass_target"), TranslatableCaption.miniMessage("compass.compass_target"),
Template.of("target", target.toString()) Placeholder.miniMessage("target", target.toString())
); );
return true; return true;
} }

View File

@ -51,6 +51,7 @@ import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.File; import java.io.File;
@ -175,14 +176,14 @@ public class Template extends SubCommand {
if (args.length == 1) { if (args.length == 1) {
if (args[0].equalsIgnoreCase("export")) { if (args[0].equalsIgnoreCase("export")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template export <world>") Placeholder.miniMessage("value", "/plot template export <world>")
); );
return true; return true;
} else if (args[0].equalsIgnoreCase("import")) { } else if (args[0].equalsIgnoreCase("import")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template import <world> <template>") Placeholder.miniMessage("value", "/plot template import <world> <template>")
); );
return true; return true;
} }
@ -195,23 +196,23 @@ public class Template extends SubCommand {
case "import" -> { case "import" -> {
if (args.length != 3) { if (args.length != 3) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template import <world> <template>") Placeholder.miniMessage("value", "/plot template import <world> <template>")
); );
return false; return false;
} }
if (this.plotAreaManager.hasPlotArea(world)) { if (this.plotAreaManager.hasPlotArea(world)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("setup.setup_world_taken"), TranslatableCaption.miniMessage("setup.setup_world_taken"),
net.kyori.adventure.text.minimessage.Template.of("value", world) Placeholder.miniMessage("value", world)
); );
return false; return false;
} }
boolean result = extractAllFiles(world, args[2]); boolean result = extractAllFiles(world, args[2]);
if (!result) { if (!result) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("template.invalid_template"), TranslatableCaption.miniMessage("template.invalid_template"),
net.kyori.adventure.text.minimessage.Template.of("value", args[2]) Placeholder.miniMessage("value", args[2])
); );
return false; return false;
} }
@ -241,23 +242,23 @@ public class Template extends SubCommand {
this.setupUtils.setupWorld(builder); this.setupUtils.setupWorld(builder);
TaskManager.runTask(() -> { TaskManager.runTask(() -> {
player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND_TEMPLATE); player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND_TEMPLATE);
player.sendMessage(TranslatableCaption.of("setup.setup_finished")); player.sendMessage(TranslatableCaption.miniMessage("setup.setup_finished"));
}); });
return true; return true;
} }
case "export" -> { case "export" -> {
if (args.length != 2) { if (args.length != 2) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template export <world>") Placeholder.miniMessage("value", "/plot template export <world>")
); );
return false; return false;
} }
final PlotArea area = this.plotAreaManager.getPlotAreaByString(world); final PlotArea area = this.plotAreaManager.getPlotAreaByString(world);
if (area == null) { if (area == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.not_valid_plot_world"), TranslatableCaption.miniMessage("errors.not_valid_plot_world"),
net.kyori.adventure.text.minimessage.Template.of("value", args[1]) Placeholder.miniMessage("value", args[1])
); );
return false; return false;
} }
@ -268,12 +269,12 @@ public class Template extends SubCommand {
} catch (Exception e) { // Must recover from any exception thrown a third party template manager } catch (Exception e) { // Must recover from any exception thrown a third party template manager
e.printStackTrace(); e.printStackTrace();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("template.template_failed"), TranslatableCaption.miniMessage("template.template_failed"),
net.kyori.adventure.text.minimessage.Template.of("value", e.getMessage()) Placeholder.miniMessage("value", e.getMessage())
); );
return; return;
} }
player.sendMessage(TranslatableCaption.of("setup.setup_finished")); player.sendMessage(TranslatableCaption.miniMessage("setup.setup_finished"));
}); });
return true; return true;
} }

View File

@ -29,7 +29,7 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
@CommandDeclaration(command = "toggle", @CommandDeclaration(command = "toggle",
aliases = {"attribute"}, aliases = {"attribute"},
@ -53,13 +53,13 @@ public class Toggle extends Command {
) { ) {
if (toggle(player, "chatspy")) { if (toggle(player, "chatspy")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"), TranslatableCaption.miniMessage("toggle.toggle_disabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"), TranslatableCaption.miniMessage("toggle.toggle_enabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} }
} }
@ -74,13 +74,13 @@ public class Toggle extends Command {
) { ) {
if (toggle(player, "worldedit")) { if (toggle(player, "worldedit")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"), TranslatableCaption.miniMessage("toggle.toggle_disabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"), TranslatableCaption.miniMessage("toggle.toggle_enabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} }
} }
@ -94,13 +94,13 @@ public class Toggle extends Command {
) { ) {
if (toggle(player, "chat")) { if (toggle(player, "chat")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"), TranslatableCaption.miniMessage("toggle.toggle_disabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"), TranslatableCaption.miniMessage("toggle.toggle_enabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} }
} }
@ -114,13 +114,13 @@ public class Toggle extends Command {
) { ) {
if (toggle(player, "ignoreExpireTask")) { if (toggle(player, "ignoreExpireTask")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"), TranslatableCaption.miniMessage("toggle.toggle_enabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"), TranslatableCaption.miniMessage("toggle.toggle_disabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} }
} }
@ -134,13 +134,13 @@ public class Toggle extends Command {
) { ) {
if (toggle(player, "disabletitles")) { if (toggle(player, "disabletitles")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"), TranslatableCaption.miniMessage("toggle.toggle_enabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"), TranslatableCaption.miniMessage("toggle.toggle_disabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} }
} }
@ -154,13 +154,13 @@ public class Toggle extends Command {
) { ) {
if (toggle(player, "disabletime")) { if (toggle(player, "disabletime")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"), TranslatableCaption.miniMessage("toggle.toggle_enabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"), TranslatableCaption.miniMessage("toggle.toggle_disabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} }
} }
@ -174,13 +174,13 @@ public class Toggle extends Command {
) { ) {
if (toggle(player, "debug")) { if (toggle(player, "debug")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"), TranslatableCaption.miniMessage("toggle.toggle_disabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"), TranslatableCaption.miniMessage("toggle.toggle_enabled"),
Template.of("setting", command.toString()) Placeholder.miniMessage("setting", command.toString())
); );
} }
player.refreshDebug(); player.refreshDebug();

View File

@ -97,7 +97,7 @@ public class Trim extends SubCommand {
if (result == null) { if (result == null) {
return false; return false;
} }
TranslatableCaption.of("trim.trim_starting"); TranslatableCaption.miniMessage("trim.trim_starting");
final List<Plot> plots = PlotQuery.newQuery().inWorld(world).asList(); final List<Plot> plots = PlotQuery.newQuery().inWorld(world).asList();
if (ExpireManager.IMP != null) { if (ExpireManager.IMP != null) {
plots.removeAll(ExpireManager.IMP.getPendingExpired()); plots.removeAll(ExpireManager.IMP.getPendingExpired());
@ -138,11 +138,11 @@ public class Trim extends SubCommand {
} }
final String world = args[0]; final String world = args[0];
if (!this.worldUtil.isWorld(world) || !this.plotAreaManager.hasPlotArea(world)) { if (!this.worldUtil.isWorld(world) || !this.plotAreaManager.hasPlotArea(world)) {
player.sendMessage(TranslatableCaption.of("errors.not_valid_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_valid_world"));
return false; return false;
} }
if (Trim.TASK) { if (Trim.TASK) {
player.sendMessage(TranslatableCaption.of("trim.trim_in_progress")); player.sendMessage(TranslatableCaption.miniMessage("trim.trim_in_progress"));
return false; return false;
} }
Trim.TASK = true; Trim.TASK = true;
@ -160,7 +160,7 @@ public class Trim extends SubCommand {
public void run() { public void run() {
if (nonViable.isEmpty()) { if (nonViable.isEmpty()) {
Trim.TASK = false; Trim.TASK = false;
player.sendMessage(TranslatableCaption.of("trim.trim_done")); player.sendMessage(TranslatableCaption.miniMessage("trim.trim_done"));
LOGGER.info("Trim done!"); LOGGER.info("Trim done!");
return; return;
} }
@ -211,7 +211,7 @@ public class Trim extends SubCommand {
} else { } else {
regenTask = () -> { regenTask = () -> {
Trim.TASK = false; Trim.TASK = false;
player.sendMessage(TranslatableCaption.of("trim.trim_done")); player.sendMessage(TranslatableCaption.miniMessage("trim.trim_done"));
LOGGER.info("Trim done!"); LOGGER.info("Trim done!");
}; };
} }

View File

@ -27,7 +27,7 @@ package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.Placeholders;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.permissions.Permission; import com.plotsquared.core.permissions.Permission;
@ -39,7 +39,7 @@ import com.plotsquared.core.util.PlayerManager;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection; import java.util.Collection;
@ -72,35 +72,35 @@ public class Trust extends Command {
) throws CommandException { ) throws CommandException {
final Plot currentPlot = player.getCurrentPlot(); final Plot currentPlot = player.getCurrentPlot();
if (currentPlot == null) { if (currentPlot == null) {
throw new CommandException(TranslatableCaption.of("errors.not_in_plot")); throw new CommandException(TranslatableCaption.miniMessage("errors.not_in_plot"));
} }
checkTrue(currentPlot.hasOwner(), TranslatableCaption.of("info.plot_unowned")); checkTrue(currentPlot.hasOwner(), TranslatableCaption.miniMessage("info.plot_unowned"));
checkTrue( checkTrue(
currentPlot.isOwner(player.getUUID()) || Permissions currentPlot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST), .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST),
TranslatableCaption.of("permission.no_plot_perms") TranslatableCaption.miniMessage("permission.no_plot_perms")
); );
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"), checkTrue(args.length == 1, TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Templates.of("value", getUsage()) Placeholders.miniMessage("value", getUsage())
); );
final CompletableFuture<Boolean> future = new CompletableFuture<>(); final CompletableFuture<Boolean> future = new CompletableFuture<>();
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
if (throwable != null) { if (throwable != null) {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", args[0]) Placeholder.miniMessage("value", args[0])
); );
} }
future.completeExceptionally(throwable); future.completeExceptionally(throwable);
return; return;
} else { } else {
checkTrue(!uuids.isEmpty(), TranslatableCaption.of("errors.invalid_player"), checkTrue(!uuids.isEmpty(), TranslatableCaption.miniMessage("errors.invalid_player"),
Templates.of("value", args[0]) Placeholders.miniMessage("value", args[0])
); );
Iterator<UUID> iterator = uuids.iterator(); Iterator<UUID> iterator = uuids.iterator();
@ -111,24 +111,24 @@ public class Trust extends Command {
Permissions.hasPermission(player, Permission.PERMISSION_TRUST_EVERYONE) || Permissions Permissions.hasPermission(player, Permission.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", PlayerManager.getName(uuid)) Placeholder.miniMessage("value", PlayerManager.getName(uuid))
); );
iterator.remove(); iterator.remove();
continue; continue;
} }
if (currentPlot.isOwner(uuid)) { if (currentPlot.isOwner(uuid)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("member.already_added"), TranslatableCaption.miniMessage("member.already_added"),
Template.of("value", PlayerManager.getName(uuid)) Placeholder.miniMessage("value", PlayerManager.getName(uuid))
); );
iterator.remove(); iterator.remove();
continue; continue;
} }
if (currentPlot.getTrusted().contains(uuid)) { if (currentPlot.getTrusted().contains(uuid)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("member.already_added"), TranslatableCaption.miniMessage("member.already_added"),
Template.of("value", PlayerManager.getName(uuid)) Placeholder.miniMessage("value", PlayerManager.getName(uuid))
); );
iterator.remove(); iterator.remove();
continue; continue;
@ -140,8 +140,8 @@ public class Trust extends Command {
int maxTrustSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_TRUST, Settings.Limit.MAX_PLOTS); int maxTrustSize = Permissions.hasPermissionRange(player, Permission.PERMISSION_TRUST, Settings.Limit.MAX_PLOTS);
if (localTrustSize >= maxTrustSize) { if (localTrustSize >= maxTrustSize) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("members.plot_max_members_trusted"), TranslatableCaption.miniMessage("members.plot_max_members_trusted"),
Template.of("amount", String.valueOf(localTrustSize)) Placeholder.miniMessage("amount", String.valueOf(localTrustSize))
); );
return; return;
} }
@ -157,7 +157,7 @@ public class Trust extends Command {
} }
currentPlot.addTrusted(uuid); currentPlot.addTrusted(uuid);
this.eventDispatcher.callTrusted(player, currentPlot, uuid, true); this.eventDispatcher.callTrusted(player, currentPlot, uuid, true);
player.sendMessage(TranslatableCaption.of("trusted.trusted_added")); player.sendMessage(TranslatableCaption.miniMessage("trusted.trusted_added"));
} }
}, null); }, null);
} }

View File

@ -37,7 +37,7 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@CommandDeclaration(command = "unlink", @CommandDeclaration(command = "unlink",
@ -60,19 +60,19 @@ public class Unlink extends SubCommand {
Location location = player.getLocation(); Location location = player.getLocation();
final Plot plot = location.getPlotAbs(); final Plot plot = location.getPlotAbs();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return false; return false;
} }
if (plot.getVolume() > Integer.MAX_VALUE) { if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return false; return false;
} }
if (!plot.isMerged()) { if (!plot.isMerged()) {
player.sendMessage(TranslatableCaption.of("merge.unlink_impossible")); player.sendMessage(TranslatableCaption.miniMessage("merge.unlink_impossible"));
return false; return false;
} }
final boolean createRoad; final boolean createRoad;
@ -92,23 +92,23 @@ public class Unlink extends SubCommand {
); );
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Unlink") Placeholder.miniMessage("value", "Unlink")
); );
return true; return true;
} }
boolean force = event.getEventResult() == Result.FORCE; boolean force = event.getEventResult() == Result.FORCE;
if (!force && !plot.isOwner(player.getUUID()) && !Permissions if (!force && !plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_UNLINK)) { .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_UNLINK)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return true; return true;
} }
Runnable runnable = () -> { Runnable runnable = () -> {
if (!plot.getPlotModificationManager().unlinkPlot(createRoad, createRoad)) { if (!plot.getPlotModificationManager().unlinkPlot(createRoad, createRoad)) {
player.sendMessage(TranslatableCaption.of("merge.unmerge_cancelled")); player.sendMessage(TranslatableCaption.miniMessage("merge.unmerge_cancelled"));
return; return;
} }
player.sendMessage(TranslatableCaption.of("merge.unlink_success")); player.sendMessage(TranslatableCaption.miniMessage("merge.unlink_success"));
eventDispatcher.callPostUnlink(plot, PlotUnlinkEvent.REASON.PLAYER_COMMAND); eventDispatcher.callPostUnlink(plot, PlotUnlinkEvent.REASON.PLAYER_COMMAND);
}; };
if (hasConfirmation(player)) { if (hasConfirmation(player)) {

View File

@ -28,7 +28,7 @@ package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.Placeholders;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.events.TeleportCause; import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.permissions.Permission; import com.plotsquared.core.permissions.Permission;
@ -45,7 +45,7 @@ import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.query.SortingStrategy; import com.plotsquared.core.util.query.SortingStrategy;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
@ -102,13 +102,13 @@ public class Visit extends Command {
final List<Plot> plots = query.asList(); final List<Plot> plots = query.asList();
if (plots.isEmpty()) { if (plots.isEmpty()) {
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots")); player.sendMessage(TranslatableCaption.miniMessage("invalid.found_no_plots"));
return; return;
} else if (plots.size() < page || page < 1) { } else if (plots.size() < page || page < 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.number_not_in_range"), TranslatableCaption.miniMessage("invalid.number_not_in_range"),
Template.of("min", "1"), Placeholder.miniMessage("min", "1"),
Template.of("max", String.valueOf(plots.size())) Placeholder.miniMessage("max", String.valueOf(plots.size()))
); );
return; return;
} }
@ -117,8 +117,8 @@ public class Visit extends Command {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_UNOWNED)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_UNOWNED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.visit.unowned") Placeholders.miniMessage("node", "plots.visit.unowned")
); );
return; return;
} }
@ -126,16 +126,16 @@ public class Visit extends Command {
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OWNED) && !Permissions if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OWNED) && !Permissions
.hasPermission(player, Permission.PERMISSION_HOME)) { .hasPermission(player, Permission.PERMISSION_HOME)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.visit.owned") Placeholders.miniMessage("node", "plots.visit.owned")
); );
return; return;
} }
} else if (plot.isAdded(player.getUUID())) { } else if (plot.isAdded(player.getUUID())) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_SHARED)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_SHARED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.visit.shared") Placeholders.miniMessage("node", "plots.visit.shared")
); );
return; return;
} }
@ -145,16 +145,16 @@ public class Visit extends Command {
if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER) if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER)
&& !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) { && !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Templates.of("node", "plots.visit.other") Placeholders.miniMessage("node", "plots.visit.other")
); );
return; return;
} }
if (plot.isDenied(player.getUUID())) { if (plot.isDenied(player.getUUID())) {
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) { if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.miniMessage("permission.no_permission"),
Template.of("node", String.valueOf(Permission.PERMISSION_VISIT_DENIED)) Placeholder.miniMessage("node", String.valueOf(Permission.PERMISSION_VISIT_DENIED))
); );
return; return;
} }
@ -195,12 +195,12 @@ public class Visit extends Command {
case 3: case 3:
if (!MathMan.isInteger(args[2])) { if (!MathMan.isInteger(args[2])) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_valid_number"), TranslatableCaption.miniMessage("invalid.not_valid_number"),
Templates.of("value", "(1, ∞)") Placeholders.miniMessage("value", "(1, ∞)")
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Templates.of("value", getUsage()) Placeholders.miniMessage("value", getUsage())
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
@ -212,12 +212,12 @@ public class Visit extends Command {
sortByArea = this.plotAreaManager.getPlotAreaByString(args[1]); sortByArea = this.plotAreaManager.getPlotAreaByString(args[1]);
if (sortByArea == null) { if (sortByArea == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_valid_number"), TranslatableCaption.miniMessage("invalid.not_valid_number"),
Templates.of("value", "(1, ∞)") Placeholders.miniMessage("value", "(1, ∞)")
); );
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Templates.of("value", getUsage()) Placeholders.miniMessage("value", getUsage())
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
@ -226,11 +226,11 @@ public class Visit extends Command {
int finalPage1 = page; int finalPage1 = page;
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (throwable != null || uuids.size() != 1) { } else if (throwable != null || uuids.size() != 1) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Templates.of("value", getUsage()) Placeholders.miniMessage("value", getUsage())
); );
} else { } else {
final UUID uuid = uuids.toArray(new UUID[0])[0]; final UUID uuid = uuids.toArray(new UUID[0])[0];
@ -256,8 +256,8 @@ public class Visit extends Command {
page = Integer.parseInt(args[1]); page = Integer.parseInt(args[1]);
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("invalid.not_a_number"), TranslatableCaption.miniMessage("invalid.not_a_number"),
Template.of("value", args[1]) Placeholder.miniMessage("value", args[1])
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
@ -272,10 +272,10 @@ public class Visit extends Command {
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(args[0], (uuid, throwable) -> { PlotSquared.get().getImpromptuUUIDPipeline().getSingle(args[0], (uuid, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
// The request timed out // The request timed out
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); player.sendMessage(TranslatableCaption.miniMessage("players.fetching_players_timeout"));
} else if (uuid != null && !PlotQuery.newQuery().ownedBy(uuid).anyMatch()) { } else if (uuid != null && !PlotQuery.newQuery().ownedBy(uuid).anyMatch()) {
// It was a valid UUID but the player has no plots // It was a valid UUID but the player has no plots
player.sendMessage(TranslatableCaption.of("errors.player_no_plots")); player.sendMessage(TranslatableCaption.miniMessage("errors.player_no_plots"));
} else if (uuid == null) { } else if (uuid == null) {
// player not found, so we assume it's an alias if no page was provided // player not found, so we assume it's an alias if no page was provided
if (finalPage == Integer.MIN_VALUE) { if (finalPage == Integer.MIN_VALUE) {
@ -289,8 +289,8 @@ public class Visit extends Command {
); );
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("errors.invalid_player"), TranslatableCaption.miniMessage("errors.invalid_player"),
Template.of("value", finalArgs[0]) Placeholder.miniMessage("value", finalArgs[0])
); );
} }
} else { } else {
@ -315,8 +315,8 @@ public class Visit extends Command {
case 0: case 0:
// /p v is invalid // /p v is invalid
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.miniMessage("commandconfig.command_syntax"),
Templates.of("value", getUsage()) Placeholders.miniMessage("value", getUsage())
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
default: default:

View File

@ -46,7 +46,8 @@ import com.plotsquared.core.util.Permissions;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.item.ItemTypes;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@ -154,19 +155,19 @@ public class ComponentPresetManager {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); player.sendMessage(TranslatableCaption.miniMessage("errors.not_in_plot"));
return null; return null;
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned")); player.sendMessage(TranslatableCaption.miniMessage("info.plot_unowned"));
return null; return null;
} else if (!plot.isOwner(player.getUUID()) && !plot.getTrusted().contains(player.getUUID()) && !Permissions.hasPermission( } else if (!plot.isOwner(player.getUUID()) && !plot.getTrusted().contains(player.getUUID()) && !Permissions.hasPermission(
player, player,
Permission.PERMISSION_ADMIN_COMPONENTS_OTHER Permission.PERMISSION_ADMIN_COMPONENTS_OTHER
)) { )) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); player.sendMessage(TranslatableCaption.miniMessage("permission.no_plot_perms"));
return null; return null;
} else if (plot.getVolume() > Integer.MAX_VALUE) { } else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_too_large"));
return null; return null;
} }
@ -182,7 +183,7 @@ public class ComponentPresetManager {
} }
final int size = (int) Math.ceil((double) allowedPresets.size() / 9.0D); final int size = (int) Math.ceil((double) allowedPresets.size() / 9.0D);
final PlotInventory plotInventory = new PlotInventory(this.inventoryUtil, player, size, final PlotInventory plotInventory = new PlotInventory(this.inventoryUtil, player, size,
TranslatableCaption.of("preset.title").getComponent(player)) { TranslatableCaption.miniMessage("preset.title").getComponent(player)) {
@Override @Override
public boolean onClick(final int index) { public boolean onClick(final int index) {
if (!getPlayer().getCurrentPlot().equals(plot)) { if (!getPlayer().getCurrentPlot().equals(plot)) {
@ -199,25 +200,25 @@ public class ComponentPresetManager {
} }
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
getPlayer().sendMessage(TranslatableCaption.of("errors.wait_for_timer")); getPlayer().sendMessage(TranslatableCaption.miniMessage("errors.wait_for_timer"));
return false; return false;
} }
final Pattern pattern = PatternUtil.parse(null, componentPreset.getPattern(), false); final Pattern pattern = PatternUtil.parse(null, componentPreset.getPattern(), false);
if (pattern == null) { if (pattern == null) {
getPlayer().sendMessage(TranslatableCaption.of("preset.preset_invalid")); getPlayer().sendMessage(TranslatableCaption.miniMessage("preset.preset_invalid"));
return false; return false;
} }
if (componentPreset.getCost() > 0.0D && econHandler.isEnabled(plot.getArea())) { if (componentPreset.getCost() > 0.0D && econHandler.isEnabled(plot.getArea())) {
if (econHandler.getMoney(getPlayer()) < componentPreset.getCost()) { if (econHandler.getMoney(getPlayer()) < componentPreset.getCost()) {
getPlayer().sendMessage(TranslatableCaption.of("preset.preset_cannot_afford")); getPlayer().sendMessage(TranslatableCaption.miniMessage("preset.preset_cannot_afford"));
return false; return false;
} else { } else {
econHandler.withdrawMoney(getPlayer(), componentPreset.getCost()); econHandler.withdrawMoney(getPlayer(), componentPreset.getCost());
getPlayer().sendMessage( getPlayer().sendMessage(
TranslatableCaption.of("economy.removed_balance"), TranslatableCaption.miniMessage("economy.removed_balance"),
Template.of("money", econHandler.format(componentPreset.getCost())) Placeholder.miniMessage("money", econHandler.format(componentPreset.getCost()))
); );
} }
} }
@ -235,7 +236,7 @@ public class ComponentPresetManager {
); );
} }
queue.enqueue(); queue.enqueue();
getPlayer().sendMessage(TranslatableCaption.of("working.generating_component")); getPlayer().sendMessage(TranslatableCaption.miniMessage("working.generating_component"));
}); });
return false; return false;
} }
@ -246,15 +247,17 @@ public class ComponentPresetManager {
final ComponentPreset preset = allowedPresets.get(i); final ComponentPreset preset = allowedPresets.get(i);
final List<String> lore = new ArrayList<>(); final List<String> lore = new ArrayList<>();
if (preset.getCost() > 0 && this.econHandler.isEnabled(plot.getArea())) { if (preset.getCost() > 0 && this.econHandler.isEnabled(plot.getArea())) {
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse( lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.deserialize(
TranslatableCaption.of("preset.preset_lore_cost").getComponent(player), TranslatableCaption.miniMessage("preset.preset_lore_cost").getComponent(player),
Template.of("cost", String.format("%.2f", preset.getCost())) PlaceholderResolver.placeholders(Placeholder.miniMessage("cost", String.format("%.2f", preset.getCost())))
))); )));
} }
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse( lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.deserialize(
TranslatableCaption.of("preset.preset_lore_component").getComponent(player), TranslatableCaption.miniMessage("preset.preset_lore_component").getComponent(player),
Template.of("component", preset.getComponent().name().toLowerCase()), PlaceholderResolver.placeholders(
Template.of("prefix", TranslatableCaption.of("core.prefix").getComponent(player)) Placeholder.miniMessage("component", preset.getComponent().name().toLowerCase()),
Placeholder.miniMessage("prefix", TranslatableCaption.miniMessage("core.prefix").getComponent(player))
)
))); )));
lore.removeIf(String::isEmpty); lore.removeIf(String::isEmpty);
lore.addAll(preset.getDescription()); lore.addAll(preset.getDescription());

View File

@ -25,12 +25,12 @@
*/ */
package com.plotsquared.core.configuration.caption; package com.plotsquared.core.configuration.caption;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
public class CaptionHolder { public class CaptionHolder {
private Caption caption = StaticCaption.of(""); private Caption caption = StaticCaption.of("");
private Template[] templates = new Template[0]; private Placeholder<?>[] placeholders = new Placeholder[0];
public void set(Caption caption) { public void set(Caption caption) {
this.caption = caption; this.caption = caption;
@ -40,12 +40,12 @@ public class CaptionHolder {
return this.caption; return this.caption;
} }
public Template[] getTemplates() { public Placeholder<?>[] getPlaceholders() {
return this.templates; return this.placeholders;
} }
public void setTemplates(Template... templates) { public void setPlaceholders(Placeholder<?>... placeholders) {
this.templates = templates; this.placeholders = placeholders;
} }
} }

View File

@ -61,6 +61,7 @@ public class CaptionUtility {
) )
); );
private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
/** /**
* Format a chat message but keep the formatting keys * Format a chat message but keep the formatting keys
@ -106,9 +107,9 @@ public class CaptionUtility {
*/ */
public static String stripClickEvents(final @NonNull String miniMessageString) { public static String stripClickEvents(final @NonNull String miniMessageString) {
// parse, transform and serialize again // parse, transform and serialize again
Component component = MiniMessage.get().parse(miniMessageString); Component component = MINI_MESSAGE.deserialize(miniMessageString);
component = CLICK_STRIP_TRANSFORM.transform(component); component = CLICK_STRIP_TRANSFORM.transform(component);
return MiniMessage.get().serialize(component); return MINI_MESSAGE.serialize(component);
} }
/** /**

View File

@ -28,83 +28,90 @@ package com.plotsquared.core.configuration.caption;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.util.PlayerManager; import com.plotsquared.core.util.PlayerManager;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID; import java.util.UUID;
/** /**
* Utility class that generates {@link net.kyori.adventure.text.minimessage.Template templates} * Utility class that generates {@link net.kyori.adventure.text.minimessage.placeholder.Placeholder placeholder}
*/ */
public final class Templates { public final class Placeholders {
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build(); private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
private Templates() { private Placeholders() {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"This is a utility class and cannot be instantiated"); "This is a utility class and cannot be instantiated");
} }
/** /**
* Create a {@link net.kyori.adventure.text.minimessage.Template} from a PlotSquared {@link Caption} * Create a {@link net.kyori.adventure.text.minimessage.placeholder.Placeholder} from a PlotSquared {@link Caption}
* *
* @param localeHolder Locale holder * @param localeHolder Locale holder
* @param key Template key * @param key Template key
* @param caption Caption object * @param caption Caption object
* @param replacements Replacements * @param replacements Replacements
* @return Generated template * @return Generated template
* @since 6.3.0
*/ */
public static @NonNull Template of( public static @NonNull Placeholder<?> miniMessage(
final @NonNull LocaleHolder localeHolder, final @NonNull LocaleHolder localeHolder,
final @NonNull String key, final @NonNull Caption caption, final @NonNull String key, final @NonNull Caption caption,
final @NonNull Template... replacements final @NonNull Placeholder<?>... replacements
) { ) {
return Template.of(key, MINI_MESSAGE.parse(caption.getComponent(localeHolder), replacements)); return Placeholder.miniMessage(key, MINI_MESSAGE.deserialize(caption.getComponent(localeHolder),
PlaceholderResolver.placeholders(replacements)).toString());
} }
/** /**
* Create a {@link Template} from a username (using UUID mappings) * Create a {@link net.kyori.adventure.text.minimessage.placeholder.Placeholder} from a username (using UUID mappings)
* *
* @param key Template key * @param key Template key
* @param uuid Player UUID * @param uuid Player UUID
* @return Generated template * @return Generated template
* @since 6.3.0
*/ */
public static @NonNull Template of(final @NonNull String key, final @NonNull UUID uuid) { public static @NonNull Placeholder<?> miniMessage(final @NonNull String key, final @NonNull UUID uuid) {
final String username = PlayerManager.getName(uuid); final String username = PlayerManager.getName(uuid);
return Template.of(key, username); return Placeholder.miniMessage(key, username);
} }
/** /**
* Create a {@link Template} from a string * Create a {@link net.kyori.adventure.text.minimessage.placeholder.Placeholder} from a string
* *
* @param key Template key * @param key Template key
* @param value Template value * @param value Template value
* @return Generated template * @return Generated template
* @since 6.3.0
*/ */
public static @NonNull Template of(final @NonNull String key, final @NonNull String value) { public static @NonNull Placeholder<?> miniMessage(final @NonNull String key, final @NonNull String value) {
return Template.of(key, value); return Placeholder.miniMessage(key, value);
} }
/** /**
* Create a {@link Template} from a plot area * Create a {@link net.kyori.adventure.text.minimessage.placeholder.Placeholder} from a plot area
* *
* @param key Template Key * @param key Template Key
* @param area Plot area * @param area Plot area
* @return Generated template * @return Generated template
* @since 6.3.0
*/ */
public static @NonNull Template of(final @NonNull String key, final @NonNull PlotArea area) { public static @NonNull Placeholder<?> miniMessage(final @NonNull String key, final @NonNull PlotArea area) {
return Template.of(key, area.toString()); return Placeholder.miniMessage(key, area.toString());
} }
/** /**
* Create a {@link Template} from a number * Create a {@link net.kyori.adventure.text.minimessage.placeholder.Placeholder} from a number
* *
* @param key Template key * @param key Template key
* @param number Number * @param number Number
* @return Generated template * @return Generated template
* @since 6.3.0
*/ */
public static @NonNull Template of(final @NonNull String key, final @NonNull Number number) { public static @NonNull Placeholder<?> miniMessage(final @NonNull String key, final @NonNull Number number) {
return Template.of(key, number.toString()); return Placeholder.miniMessage(key, number.toString());
} }
} }

View File

@ -56,7 +56,9 @@ public final class TranslatableCaption implements NamespacedCaption {
* @param rawKey Caption key in the format namespace:key. If no namespace is * @param rawKey Caption key in the format namespace:key. If no namespace is
* included, {@link #DEFAULT_NAMESPACE} will be used. * included, {@link #DEFAULT_NAMESPACE} will be used.
* @return Caption instance * @return Caption instance
* @deprecated Use {@link #miniMessage(String)} instead
*/ */
@Deprecated(forRemoval = true, since = "6.3.0")
public static @NonNull TranslatableCaption of(final @NonNull String rawKey) { public static @NonNull TranslatableCaption of(final @NonNull String rawKey) {
final String namespace; final String namespace;
final String key; final String key;
@ -74,13 +76,40 @@ public final class TranslatableCaption implements NamespacedCaption {
); );
} }
/**
* Get a new {@link TranslatableCaption} instance
*
* @param rawKey Caption key in the format namespace:key. If no namespace is
* included, {@link #DEFAULT_NAMESPACE} will be used.
* @return Caption instance
* @since 6.3.0
*/
public static @NonNull TranslatableCaption miniMessage(final @NonNull String rawKey) {
final String namespace;
final String key;
if (rawKey.contains(":")) {
final String[] split = rawKey.split(Pattern.quote(":"));
namespace = split[0];
key = split[1];
} else {
namespace = DEFAULT_NAMESPACE;
key = rawKey;
}
return new TranslatableCaption(
namespace.toLowerCase(Locale.ENGLISH),
key.toLowerCase(Locale.ENGLISH)
);
}
/** /**
* Get a new {@link TranslatableCaption} instance * Get a new {@link TranslatableCaption} instance
* *
* @param namespace Caption namespace * @param namespace Caption namespace
* @param key Caption key * @param key Caption key
* @return Caption instance * @return Caption instance
* @deprecated Use {@link #miniMessage(String)} instead
*/ */
@Deprecated(forRemoval = true, since = "6.3.0")
public static @NonNull TranslatableCaption of( public static @NonNull TranslatableCaption of(
final @NonNull String namespace, final @NonNull String namespace,
final @NonNull String key final @NonNull String key
@ -91,6 +120,24 @@ public final class TranslatableCaption implements NamespacedCaption {
); );
} }
/**
* Get a new {@link TranslatableCaption} instance
*
* @param namespace Caption namespace
* @param key Caption key
* @return Caption instance
* @since 6.3.0
*/
public static @NonNull TranslatableCaption miniMessage(
final @NonNull String namespace,
final @NonNull String key
) {
return new TranslatableCaption(
namespace.toLowerCase(Locale.ENGLISH),
key.toLowerCase(Locale.ENGLISH)
);
}
@Override @Override
public @NonNull String getComponent(final @NonNull LocaleHolder localeHolder) { public @NonNull String getComponent(final @NonNull LocaleHolder localeHolder) {
return PlotSquared.get().getCaptionMap(this.namespace).getMessage(this, localeHolder); return PlotSquared.get().getCaptionMap(this.namespace).getMessage(this, localeHolder);

View File

@ -214,7 +214,7 @@ public final class CaptionLoader {
} }
return new LocalizedCaptionMap(locale, map.entrySet().stream() return new LocalizedCaptionMap(locale, map.entrySet().stream()
.collect(Collectors.toMap( .collect(Collectors.toMap(
entry -> TranslatableCaption.of(this.namespace, entry.getKey()), entry -> TranslatableCaption.miniMessage(this.namespace, entry.getKey()),
Map.Entry::getValue Map.Entry::getValue
) )
)); ));

View File

@ -77,43 +77,43 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
@Override @Override
public ConfigurationNode[] getSettingNodes() { public ConfigurationNode[] getSettingNodes() {
return new ConfigurationNode[]{ return new ConfigurationNode[]{
new ConfigurationNode("plot.height", this.PLOT_HEIGHT, TranslatableCaption.of("setup.plot_height"), new ConfigurationNode("plot.height", this.PLOT_HEIGHT, TranslatableCaption.miniMessage("setup.plot_height"),
ConfigurationUtil.INTEGER ConfigurationUtil.INTEGER
), ),
new ConfigurationNode("plot.size", this.PLOT_WIDTH, TranslatableCaption.of("setup.plot_width"), new ConfigurationNode("plot.size", this.PLOT_WIDTH, TranslatableCaption.miniMessage("setup.plot_width"),
ConfigurationUtil.INTEGER ConfigurationUtil.INTEGER
), ),
new ConfigurationNode("plot.filling", this.MAIN_BLOCK, TranslatableCaption.of("setup.plot_block"), new ConfigurationNode("plot.filling", this.MAIN_BLOCK, TranslatableCaption.miniMessage("setup.plot_block"),
ConfigurationUtil.BLOCK_BUCKET ConfigurationUtil.BLOCK_BUCKET
), ),
new ConfigurationNode("wall.place_top_block", this.PLACE_TOP_BLOCK, new ConfigurationNode("wall.place_top_block", this.PLACE_TOP_BLOCK,
TranslatableCaption.of("setup.top_block_boolean"), ConfigurationUtil.BOOLEAN TranslatableCaption.miniMessage("setup.top_block_boolean"), ConfigurationUtil.BOOLEAN
), ),
new ConfigurationNode("plot.floor", this.TOP_BLOCK, TranslatableCaption.of("setup.plot_block_floor"), new ConfigurationNode("plot.floor", this.TOP_BLOCK, TranslatableCaption.miniMessage("setup.plot_block_floor"),
ConfigurationUtil.BLOCK_BUCKET ConfigurationUtil.BLOCK_BUCKET
), ),
new ConfigurationNode("wall.block", this.WALL_BLOCK, TranslatableCaption.of("setup.top_wall_block"), new ConfigurationNode("wall.block", this.WALL_BLOCK, TranslatableCaption.miniMessage("setup.top_wall_block"),
ConfigurationUtil.BLOCK_BUCKET ConfigurationUtil.BLOCK_BUCKET
), ),
new ConfigurationNode("wall.block_claimed", this.CLAIMED_WALL_BLOCK, new ConfigurationNode("wall.block_claimed", this.CLAIMED_WALL_BLOCK,
TranslatableCaption.of("setup.wall_block_claimed"), ConfigurationUtil.BLOCK_BUCKET TranslatableCaption.miniMessage("setup.wall_block_claimed"), ConfigurationUtil.BLOCK_BUCKET
), ),
new ConfigurationNode("road.width", this.ROAD_WIDTH, TranslatableCaption.of("setup.road_width"), new ConfigurationNode("road.width", this.ROAD_WIDTH, TranslatableCaption.miniMessage("setup.road_width"),
ConfigurationUtil.INTEGER ConfigurationUtil.INTEGER
), ),
new ConfigurationNode("road.height", this.ROAD_HEIGHT, TranslatableCaption.of("setup.road_height"), new ConfigurationNode("road.height", this.ROAD_HEIGHT, TranslatableCaption.miniMessage("setup.road_height"),
ConfigurationUtil.INTEGER ConfigurationUtil.INTEGER
), ),
new ConfigurationNode("road.block", this.ROAD_BLOCK, TranslatableCaption.of("setup.road_block"), new ConfigurationNode("road.block", this.ROAD_BLOCK, TranslatableCaption.miniMessage("setup.road_block"),
ConfigurationUtil.BLOCK_BUCKET ConfigurationUtil.BLOCK_BUCKET
), ),
new ConfigurationNode("wall.filling", this.WALL_FILLING, TranslatableCaption.of("setup.wall_filling_block"), new ConfigurationNode("wall.filling", this.WALL_FILLING, TranslatableCaption.miniMessage("setup.wall_filling_block"),
ConfigurationUtil.BLOCK_BUCKET ConfigurationUtil.BLOCK_BUCKET
), ),
new ConfigurationNode("wall.height", this.WALL_HEIGHT, TranslatableCaption.of("setup.wall_height"), new ConfigurationNode("wall.height", this.WALL_HEIGHT, TranslatableCaption.miniMessage("setup.wall_height"),
ConfigurationUtil.INTEGER ConfigurationUtil.INTEGER
), ),
new ConfigurationNode("plot.bedrock", this.PLOT_BEDROCK, TranslatableCaption.of("setup.bedrock_boolean"), new ConfigurationNode("plot.bedrock", this.PLOT_BEDROCK, TranslatableCaption.miniMessage("setup.bedrock_boolean"),
ConfigurationUtil.BOOLEAN ConfigurationUtil.BOOLEAN
)}; )};
} }

View File

@ -73,7 +73,7 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.item.ItemTypes;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.HashMap; import java.util.HashMap;
@ -145,8 +145,8 @@ public class PlotListener {
if (plot.isDenied(player.getUUID()) && !Permissions if (plot.isDenied(player.getUUID()) && !Permissions
.hasPermission(player, "plots.admin.entry.denied")) { .hasPermission(player, "plots.admin.entry.denied")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("deny.no_enter"), TranslatableCaption.miniMessage("deny.no_enter"),
Template.of("plot", plot.toString()) Placeholder.miniMessage("plot", plot.toString())
); );
return false; return false;
} }
@ -175,19 +175,19 @@ public class PlotListener {
if (!greeting.isEmpty()) { if (!greeting.isEmpty()) {
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("flags.greeting_flag_format"), TranslatableCaption.miniMessage("flags.greeting_flag_format"),
Template.of("world", plot.getWorldName()), Placeholder.miniMessage("world", plot.getWorldName()),
Template.of("plot_id", plot.getId().toString()), Placeholder.miniMessage("plot_id", plot.getId().toString()),
Template.of("alias", plot.getAlias()), Placeholder.miniMessage("alias", plot.getAlias()),
Template.of("greeting", greeting) Placeholder.miniMessage("greeting", greeting)
); );
} else { } else {
player.sendActionBar( player.sendActionBar(
TranslatableCaption.of("flags.greeting_flag_format"), TranslatableCaption.miniMessage("flags.greeting_flag_format"),
Template.of("world", plot.getWorldName()), Placeholder.miniMessage("world", plot.getWorldName()),
Template.of("plot_id", plot.getId().toString()), Placeholder.miniMessage("plot_id", plot.getId().toString()),
Template.of("alias", plot.getAlias()), Placeholder.miniMessage("alias", plot.getAlias()),
Template.of("greeting", greeting) Placeholder.miniMessage("greeting", greeting)
); );
} }
} }
@ -197,9 +197,9 @@ public class PlotListener {
for (UUID uuid : plot.getOwners()) { for (UUID uuid : plot.getOwners()) {
final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
Caption caption = TranslatableCaption.of("notification.notify_enter"); Caption caption = TranslatableCaption.miniMessage("notification.notify_enter");
Template playerTemplate = Template.of("player", player.getName()); Placeholder<?> playerTemplate = Placeholder.miniMessage("player", player.getName());
Template plotTemplate = Template.of("plot", plot.getId().toString()); Placeholder<?> plotTemplate = Placeholder.miniMessage("plot", plot.getId().toString());
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
owner.sendMessage(caption, playerTemplate, plotTemplate); owner.sendMessage(caption, playerTemplate, plotTemplate);
} else { } else {
@ -231,9 +231,9 @@ public class PlotListener {
player.setGameMode(gameMode); player.setGameMode(gameMode);
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("gamemode.gamemode_was_bypassed"), TranslatableCaption.miniMessage("gamemode.gamemode_was_bypassed"),
Template.of("gamemode", String.valueOf(gameMode)), Placeholder.miniMessage("gamemode", String.valueOf(gameMode)),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
} }
} }
@ -246,9 +246,9 @@ public class PlotListener {
player.setGameMode(guestGameMode); player.setGameMode(guestGameMode);
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("gamemode.gamemode_was_bypassed"), TranslatableCaption.miniMessage("gamemode.gamemode_was_bypassed"),
Template.of("gamemode", String.valueOf(guestGameMode)), Placeholder.miniMessage("gamemode", String.valueOf(guestGameMode)),
Template.of("plot", plot.getId().toString()) Placeholder.miniMessage("plot", plot.getId().toString())
); );
} }
} }
@ -328,14 +328,14 @@ public class PlotListener {
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) { if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) {
final UUID plotOwner = plot.getOwnerAbs(); final UUID plotOwner = plot.getOwnerAbs();
String owner = PlayerManager.getName(plotOwner, false); String owner = PlayerManager.getName(plotOwner, false);
Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.of("titles" + Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.miniMessage("titles" +
".title_entered_plot"); ".title_entered_plot");
Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.of("titles" + Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.miniMessage("titles" +
".title_entered_plot_sub"); ".title_entered_plot_sub");
Template plotTemplate = Template.of("plot", lastPlot.getId().toString()); Placeholder<?> plotTemplate = Placeholder.miniMessage("plot", lastPlot.getId().toString());
Template worldTemplate = Template.of("world", player.getLocation().getWorldName()); Placeholder<?> worldTemplate = Placeholder.miniMessage("world", player.getLocation().getWorldName());
Template ownerTemplate = Template.of("owner", owner); Placeholder<?> ownerTemplate = Placeholder.miniMessage("owner", owner);
Template aliasTemplate = Template.of("alias", plot.getAlias()); Placeholder<?> aliasTemplate = Placeholder.miniMessage("alias", plot.getAlias());
final Consumer<String> userConsumer = user -> { final Consumer<String> userConsumer = user -> {
if (Settings.Titles.TITLES_AS_ACTIONBAR) { if (Settings.Titles.TITLES_AS_ACTIONBAR) {
@ -408,9 +408,9 @@ public class PlotListener {
player.setGameMode(pw.getGameMode()); player.setGameMode(pw.getGameMode());
} else { } else {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("gamemode.gamemode_was_bypassed"), TranslatableCaption.miniMessage("gamemode.gamemode_was_bypassed"),
Template.of("gamemode", pw.getGameMode().getName().toLowerCase()), Placeholder.miniMessage("gamemode", pw.getGameMode().getName().toLowerCase()),
Template.of("plot", plot.toString()) Placeholder.miniMessage("plot", plot.toString())
); );
} }
} }
@ -420,19 +420,19 @@ public class PlotListener {
if (!farewell.isEmpty()) { if (!farewell.isEmpty()) {
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("flags.farewell_flag_format"), TranslatableCaption.miniMessage("flags.farewell_flag_format"),
Template.of("world", plot.getWorldName()), Placeholder.miniMessage("world", plot.getWorldName()),
Template.of("plot_id", plot.getId().toString()), Placeholder.miniMessage("plot_id", plot.getId().toString()),
Template.of("alias", plot.getAlias()), Placeholder.miniMessage("alias", plot.getAlias()),
Template.of("farewell", farewell) Placeholder.miniMessage("farewell", farewell)
); );
} else { } else {
player.sendActionBar( player.sendActionBar(
TranslatableCaption.of("flags.farewell_flag_format"), TranslatableCaption.miniMessage("flags.farewell_flag_format"),
Template.of("world", plot.getWorldName()), Placeholder.miniMessage("world", plot.getWorldName()),
Template.of("plot_id", plot.getId().toString()), Placeholder.miniMessage("plot_id", plot.getId().toString()),
Template.of("alias", plot.getAlias()), Placeholder.miniMessage("alias", plot.getAlias()),
Template.of("farewell", farewell) Placeholder.miniMessage("farewell", farewell)
); );
} }
} }
@ -442,9 +442,9 @@ public class PlotListener {
for (UUID uuid : plot.getOwners()) { for (UUID uuid : plot.getOwners()) {
final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
Caption caption = TranslatableCaption.of("notification.notify_leave"); Caption caption = TranslatableCaption.miniMessage("notification.notify_leave");
Template playerTemplate = Template.of("player", player.getName()); Placeholder<?> playerTemplate = Placeholder.miniMessage("player", player.getName());
Template plotTemplate = Template.of("plot", plot.getId().toString()); Placeholder<?> plotTemplate = Placeholder.miniMessage("plot", plot.getId().toString());
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
owner.sendMessage(caption, playerTemplate, plotTemplate); owner.sendMessage(caption, playerTemplate, plotTemplate);
} else { } else {

View File

@ -45,7 +45,7 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.eventbus.EventHandler.Priority; import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.util.eventbus.Subscribe;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Set; import java.util.Set;
@ -97,8 +97,8 @@ public class WESubscriber {
if (mask.isEmpty()) { if (mask.isEmpty()) {
if (Permissions.hasPermission(plotPlayer, "plots.worldedit.bypass")) { if (Permissions.hasPermission(plotPlayer, "plots.worldedit.bypass")) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("worldedit.worldedit_bypass"), TranslatableCaption.miniMessage("worldedit.worldedit_bypass"),
Template.of("command", "/plot toggle worldedit") Placeholder.miniMessage("command", "/plot toggle worldedit")
); );
} }
if (this.plotAreaManager.hasPlotArea(world)) { if (this.plotAreaManager.hasPlotArea(world)) {

View File

@ -49,7 +49,8 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemType;
import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID; import java.util.UUID;
@ -117,7 +118,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
@Override @Override
public void sendTitle( public void sendTitle(
final @NonNull Caption title, final @NonNull Caption subtitle, final @NonNull Caption title, final @NonNull Caption subtitle,
final int fadeIn, final int stay, final int fadeOut, final @NonNull Template... replacements final int fadeIn, final int stay, final int fadeOut, final @NonNull Placeholder<?>... replacements
) { ) {
} }
@ -151,7 +152,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
@Override @Override
public void sendMessage( public void sendMessage(
final @NonNull Caption caption, final @NonNull Caption caption,
final @NonNull Template... replacements final @NonNull Placeholder<?>... replacements
) { ) {
String message = caption.getComponent(this); String message = caption.getComponent(this);
if (message.isEmpty()) { if (message.isEmpty()) {
@ -159,9 +160,10 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
} }
message = CaptionUtility.format(this, message) message = CaptionUtility.format(this, message)
.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&') .replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&')
.replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this)); .replace("<prefix>", TranslatableCaption.miniMessage("core.prefix").getComponent(this));
// Parse the message // Parse the message
PlotSquared.platform().consoleAudience().sendMessage(MINI_MESSAGE.parse(message, replacements)); PlotSquared.platform().consoleAudience().sendMessage(MINI_MESSAGE.deserialize(message,
PlaceholderResolver.placeholders(replacements)));
} }
@Override @Override

View File

@ -66,7 +66,8 @@ import com.sk89q.worldedit.world.item.ItemType;
import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import net.kyori.adventure.title.Title; import net.kyori.adventure.title.Title;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -714,7 +715,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
if (getMeta("teleportOnLogin", true)) { if (getMeta("teleportOnLogin", true)) {
teleport(location, TeleportCause.LOGIN); teleport(location, TeleportCause.LOGIN);
sendMessage( sendMessage(
TranslatableCaption.of("teleport.teleported_to_plot")); TranslatableCaption.miniMessage("teleport.teleported_to_plot"));
} }
}); });
} else if (!PlotSquared.get().isMainThread(Thread.currentThread())) { } else if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
@ -726,7 +727,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
if (plot.isLoaded()) { if (plot.isLoaded()) {
teleport(location, TeleportCause.LOGIN); teleport(location, TeleportCause.LOGIN);
sendMessage(TranslatableCaption sendMessage(TranslatableCaption
.of("teleport.teleported_to_plot")); .miniMessage("teleport.teleported_to_plot"));
} }
} }
}) })
@ -795,11 +796,10 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
final @NonNull MetaDataKey<T> key, final @NonNull MetaDataKey<T> key,
final @NonNull T value final @NonNull T value
) { ) {
final Object rawValue = value;
if (key.getType().getRawType().equals(Integer.class)) { if (key.getType().getRawType().equals(Integer.class)) {
this.setPersistentMeta(key.toString(), Ints.toByteArray((int) rawValue)); this.setPersistentMeta(key.toString(), Ints.toByteArray((int) (Object) value));
} else if (key.getType().getRawType().equals(Boolean.class)) { } else if (key.getType().getRawType().equals(Boolean.class)) {
this.setPersistentMeta(key.toString(), ByteArrayUtilities.booleanToBytes((boolean) rawValue)); this.setPersistentMeta(key.toString(), ByteArrayUtilities.booleanToBytes((boolean) (Object) value));
} else { } else {
throw new IllegalArgumentException(String.format("Unknown meta data type '%s'", key.getType())); throw new IllegalArgumentException(String.format("Unknown meta data type '%s'", key.getType()));
} }
@ -839,7 +839,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
*/ */
public void sendTitle( public void sendTitle(
final @NonNull Caption title, final @NonNull Caption subtitle, final @NonNull Caption title, final @NonNull Caption subtitle,
final @NonNull Template... replacements final @NonNull Placeholder<?>... replacements
) { ) {
sendTitle( sendTitle(
title, title,
@ -864,12 +864,14 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
public void sendTitle( public void sendTitle(
final @NonNull Caption title, final @NonNull Caption subtitle, final @NonNull Caption title, final @NonNull Caption subtitle,
final int fadeIn, final int stay, final int fadeOut, final int fadeIn, final int stay, final int fadeOut,
final @NonNull Template... replacements final @NonNull Placeholder<?>... replacements
) { ) {
final Component titleComponent = MiniMessage.get().parse(title.getComponent(this), replacements); final Component titleComponent = MiniMessage.miniMessage().deserialize(title.getComponent(this),
PlaceholderResolver.placeholders(replacements));
final Component subtitleComponent = final Component subtitleComponent =
MiniMessage.get().parse(subtitle.getComponent(this), replacements); MiniMessage.miniMessage().deserialize(subtitle.getComponent(this),
final Title.Times times = Title.Times.of( PlaceholderResolver.placeholders(replacements));
final Title.Times times = Title.Times.times(
Duration.of(Settings.Titles.TITLES_FADE_IN * 50L, ChronoUnit.MILLIS), Duration.of(Settings.Titles.TITLES_FADE_IN * 50L, ChronoUnit.MILLIS),
Duration.of(Settings.Titles.TITLES_STAY * 50L, ChronoUnit.MILLIS), Duration.of(Settings.Titles.TITLES_STAY * 50L, ChronoUnit.MILLIS),
Duration.of(Settings.Titles.TITLES_FADE_OUT * 50L, ChronoUnit.MILLIS) Duration.of(Settings.Titles.TITLES_FADE_OUT * 50L, ChronoUnit.MILLIS)
@ -886,7 +888,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
*/ */
public void sendActionBar( public void sendActionBar(
final @NonNull Caption caption, final @NonNull Caption caption,
final @NonNull Template... replacements final @NonNull Placeholder<?>... replacements
) { ) {
String message; String message;
try { try {
@ -903,17 +905,18 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
// Replace placeholders, etc // Replace placeholders, etc
message = CaptionUtility.format(this, message) message = CaptionUtility.format(this, message)
.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&') .replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&')
.replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this)); .replace("<prefix>", TranslatableCaption.miniMessage("core.prefix").getComponent(this));
final Component component = MiniMessage.get().parse(message, replacements); final Component component = MiniMessage.miniMessage().deserialize(message,
PlaceholderResolver.placeholders(replacements));
getAudience().sendActionBar(component); getAudience().sendActionBar(component);
} }
@Override @Override
public void sendMessage( public void sendMessage(
final @NonNull Caption caption, final @NonNull Caption caption,
final @NonNull Template... replacements final @NonNull Placeholder<?>... replacements
) { ) {
String message; String message;
try { try {
@ -930,9 +933,9 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
// Replace placeholders, etc // Replace placeholders, etc
message = CaptionUtility.format(this, message) message = CaptionUtility.format(this, message)
.replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&') .replace('\u2010', '%').replace('\u2020', '&').replace('\u2030', '&')
.replace("<prefix>", TranslatableCaption.of("core.prefix").getComponent(this)); .replace("<prefix>", TranslatableCaption.miniMessage("core.prefix").getComponent(this));
// Parse the message // Parse the message
final Component component = MiniMessage.get().parse(message, replacements); final Component component = MiniMessage.miniMessage().deserialize(message, PlaceholderResolver.placeholders(replacements));
if (!Objects.equal(component, this.getMeta("lastMessage")) if (!Objects.equal(component, this.getMeta("lastMessage"))
|| System.currentTimeMillis() - this.<Long>getMeta("lastMessageTime") > 5000) { || System.currentTimeMillis() - this.<Long>getMeta("lastMessageTime") > 5000) {
setMeta("lastMessage", component); setMeta("lastMessage", component);

View File

@ -79,7 +79,8 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@ -372,13 +373,13 @@ public class Plot {
} }
} }
if (message && player != null) { if (message && player != null) {
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id")); player.sendMessage(TranslatableCaption.miniMessage("invalid.not_valid_plot_id"));
} }
return null; return null;
} }
if (area == null) { if (area == null) {
if (message && player != null) { if (message && player != null) {
player.sendMessage(TranslatableCaption.of("errors.invalid_plot_world")); player.sendMessage(TranslatableCaption.miniMessage("errors.invalid_plot_world"));
} }
return null; return null;
} }
@ -1707,7 +1708,7 @@ public class Plot {
updateWorldBorder(); updateWorldBorder();
} }
this.getPlotModificationManager().setSign(player.getName()); this.getPlotModificationManager().setSign(player.getName());
player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("plot", this.getId().toString())); player.sendMessage(TranslatableCaption.miniMessage("working.claimed"), Placeholder.miniMessage("plot", this.getId().toString()));
if (teleport) { if (teleport) {
if (!auto && Settings.Teleport.ON_CLAIM) { if (!auto && Settings.Teleport.ON_CLAIM) {
teleportPlayer(player, TeleportCause.COMMAND_CLAIM, result -> { teleportPlayer(player, TeleportCause.COMMAND_CLAIM, result -> {
@ -1745,9 +1746,9 @@ public class Plot {
@Override @Override
public void run(Boolean value) { public void run(Boolean value) {
if (value) { if (value) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_paste_success"));
} else { } else {
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed")); player.sendMessage(TranslatableCaption.miniMessage("schematics.schematic_paste_failed"));
} }
} }
} }
@ -2574,9 +2575,9 @@ public class Plot {
if (players.isEmpty()) { if (players.isEmpty()) {
return; return;
} }
Caption caption = TranslatableCaption.of("debug.plot_debug"); Caption caption = TranslatableCaption.miniMessage("debug.plot_debug");
Template plotTemplate = Template.of("plot", this.toString()); Placeholder<?> plotTemplate = Placeholder.miniMessage("plot", this.toString());
Template messageTemplate = Template.of("message", message); Placeholder<?> messageTemplate = Placeholder.miniMessage("message", message);
for (final PlotPlayer<?> player : players) { for (final PlotPlayer<?> player : players) {
if (isOwner(player.getUUID()) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_DEBUG_OTHER)) { if (isOwner(player.getUUID()) || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_DEBUG_OTHER)) {
player.sendMessage(caption, plotTemplate, messageTemplate); player.sendMessage(caption, plotTemplate, messageTemplate);
@ -2608,8 +2609,8 @@ public class Plot {
Result result = this.eventDispatcher.callTeleport(player, player.getLocation(), plot, cause).getEventResult(); Result result = this.eventDispatcher.callTeleport(player, player.getLocation(), plot, cause).getEventResult();
if (result == Result.DENY) { if (result == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Teleport") Placeholder.miniMessage("value", "Teleport")
); );
resultConsumer.accept(false); resultConsumer.accept(false);
return; return;
@ -2617,14 +2618,14 @@ public class Plot {
final Consumer<Location> locationConsumer = location -> { final Consumer<Location> locationConsumer = location -> {
if (Settings.Teleport.DELAY == 0 || Permissions if (Settings.Teleport.DELAY == 0 || Permissions
.hasPermission(player, "plots.teleport.delay.bypass")) { .hasPermission(player, "plots.teleport.delay.bypass")) {
player.sendMessage(TranslatableCaption.of("teleport.teleported_to_plot")); player.sendMessage(TranslatableCaption.miniMessage("teleport.teleported_to_plot"));
player.teleport(location, cause); player.teleport(location, cause);
resultConsumer.accept(true); resultConsumer.accept(true);
return; return;
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("teleport.teleport_in_seconds"), TranslatableCaption.miniMessage("teleport.teleport_in_seconds"),
Template.of("amount", String.valueOf(Settings.Teleport.DELAY)) Placeholder.miniMessage("amount", String.valueOf(Settings.Teleport.DELAY))
); );
final String name = player.getName(); final String name = player.getName();
TaskManager.addToTeleportQueue(name); TaskManager.addToTeleportQueue(name);
@ -2633,7 +2634,7 @@ public class Plot {
return; return;
} }
try { try {
player.sendMessage(TranslatableCaption.of("teleport.teleported_to_plot")); player.sendMessage(TranslatableCaption.miniMessage("teleport.teleported_to_plot"));
player.teleport(location, cause); player.teleport(location, cause);
} catch (final Exception ignored) { } catch (final Exception ignored) {
} }
@ -2800,7 +2801,7 @@ public class Plot {
public CompletableFuture<Caption> format(final Caption iInfo, PlotPlayer<?> player, final boolean full) { public CompletableFuture<Caption> format(final Caption iInfo, PlotPlayer<?> player, final boolean full) {
final CompletableFuture<Caption> future = new CompletableFuture<>(); final CompletableFuture<Caption> future = new CompletableFuture<>();
int num = this.getConnectedPlots().size(); int num = this.getConnectedPlots().size();
String alias = !this.getAlias().isEmpty() ? this.getAlias() : TranslatableCaption.of("info.none").getComponent(player); String alias = !this.getAlias().isEmpty() ? this.getAlias() : TranslatableCaption.miniMessage("info.none").getComponent(player);
Location bot = this.getCorners()[0]; Location bot = this.getCorners()[0];
PlotSquared.platform().worldUtil().getBiome( PlotSquared.platform().worldUtil().getBiome(
Objects.requireNonNull(this.getWorldName()), Objects.requireNonNull(this.getWorldName()),
@ -2813,28 +2814,28 @@ public class Plot {
String seen; String seen;
if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) { if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) {
if (this.isOnline()) { if (this.isOnline()) {
seen = TranslatableCaption.of("info.now").getComponent(player); seen = TranslatableCaption.miniMessage("info.now").getComponent(player);
} else { } else {
int time = (int) (ExpireManager.IMP.getAge(this) / 1000); int time = (int) (ExpireManager.IMP.getAge(this) / 1000);
if (time != 0) { if (time != 0) {
seen = TimeUtil.secToTime(time); seen = TimeUtil.secToTime(time);
} else { } else {
seen = TranslatableCaption.of("info.known").getComponent(player); seen = TranslatableCaption.miniMessage("info.known").getComponent(player);
} }
} }
} else { } else {
seen = TranslatableCaption.of("info.never").getComponent(player); seen = TranslatableCaption.miniMessage("info.never").getComponent(player);
} }
String description = this.getFlag(DescriptionFlag.class); String description = this.getFlag(DescriptionFlag.class);
if (description.isEmpty()) { if (description.isEmpty()) {
description = TranslatableCaption.of("info.plot_no_description").getComponent(player); description = TranslatableCaption.miniMessage("info.plot_no_description").getComponent(player);
} }
Component flags; Component flags;
Collection<PlotFlag<?, ?>> flagCollection = this.getApplicableFlags(true); Collection<PlotFlag<?, ?>> flagCollection = this.getApplicableFlags(true);
if (flagCollection.isEmpty()) { if (flagCollection.isEmpty()) {
flags = MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(player)); flags = MINI_MESSAGE.parse(TranslatableCaption.miniMessage("info.none").getComponent(player));
} else { } else {
TextComponent.Builder flagBuilder = Component.text(); TextComponent.Builder flagBuilder = Component.text();
String prefix = " "; String prefix = " ";
@ -2845,13 +2846,15 @@ public class Plot {
} else { } else {
value = flag.toString(); value = flag.toString();
} }
Component snip = MINI_MESSAGE.parse( Component snip = MINI_MESSAGE.deserialize(
prefix + CaptionUtility.format( prefix + CaptionUtility.format(
player, player,
TranslatableCaption.of("info.plot_flag_list").getComponent(player) TranslatableCaption.miniMessage("info.plot_flag_list").getComponent(player)
), ),
Template.of("flag", flag.getName()), PlaceholderResolver.placeholders(
Template.of("value", CaptionUtility.formatRaw(player, value.toString())) Placeholder.miniMessage("flag", flag.getName()),
Placeholder.miniMessage("value", CaptionUtility.formatRaw(player, value.toString()))
)
); );
flagBuilder.append(snip); flagBuilder.append(snip);
prefix = ", "; prefix = ", ";
@ -2864,56 +2867,56 @@ public class Plot {
owner = Component.text("unowned"); owner = Component.text("unowned");
} else if (this.getOwner().equals(DBFunc.SERVER)) { } else if (this.getOwner().equals(DBFunc.SERVER)) {
owner = Component.text(MINI_MESSAGE.stripTokens(TranslatableCaption owner = Component.text(MINI_MESSAGE.stripTokens(TranslatableCaption
.of("info.server") .miniMessage("info.server")
.getComponent(player))); .getComponent(player)));
} else { } else {
owner = PlayerManager.getPlayerList(this.getOwners(), player); owner = PlayerManager.getPlayerList(this.getOwners(), player);
} }
Template headerTemplate = Template.of( Placeholder<?> headerTemplate = Placeholder.miniMessage(
"header", "header",
TranslatableCaption.of("info.plot_info_header").getComponent(player) TranslatableCaption.miniMessage("info.plot_info_header").getComponent(player)
); );
Template footerTemplate = Template.of( Placeholder<?> footerTemplate = Placeholder.miniMessage(
"footer", "footer",
TranslatableCaption.of("info.plot_info_footer").getComponent(player) TranslatableCaption.miniMessage("info.plot_info_footer").getComponent(player)
); );
Template areaTemplate; Placeholder<?> areaTemplate;
if (this.getArea() != null) { if (this.getArea() != null) {
areaTemplate = areaTemplate =
Template.of( Placeholder.miniMessage(
"area", "area",
this.getArea().getWorldName() + (this.getArea().getId() == null this.getArea().getWorldName() + (this.getArea().getId() == null
? "" ? ""
: "(" + this.getArea().getId() + ")") : "(" + this.getArea().getId() + ")")
); );
} else { } else {
areaTemplate = Template.of("area", TranslatableCaption.of("info.none").getComponent(player)); areaTemplate = Placeholder.miniMessage("area", TranslatableCaption.miniMessage("info.none").getComponent(player));
} }
long creationDate = Long.parseLong(String.valueOf(timestamp)); long creationDate = Long.parseLong(String.valueOf(timestamp));
SimpleDateFormat sdf = new SimpleDateFormat(Settings.Timeformat.DATE_FORMAT); SimpleDateFormat sdf = new SimpleDateFormat(Settings.Timeformat.DATE_FORMAT);
sdf.setTimeZone(TimeZone.getTimeZone(Settings.Timeformat.TIME_ZONE)); sdf.setTimeZone(TimeZone.getTimeZone(Settings.Timeformat.TIME_ZONE));
String newDate = sdf.format(creationDate); String newDate = sdf.format(creationDate);
Template idTemplate = Template.of("id", this.getId().toString()); Placeholder<?> idTemplate = Placeholder.miniMessage("id", this.getId().toString());
Template aliasTemplate = Template.of("alias", alias); Placeholder<?> aliasTemplate = Placeholder.miniMessage("alias", alias);
Template numTemplate = Template.of("num", String.valueOf(num)); Placeholder<?> numTemplate = Placeholder.miniMessage("num", String.valueOf(num));
Template descTemplate = Template.of("desc", description); Placeholder<?> descTemplate = Placeholder.miniMessage("desc", description);
Template biomeTemplate = Template.of("biome", biome.toString().toLowerCase()); Placeholder<?> biomeTemplate = Placeholder.miniMessage("biome", biome.toString().toLowerCase());
Template ownerTemplate = Template.of("owner", owner); Placeholder<?> ownerTemplate = Placeholder.miniMessage("owner", owner.toString());
Template membersTemplate = Template.of("members", members); Placeholder<?> membersTemplate =Placeholder.miniMessage("members", members.toString());
Template playerTemplate = Template.of("player", player.getName()); Placeholder<?> playerTemplate = Placeholder.miniMessage("player", player.getName());
Template trustedTemplate = Template.of("trusted", trusted); Placeholder<?> trustedTemplate = Placeholder.miniMessage("trusted", trusted.toString());
Template helpersTemplate = Template.of("helpers", members); Placeholder<?> helpersTemplate = Placeholder.miniMessage("helpers", members.toString());
Template deniedTemplate = Template.of("denied", denied); Placeholder<?> deniedTemplate = Placeholder.miniMessage("denied", denied.toString());
Template seenTemplate = Template.of("seen", seen); Placeholder<?> seenTemplate = Placeholder.miniMessage("seen", seen);
Template flagsTemplate = Template.of("flags", flags); Placeholder<?> flagsTemplate = Placeholder.miniMessage("flags", flags.toString());
Template creationTemplate = Template.of("creationdate", newDate); Placeholder<?> creationTemplate = Placeholder.miniMessage("creationdate", newDate);
Template buildTemplate = Template.of("build", String.valueOf(build)); Placeholder<?> buildTemplate = Placeholder.miniMessage("build", String.valueOf(build));
if (iInfo.getComponent(player).contains("<rating>")) { if (iInfo.getComponent(player).contains("<rating>")) {
TaskManager.runTaskAsync(() -> { TaskManager.runTaskAsync(() -> {
Template ratingTemplate; Placeholder<?> ratingTemplate;
if (Settings.Ratings.USE_LIKES) { if (Settings.Ratings.USE_LIKES) {
ratingTemplate = Template.of( ratingTemplate = Placeholder.miniMessage(
"rating", "rating",
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D) String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
); );
@ -2931,22 +2934,23 @@ public class Plot {
.append(String.format("%.1f", ratings[i])); .append(String.format("%.1f", ratings[i]));
prefix = ","; prefix = ",";
} }
ratingTemplate = Template.of("rating", rating.toString()); ratingTemplate = Placeholder.miniMessage("rating", rating.toString());
} else { } else {
double rating = this.getAverageRating(); double rating = this.getAverageRating();
if (Double.isFinite(rating)) { if (Double.isFinite(rating)) {
ratingTemplate = Template.of("rating", String.format("%.1f", rating) + '/' + max); ratingTemplate = Placeholder.miniMessage("rating", String.format("%.1f", rating) + '/' + max);
} else { } else {
ratingTemplate = Template.of( ratingTemplate = Placeholder.miniMessage(
"rating", "rating",
TranslatableCaption.of("info.none").getComponent(player) TranslatableCaption.miniMessage("info.none").getComponent(player)
); );
} }
} }
} }
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
.parse( .deserialize(
iInfo.getComponent(player), iInfo.getComponent(player),
PlaceholderResolver.placeholders(
headerTemplate, headerTemplate,
areaTemplate, areaTemplate,
idTemplate, idTemplate,
@ -2966,13 +2970,14 @@ public class Plot {
ratingTemplate, ratingTemplate,
creationTemplate, creationTemplate,
footerTemplate footerTemplate
)))); )))));
}); });
return; return;
} }
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
.parse( .deserialize(
iInfo.getComponent(player), iInfo.getComponent(player),
PlaceholderResolver.placeholders(
headerTemplate, headerTemplate,
areaTemplate, areaTemplate,
idTemplate, idTemplate,
@ -2990,7 +2995,7 @@ public class Plot {
flagsTemplate, flagsTemplate,
buildTemplate, buildTemplate,
footerTemplate footerTemplate
)))); )))));
} }
); );
return future; return future;

View File

@ -70,7 +70,8 @@ import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.gamemode.GameModes;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.PlaceholderResolver;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@ -410,8 +411,8 @@ public abstract class PlotArea {
} }
this.getFlagContainer().addAll(parseFlags(flags)); this.getFlagContainer().addAll(parseFlags(flags));
ConsolePlayer.getConsole().sendMessage( ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.area_flags"), TranslatableCaption.miniMessage("flags.area_flags"),
Template.of("flags", flags.toString()) Placeholder.miniMessage("flags", flags.toString())
); );
this.spawnEggs = config.getBoolean("event.spawn.egg"); this.spawnEggs = config.getBoolean("event.spawn.egg");
@ -431,8 +432,8 @@ public abstract class PlotArea {
} }
this.getRoadFlagContainer().addAll(parseFlags(roadflags)); this.getRoadFlagContainer().addAll(parseFlags(roadflags));
ConsolePlayer.getConsole().sendMessage( ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.road_flags"), TranslatableCaption.miniMessage("flags.road_flags"),
Template.of("flags", roadflags.toString()) Placeholder.miniMessage("flags", roadflags.toString())
); );
loadConfiguration(config); loadConfiguration(config);
@ -440,7 +441,7 @@ public abstract class PlotArea {
private Component getFlagsComponent(Component flagsComponent, Collection<PlotFlag<?, ?>> flagCollection) { private Component getFlagsComponent(Component flagsComponent, Collection<PlotFlag<?, ?>> flagCollection) {
if (flagCollection.isEmpty()) { if (flagCollection.isEmpty()) {
flagsComponent = MINI_MESSAGE.parse(TranslatableCaption.of("flag.no_flags").getComponent(LocaleHolder.console())); flagsComponent = MINI_MESSAGE.parse(TranslatableCaption.miniMessage("flag.no_flags").getComponent(LocaleHolder.console()));
} else { } else {
String prefix = " "; String prefix = " ";
for (final PlotFlag<?, ?> flag : flagCollection) { for (final PlotFlag<?, ?> flag : flagCollection) {
@ -450,14 +451,16 @@ public abstract class PlotArea {
} else { } else {
value = flag.toString(); value = flag.toString();
} }
Component snip = MINI_MESSAGE.parse( Component snip = MINI_MESSAGE.deserialize(
prefix + CaptionUtility prefix + CaptionUtility
.format( .format(
ConsolePlayer.getConsole(), ConsolePlayer.getConsole(),
TranslatableCaption.of("info.plot_flag_list").getComponent(LocaleHolder.console()) TranslatableCaption.miniMessage("info.plot_flag_list").getComponent(LocaleHolder.console())
), ),
Template.of("flag", flag.getName()), PlaceholderResolver.placeholders(
Template.of("value", CaptionUtility.formatRaw(ConsolePlayer.getConsole(), value.toString())) Placeholder.miniMessage("flag", flag.getName()),
Placeholder.miniMessage("value", CaptionUtility.formatRaw(ConsolePlayer.getConsole(), value.toString()))
)
); );
if (flagsComponent != null) { if (flagsComponent != null) {
flagsComponent.append(snip); flagsComponent.append(snip);

View File

@ -36,9 +36,9 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
public enum PlotAreaType { public enum PlotAreaType {
NORMAL(TranslatableCaption.of("plotareatype.plot_area_type_normal")), NORMAL(TranslatableCaption.miniMessage("plotareatype.plot_area_type_normal")),
AUGMENTED(TranslatableCaption.of("plotareatype.plot_area_type_augmented")), AUGMENTED(TranslatableCaption.miniMessage("plotareatype.plot_area_type_augmented")),
PARTIAL(TranslatableCaption.of("plotareatype.plot_area_type_partial")); PARTIAL(TranslatableCaption.miniMessage("plotareatype.plot_area_type_partial"));
private static final Map<String, PlotAreaType> types = Stream.of(values()) private static final Map<String, PlotAreaType> types = Stream.of(values())
.collect(Collectors.toMap(e -> e.toString().toLowerCase(), Function.identity())); .collect(Collectors.toMap(e -> e.toString().toLowerCase(), Function.identity()));

View File

@ -51,7 +51,7 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@ -384,10 +384,10 @@ public final class PlotModificationManager {
if (this.plot.getArea().allowSigns()) { if (this.plot.getArea().allowSigns()) {
Location location = manager.getSignLoc(this.plot); Location location = manager.getSignLoc(this.plot);
String id = this.plot.getId().toString(); String id = this.plot.getId().toString();
Caption[] lines = new Caption[]{TranslatableCaption.of("signs.owner_sign_line_1"), TranslatableCaption.of( Caption[] lines = new Caption[]{TranslatableCaption.miniMessage("signs.owner_sign_line_1"), TranslatableCaption.miniMessage(
"signs.owner_sign_line_2"), "signs.owner_sign_line_2"),
TranslatableCaption.of("signs.owner_sign_line_3"), TranslatableCaption.of("signs.owner_sign_line_4")}; TranslatableCaption.miniMessage("signs.owner_sign_line_3"), TranslatableCaption.miniMessage("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, Placeholder.miniMessage("id", id), Placeholder.miniMessage("owner", name));
} }
} }
@ -496,8 +496,8 @@ public final class PlotModificationManager {
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
if (player != null) { if (player != null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.miniMessage("events.event_denied"),
Template.of("value", "Auto merge on claim") Placeholder.miniMessage("value", "Auto merge on claim")
); );
} }
return; return;

Some files were not shown because too many files have changed in this diff Show More