More progress

I need a break, if something is missing, feel free to exchange that. K thx 🙏
This commit is contained in:
N0tMyFaultOG 2020-07-22 19:42:22 +02:00
parent 8d04728ebc
commit 32e095ce15
71 changed files with 1197 additions and 664 deletions

View File

@ -34,6 +34,7 @@ import com.plotsquared.bukkit.util.UpdateUtility;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.listener.PlayerBlockEventType; import com.plotsquared.core.listener.PlayerBlockEventType;
import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.listener.PlotListener;
@ -99,7 +100,6 @@ import com.plotsquared.core.plot.flag.implementations.VehicleUseFlag;
import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag; import com.plotsquared.core.plot.flag.implementations.VillagerInteractFlag;
import com.plotsquared.core.plot.flag.implementations.VineGrowFlag; import com.plotsquared.core.plot.flag.implementations.VineGrowFlag;
import com.plotsquared.core.plot.flag.types.BlockTypeWrapper; import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.EntityUtil; import com.plotsquared.core.util.EntityUtil;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
@ -115,6 +115,7 @@ 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 io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import net.kyori.adventure.text.minimessage.Template;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.FluidCollisionMode; import org.bukkit.FluidCollisionMode;
@ -653,7 +654,7 @@ import java.util.regex.Pattern;
perm = "plots.admin.command.blocked-cmds.road"; perm = "plots.admin.command.blocked-cmds.road";
} }
if (!Permissions.hasPermission(plotPlayer, perm)) { if (!Permissions.hasPermission(plotPlayer, perm)) {
MainUtil.sendMessage(plotPlayer, Captions.COMMAND_BLOCKED); plotPlayer.sendMessage(TranslatableCaption.of("blockedcmds.command_blocked"));
event.setCancelled(true); event.setCancelled(true);
} }
return; return;
@ -753,8 +754,10 @@ import java.util.regex.Pattern;
// this is acceptable, because otherwise it wouldn't make sense to have both flags set // this is acceptable, because otherwise it wouldn't make sense to have both flags set
if (!result && !(plot.getFlag(UntrustedVisitFlag.class) && plot.getHomeSynchronous() if (!result && !(plot.getFlag(UntrustedVisitFlag.class) && plot.getHomeSynchronous()
.equals(BukkitUtil.adaptComplete(to)))) { .equals(BukkitUtil.adaptComplete(to)))) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_ENTRY_DENIED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.entry.denied")
);
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -842,7 +845,7 @@ import java.util.regex.Pattern;
BukkitPlayer pp = BukkitUtil.adapt(player); BukkitPlayer pp = BukkitUtil.adapt(player);
// Cancel teleport // Cancel teleport
if (TaskManager.removeFromTeleportQueue(pp.getName())) { if (TaskManager.removeFromTeleportQueue(pp.getName())) {
MainUtil.sendMessage(pp, Captions.TELEPORT_FAILED); pp.sendMessage(TranslatableCaption.of("teleport.teleport_failed"));
} }
// Set last location // Set last location
Location location = BukkitUtil.adapt(to); Location location = BukkitUtil.adapt(to);
@ -857,8 +860,10 @@ import java.util.regex.Pattern;
if (now == null) { if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp
.getMeta("kick", false)) { .getMeta("kick", false)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_EXIT_DENIED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.exit.denied")
);
this.tmpTeleport = false; this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) { if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
player.teleport(from); player.teleport(from);
@ -872,8 +877,10 @@ import java.util.regex.Pattern;
} else if (now.equals(lastPlot)) { } else if (now.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, now); ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) { } else if (!plotEntry(pp, now) && this.tmpTeleport) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_ENTRY_DENIED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.entry.denied")
);
this.tmpTeleport = false; this.tmpTeleport = false;
to.setX(from.getBlockX()); to.setX(from.getBlockX());
to.setY(from.getBlockY()); to.setY(from.getBlockY());
@ -888,14 +895,14 @@ import java.util.regex.Pattern;
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
MainUtil.sendMessage(pp, Captions.BORDER); pp.sendMessage(TranslatableCaption.of("border.border"));
} }
if (x2 < -border && this.tmpTeleport) { if (x2 < -border && this.tmpTeleport) {
to.setX(-border + 1); to.setX(-border + 1);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
MainUtil.sendMessage(pp, Captions.BORDER); pp.sendMessage(TranslatableCaption.of("border.border"));
} }
} }
int z2; int z2;
@ -904,7 +911,7 @@ import java.util.regex.Pattern;
BukkitPlayer pp = BukkitUtil.adapt(player); BukkitPlayer pp = BukkitUtil.adapt(player);
// Cancel teleport // Cancel teleport
if (TaskManager.removeFromTeleportQueue(pp.getName())) { if (TaskManager.removeFromTeleportQueue(pp.getName())) {
MainUtil.sendMessage(pp, Captions.TELEPORT_FAILED); pp.sendMessage(TranslatableCaption.of("teleport.teleport_failed"));
} }
// Set last location // Set last location
Location location = BukkitUtil.adapt(to); Location location = BukkitUtil.adapt(to);
@ -919,8 +926,10 @@ import java.util.regex.Pattern;
if (now == null) { if (now == null) {
if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp
.getMeta("kick", false)) { .getMeta("kick", false)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_EXIT_DENIED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.exit.denied")
);
this.tmpTeleport = false; this.tmpTeleport = false;
if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) { if (lastPlot.equals(BukkitUtil.adapt(from).getPlot())) {
player.teleport(from); player.teleport(from);
@ -934,8 +943,10 @@ import java.util.regex.Pattern;
} else if (now.equals(lastPlot)) { } else if (now.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, now); ForceFieldListener.handleForcefield(player, pp, now);
} else if (!plotEntry(pp, now) && this.tmpTeleport) { } else if (!plotEntry(pp, now) && this.tmpTeleport) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_ENTRY_DENIED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.entry.denied")
);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(from); player.teleport(from);
to.setX(from.getBlockX()); to.setX(from.getBlockX());
@ -951,13 +962,13 @@ import java.util.regex.Pattern;
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
MainUtil.sendMessage(pp, Captions.BORDER); pp.sendMessage(TranslatableCaption.of("border.border"));
} else if (z2 < -border && this.tmpTeleport) { } else if (z2 < -border && this.tmpTeleport) {
to.setZ(-border + 1); to.setZ(-border + 1);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
MainUtil.sendMessage(pp, Captions.BORDER); pp.sendMessage(TranslatableCaption.of("border.border"));
} }
} }
} }
@ -1037,8 +1048,10 @@ import java.util.regex.Pattern;
if (event.getBlock().getY() == 0) { if (event.getBlock().getY() == 0) {
if (!Permissions if (!Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) { .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
Captions.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy.groundlevel")
);
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -1046,8 +1059,10 @@ import java.util.regex.Pattern;
.getMinBuildHeight()) && !Permissions .getMinBuildHeight()) && !Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true); event.setCancelled(true);
MainUtil.sendMessage(plotPlayer, Captions.HEIGHT_LIMIT.getTranslated() plotPlayer.sendMessage(
.replace("{limit}", String.valueOf(area.getMaxBuildHeight()))); TranslatableCaption.of("height.height_limit"),
Template.of("limit", String.valueOf(area.getMaxBuildHeight()))
);
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions if (!Permissions
@ -1069,13 +1084,17 @@ import java.util.regex.Pattern;
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
return; return;
} }
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
Captions.PERMISSION_ADMIN_DESTROY_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.other")
);
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -1092,8 +1111,10 @@ import java.util.regex.Pattern;
return; return;
} }
} }
MainUtil pp.sendMessage(
.sendMessage(pp, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_DESTROY_ROAD); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy.road")
);
event.setCancelled(true); event.setCancelled(true);
} }
@ -1839,21 +1860,28 @@ import java.util.regex.Pattern;
boolean cancelled = false; boolean cancelled = false;
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.road"); pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.interact.road")
);
cancelled = true; cancelled = true;
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
MainUtil pp.sendMessage(
.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.unowned"); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy.unowned")
);
cancelled = true; cancelled = true;
} }
} else { } else {
UUID uuid = pp.getUUID(); UUID uuid = pp.getUUID();
if (!plot.isAdded(uuid)) { if (!plot.isAdded(uuid)) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
"plots.admin.interact.other"); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.interact.other")
);
cancelled = true; cancelled = true;
} }
} }
@ -1900,22 +1928,29 @@ import java.util.regex.Pattern;
if (plot == null) { if (plot == null) {
if (!area.isRoadFlags() && !area.getRoadFlag(MiscInteractFlag.class) && !Permissions if (!area.isRoadFlags() && !area.getRoadFlag(MiscInteractFlag.class) && !Permissions
.hasPermission(pp, "plots.admin.interact.road")) { .hasPermission(pp, "plots.admin.interact.road")) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.road"); pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.interact.road")
);
e.setCancelled(true); e.setCancelled(true);
} }
} else { } else {
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.other")
);
e.setCancelled(true); e.setCancelled(true);
return; return;
} }
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
"plots.admin.interact.unowned"); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.interact.unowned")
);
e.setCancelled(true); e.setCancelled(true);
} }
} else { } else {
@ -1927,11 +1962,13 @@ import java.util.regex.Pattern;
return; return;
} }
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
"plots.admin.interact.other"); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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()
+ " bcause misc-interact = false"); + " because misc-interact = false");
} }
} }
} }
@ -2292,20 +2329,26 @@ import java.util.regex.Pattern;
BukkitPlayer pp = BukkitUtil.adapt(player); BukkitPlayer pp = BukkitUtil.adapt(player);
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_ROAD); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.road")
);
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_UNOWNED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.other")
);
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.getFlag(BlockIgnitionFlag.class)) { } else if (!plot.getFlag(BlockIgnitionFlag.class)) {
@ -2372,15 +2415,19 @@ import java.util.regex.Pattern;
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
return; return;
} }
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_ROAD); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.road")
);
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
return; return;
} }
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_UNOWNED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.unowned")
);
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class); List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class);
@ -2393,13 +2440,17 @@ import java.util.regex.Pattern;
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
return; return;
} }
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.other")
);
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -2437,15 +2488,19 @@ import java.util.regex.Pattern;
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
return; return;
} }
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_ROAD); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.road")
);
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
return; return;
} }
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_UNOWNED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.unowned")
);
event.setCancelled(true); event.setCancelled(true);
} else if (!plot.isAdded(plotPlayer.getUUID())) { } else if (!plot.isAdded(plotPlayer.getUUID())) {
List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class); List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class);
@ -2459,13 +2514,17 @@ import java.util.regex.Pattern;
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
return; return;
} }
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.other")
);
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -2507,15 +2566,19 @@ import java.util.regex.Pattern;
Plot plot = area.getPlot(location); Plot plot = area.getPlot(location);
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_ROAD); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.road")
);
event.setCancelled(true); event.setCancelled(true);
} }
} else { } else {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_UNOWNED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.unwoned")
);
event.setCancelled(true); event.setCancelled(true);
} }
return; return;
@ -2523,8 +2586,10 @@ import java.util.regex.Pattern;
if (!plot.isAdded(pp.getUUID())) { if (!plot.isAdded(pp.getUUID())) {
if (!plot.getFlag(HangingPlaceFlag.class)) { if (!plot.getFlag(HangingPlaceFlag.class)) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.other")
);
event.setCancelled(true); event.setCancelled(true);
} }
return; return;
@ -2551,14 +2616,18 @@ import java.util.regex.Pattern;
Plot plot = area.getPlot(location); Plot plot = area.getPlot(location);
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_ROAD)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_DESTROY_ROAD); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy.road")
);
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_DESTROY_UNOWNED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy.unowned")
);
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.isAdded(pp.getUUID())) { } else if (!plot.isAdded(pp.getUUID())) {
@ -2566,8 +2635,10 @@ import java.util.regex.Pattern;
return; return;
} }
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_DESTROY_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy.other")
);
event.setCancelled(true); event.setCancelled(true);
plot.debug(p.getName() plot.debug(p.getName()
+ " could not break hanging entity because hanging-break = false"); + " could not break hanging entity because hanging-break = false");
@ -2588,16 +2659,20 @@ import java.util.regex.Pattern;
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions if (!Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) { .hasPermission(player, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT, player.sendMessage(
Captions.PERMISSION_ADMIN_DESTROY_UNOWNED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy.unowned")
);
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!plot.isAdded(player.getUUID())) { } else if (!plot.isAdded(player.getUUID())) {
if (!plot.getFlag(HangingBreakFlag.class)) { if (!plot.getFlag(HangingBreakFlag.class)) {
if (!Permissions if (!Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) { .hasPermission(player, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT, player.sendMessage(
Captions.PERMISSION_ADMIN_DESTROY_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy.other")
);
event.setCancelled(true); event.setCancelled(true);
plot.debug(player.getName() plot.debug(player.getName()
+ " could not break hanging entity because hanging-break = false"); + " could not break hanging entity because hanging-break = false");
@ -2623,14 +2698,18 @@ import java.util.regex.Pattern;
Plot plot = area.getPlot(location); Plot plot = area.getPlot(location);
if (plot == null && !area.isRoadFlags()) { if (plot == null && !area.isRoadFlags()) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_ROAD)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_ROAD)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_INTERACT_ROAD); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.interact.unowned")
);
event.setCancelled(true); event.setCancelled(true);
} }
} else if ((plot != null && !plot.isAdded(pp.getUUID())) || (plot == null && area } else if ((plot != null && !plot.isAdded(pp.getUUID())) || (plot == null && area
@ -2685,8 +2764,10 @@ import java.util.regex.Pattern;
} }
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_OTHER)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_INTERACT_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.interact.other")
);
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -2706,15 +2787,19 @@ import java.util.regex.Pattern;
Plot plot = area.getPlot(location); Plot plot = area.getPlot(location);
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) { if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
"plots.admin.vehicle.break.road"); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.vehicle.break.road")
);
event.setCancelled(true); event.setCancelled(true);
} }
} else { } else {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) { if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
"plots.admin.vehicle.break.unowned"); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.vehicle.break.unowned")
);
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -2725,8 +2810,10 @@ import java.util.regex.Pattern;
return; return;
} }
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) { if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
"plots.admin.vehicle.break.other"); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.vehicle.break.other")
);
event.setCancelled(true); event.setCancelled(true);
plot.debug(pp.getName() plot.debug(pp.getName()
+ " could not break vehicle because vehicle-break = false"); + " could not break vehicle because vehicle-break = false");
@ -2908,16 +2995,20 @@ import java.util.regex.Pattern;
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions if (!Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { .hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.other")
);
return false; return false;
} }
} }
return true; return true;
} }
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.destroy." + stub); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy." + stub)
);
return false; return false;
} }
} else if (victim.getType() == EntityType.ARMOR_STAND) { } else if (victim.getType() == EntityType.ARMOR_STAND) {
@ -2926,8 +3017,10 @@ import java.util.regex.Pattern;
return true; return true;
} }
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.destroy." + stub); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy." + stub)
);
if (plot != null) { if (plot != null) {
plot.debug(player.getName() plot.debug(player.getName()
+ " could not break armor stand because misc-break = false"); + " could not break armor stand because misc-break = false");
@ -2945,8 +3038,10 @@ import java.util.regex.Pattern;
return true; return true;
} }
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.pve." + stub); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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
+ " because pve = false OR hostile-attack = false"); + " because pve = false OR hostile-attack = false");
@ -2964,11 +3059,13 @@ import java.util.regex.Pattern;
return true; return true;
} }
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.pve." + stub); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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
+ " because pve = false OR tamned-attack = false"); + " because pve = false OR tamed-attack = false");
} }
return false; return false;
} }
@ -2976,8 +3073,10 @@ import java.util.regex.Pattern;
if (isPlot) { if (isPlot) {
if (!plot.getFlag(PvpFlag.class) && !Permissions if (!plot.getFlag(PvpFlag.class) && !Permissions
.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) { .hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.pvp." + stub); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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");
return false; return false;
@ -2988,8 +3087,10 @@ import java.util.regex.Pattern;
return true; return true;
} }
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.pvp." + stub); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.pvp." + stub)
);
return false; return false;
} }
} else if (EntityCategories.ANIMAL.contains(entityType)) { // victim is animal } else if (EntityCategories.ANIMAL.contains(entityType)) { // victim is animal
@ -3003,8 +3104,10 @@ import java.util.regex.Pattern;
} else if (roadFlags && (area.getRoadFlag(AnimalAttackFlag.class) || area } else if (roadFlags && (area.getRoadFlag(AnimalAttackFlag.class) || area
.getFlag(PveFlag.class))) { .getFlag(PveFlag.class))) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.pve." + stub); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.pve." + stub)
);
return false; return false;
} }
} }
@ -3020,8 +3123,10 @@ import java.util.regex.Pattern;
return true; return true;
} }
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.pve." + stub); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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
+ " because pve = false"); + " because pve = false");
@ -3060,20 +3165,26 @@ import java.util.regex.Pattern;
Plot plot = area.getPlot(location); Plot plot = area.getPlot(location);
if (plot == null) { if (plot == null) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.projectile.road"); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.projectile.road")
);
event.setHatching(false); event.setHatching(false);
} }
} else if (!plot.hasOwner()) { } else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.unowned")) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.unowned")) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.projectile.unowned"); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.projective.unowned")
);
event.setHatching(false); event.setHatching(false);
} }
} else if (!plot.isAdded(plotPlayer.getUUID())) { } else if (!plot.isAdded(plotPlayer.getUUID())) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) { if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) {
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, plotPlayer.sendMessage(
"plots.admin.projectile.other"); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.projectile.other")
);
event.setHatching(false); event.setHatching(false);
} }
} }
@ -3094,13 +3205,17 @@ import java.util.regex.Pattern;
.getMinBuildHeight()) && !Permissions .getMinBuildHeight()) && !Permissions
.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { .hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
event.setCancelled(true); event.setCancelled(true);
MainUtil.sendMessage(pp, Captions.HEIGHT_LIMIT.getTranslated() pp.sendMessage(
.replace("{limit}", String.valueOf(area.getMaxBuildHeight()))); TranslatableCaption.of("height.height_limit"),
Template.of("limit", String.valueOf(area.getMaxBuildHeight()))
);
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_UNOWNED)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_UNOWNED); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.other")
);
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -3114,8 +3229,10 @@ import java.util.regex.Pattern;
} }
} }
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.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()
+ " because of the place flag"); + " because of the place flag");
@ -3123,8 +3240,10 @@ import java.util.regex.Pattern;
} }
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_OTHER); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.other")
);
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -3138,8 +3257,10 @@ import java.util.regex.Pattern;
} }
} }
} else if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) { } else if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_ROAD)) {
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, pp.sendMessage(
Captions.PERMISSION_ADMIN_BUILD_ROAD); TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.build.other")
);
event.setCancelled(true); event.setCancelled(true);
} }
} }

View File

@ -45,7 +45,7 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "alias", @CommandDeclaration(command = "alias",
permission = "plots.alias", permission = "plots.alias",
description = "Set the plot name", description = "Set the plot name",
usage = "/plot alias <set|remove> <alias>", usage = "/plot alias <set | remove> <alias>",
aliases = {"setalias", "sa", "name", "rename", "setname", "seta", "nameplot"}, aliases = {"setalias", "sa", "name", "rename", "setname", "seta", "nameplot"},
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)
@ -96,7 +96,7 @@ public class Alias extends SubCommand {
return true; return true;
} else { } else {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ALIAS_SET.getTranslated())); Template.of("node", "plots.alias.set"));
} }
break; break;
@ -111,7 +111,7 @@ public class Alias extends SubCommand {
result = removeAlias(player, plot); result = removeAlias(player, plot);
} else { } else {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ALIAS_REMOVE.getTranslated())); Template.of("node", "plots.alias.remove"));
} }
break; break;
default: default:
@ -168,7 +168,7 @@ public class Alias extends SubCommand {
private boolean removeAlias(PlotPlayer<?> player, Plot plot) { private boolean removeAlias(PlotPlayer<?> player, Plot plot) {
plot.setAlias(null); plot.setAlias(null);
player.sendMessage(TranslatableCaption.of("permission.no_permission"), player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ALIAS_REMOVE.getTranslated())); Template.of("node", "plots.alias.remove"));
return true; return true;
} }

View File

@ -58,7 +58,6 @@ import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
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 com.plotsquared.core.util.task.RunnableVal3;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
@ -72,7 +71,6 @@ import com.sk89q.worldedit.math.BlockVector2;
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.TranslatableComponent;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@ -91,7 +89,7 @@ import java.util.Set;
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
description = "Create a new PlotArea", description = "Create a new PlotArea",
aliases = "world", aliases = "world",
usage = "/plot area <create|info|list|tp|regen>", usage = "/plot area <create | info | list | tp | regen>",
confirmation = true) confirmation = true)
public class Area extends SubCommand { public class Area extends SubCommand {
@ -130,9 +128,9 @@ public class Area extends SubCommand {
player.sendMessage(RequiredType.CONSOLE.getErrorMessage()); player.sendMessage(RequiredType.CONSOLE.getErrorMessage());
return false; return false;
} }
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_CREATE)) { if (!Permissions.hasPermission(player, "plots.area.create")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_CREATE.getTranslated())); Template.of("node", "plots.area.create"));
return false; return false;
} }
if (args.length < 2) { if (args.length < 2) {
@ -245,8 +243,10 @@ public class Area extends SubCommand {
PlotSquared.get().loadWorld(world, null); PlotSquared.get().loadWorld(world, null);
player.sendMessage(TranslatableCaption.of("single.single_area_created")); player.sendMessage(TranslatableCaption.of("single.single_area_created"));
} else { } else {
player.sendMessage(TranslatableCaption.of("errors.error_create"), player.sendMessage(
Template.of("world", hybridPlotWorld.getWorldName())); TranslatableCaption.of("errors.error_create"),
Template.of("world", hybridPlotWorld.getWorldName())
);
} }
}; };
singleRun.run(); singleRun.run();
@ -254,9 +254,9 @@ public class Area extends SubCommand {
case "c": case "c":
case "setup": case "setup":
case "create": case "create":
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_CREATE)) { if (!Permissions.hasPermission(player, "plots.area.create")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_CREATE.getTranslated())); Template.of("node", "plots.area.create"));
return false; return false;
} }
switch (args.length) { switch (args.length) {
@ -498,8 +498,7 @@ public class Area extends SubCommand {
if (pa.getId() == null) { if (pa.getId() == null) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", getCommandString + ) Template.of("value", getUsage()));
);
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"), TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.of("value1", getCommandString()), Template.of("value1", getCommandString()),
@ -529,9 +528,9 @@ public class Area extends SubCommand {
return true; return true;
case "i": case "i":
case "info": { case "info": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_INFO)) { if (!Permissions.hasPermission(player, "plots.area.info")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_INFO.getTranslated())); Template.of("node", "plots.area.info"));
return false; return false;
} }
PlotArea area; PlotArea area;
@ -589,9 +588,9 @@ public class Area extends SubCommand {
} }
case "l": case "l":
case "list": case "list":
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_LIST)) { if (!Permissions.hasPermission(player, "plots.area.list")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_LIST.getTranslated())); Template.of("node", "plots.area.list"));
return false; return false;
} }
int page; int page;
@ -658,9 +657,9 @@ public class Area extends SubCommand {
case "clear": case "clear":
case "reset": case "reset":
case "regenerate": { case "regenerate": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_REGEN)) { if (!Permissions.hasPermission(player, "plots.area.regen")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_REGEN.getTranslated())); Template.of("node", "plots.area.regen"));
return false; return false;
} }
final PlotArea area = player.getApplicablePlotArea(); final PlotArea area = player.getApplicablePlotArea();
@ -684,8 +683,7 @@ public class Area extends SubCommand {
.generate(null, area.getWorldName(), value.getX(), value.getZ(), .generate(null, area.getWorldName(), value.getX(), value.getZ(),
null); null);
} }
}, () -> player.sendMessage( }, () -> player.sendMessage(TranslatableCaption.of("single.regeneration_complete"))
TranslatableCaption.of("single.regeneration_complete"))
); );
return true; return true;
} }
@ -694,9 +692,9 @@ public class Area extends SubCommand {
case "teleport": case "teleport":
case "visit": case "visit":
case "tp": case "tp":
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_TP)) { if (!Permissions.hasPermission(player, "plots.area.tp")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_TP.getTranslated())); Template.of("node", "plots.area.tp"));
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
@ -728,9 +726,7 @@ public class Area extends SubCommand {
return true; return true;
case "delete": case "delete":
case "remove": case "remove":
player.sendMessage( player.sendMessage(TranslatableCaption.of("single.worldcreation_location"));
TranslatableCaption.of("single.worldcreation_location")
);
return true; return true;
} }
sendUsage(player); sendUsage(player);

View File

@ -29,7 +29,6 @@ import com.google.common.collect.Lists;
import com.google.common.primitives.Ints; import com.google.common.primitives.Ints;
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.caption.Caption;
import com.plotsquared.core.configuration.caption.CaptionUtility; import com.plotsquared.core.configuration.caption.CaptionUtility;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
@ -221,9 +220,7 @@ public class Auto extends SubCommand {
return true; return true;
} }
if (size_x < 1 || size_z < 1) { if (size_x < 1 || size_z < 1) {
player.sendMessage( player.sendMessage(TranslatableCaption.of("error.plot_size"));
TranslatableCaption.of("error.plot_size")
);
} }
if (args.length > 1) { if (args.length > 1) {
schematic = args[1]; schematic = args[1];
@ -250,9 +247,9 @@ public class Auto extends SubCommand {
size_x = event.getSize_x(); size_x = event.getSize_x();
size_z = event.getSize_z(); size_z = event.getSize_z();
schematic = event.getSchematic(); schematic = event.getSchematic();
if (!force && mega && !Permissions.hasPermission(player, Captions.PERMISSION_AUTO_MEGA)) { if (!force && mega && !Permissions.hasPermission(player, "plots.auto.mega")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"), player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AUTO_MEGA.getTranslated())); Template.of("node", "plots.auto.mega"));
} }
if (!force && size_x * size_z > Settings.Claim.MAX_AUTO_AREA) { if (!force && size_x * size_z > Settings.Claim.MAX_AUTO_AREA) {
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots_num"), player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots_num"),
@ -277,10 +274,10 @@ public class Auto extends SubCommand {
if (!force && !Permissions.hasPermission(player, CaptionUtility if (!force && !Permissions.hasPermission(player, CaptionUtility
.format(player, Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)) .format(player, Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
&& !Permissions && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) { .hasPermission(player, "plots.admin.command.schematic")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated()) Template.of("node", "plots.claim.%s0")
); );
return true; return true;
} }
@ -337,7 +334,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.of("events.event_denied"),
Template.of("value", "Auto merge")); Template.of("value", "Auto merge")
);
return false; return false;
} }
if (!plotarea.mergePlots(mergeEvent.getPlots(), true)) { if (!plotarea.mergePlots(mergeEvent.getPlots(), true)) {

View File

@ -57,7 +57,7 @@ import java.util.stream.IntStream;
import java.util.stream.Stream; import java.util.stream.Stream;
@CommandDeclaration(command = "backup", @CommandDeclaration(command = "backup",
usage = "/plot backup <save|list|load>", usage = "/plot backup <save | list | load>",
description = "Manage plot backups", description = "Manage plot backups",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
@ -72,7 +72,10 @@ public final class Backup extends Command {
} }
private static boolean sendMessage(PlotPlayer player, Captions message, Object... args) { private static boolean sendMessage(PlotPlayer player, Captions message, Object... args) {
message.send(player, args); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot backup <save | list | load>")
);
return true; return true;
} }
@ -142,10 +145,10 @@ public final class Backup extends Command {
Template.of("plot", "generic.generic_merged") Template.of("plot", "generic.generic_merged")
); );
} else if (!plot.isOwner(player.getUUID()) && !Permissions } else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) { .hasPermission(player, "plots.admin.backup.other")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ADMIN_BACKUP_OTHER.getTranslated()) Template.of("node", "plots.admin.backup.other")
); );
} else { } else {
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
@ -157,7 +160,10 @@ public final class Backup extends Command {
} else { } else {
backupProfile.createBackup().whenComplete((backup, throwable) -> { backupProfile.createBackup().whenComplete((backup, throwable) -> {
if (throwable != null) { if (throwable != null) {
sendMessage(player, Captions.BACKUP_SAVE_FAILED, throwable.getMessage()); player.sendMessage(
TranslatableCaption.of("backups.backup_save_failed"),
Template.of("reason", throwable.getMessage())
);
throwable.printStackTrace(); throwable.printStackTrace();
} else { } else {
player.sendMessage(TranslatableCaption.of("backups.backup_save_success")); player.sendMessage(TranslatableCaption.of("backups.backup_save_success"));
@ -190,10 +196,10 @@ public final class Backup extends Command {
Template.of("plot", "generic.generic_merged") Template.of("plot", "generic.generic_merged")
); );
} else if (!plot.isOwner(player.getUUID()) && !Permissions } else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) { .hasPermission(player, "plots.admin.backup.other")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ADMIN_BACKUP_OTHER.getTranslated()) Template.of("node", "plots.admin.backup.other")
); );
} else { } else {
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot)); final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
@ -261,10 +267,10 @@ public final class Backup extends Command {
Template.of("plot", "generic.generic_merged") Template.of("plot", "generic.generic_merged")
); );
} else if (!plot.isOwner(player.getUUID()) && !Permissions } else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) { .hasPermission(player, "plots.admin.backup.other")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ADMIN_BACKUP_OTHER.getTranslated()) Template.of("node", "plots.admin.backup.other")
); );
} else if (args.length == 0) { } else if (args.length == 0) {
player.sendMessage( player.sendMessage(

View File

@ -72,7 +72,8 @@ public class Biome extends SetCommand {
plot.removeRunning(); plot.removeRunning();
player.sendMessage( player.sendMessage(
TranslatableCaption.of("biome.biome_set_to"), TranslatableCaption.of("biome.biome_set_to"),
Template.of("value", value.toLowerCase())); Template.of("value", value.toLowerCase())
);
}); });
return true; return true;
} }

View File

@ -96,7 +96,8 @@ public class Buy extends Command {
confirm.run(this, () -> { confirm.run(this, () -> {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("economy.removed_balance"), TranslatableCaption.of("economy.removed_balance"),
Template.of("money", String.valueOf(price))); Template.of("money", String.valueOf(price))
);
this.econHandler.depositMoney(PlotSquared.platform().getPlayerManager().getOfflinePlayer(plot.getOwnerAbs()), price); this.econHandler.depositMoney(PlotSquared.platform().getPlayerManager().getOfflinePlayer(plot.getOwnerAbs()), price);

View File

@ -59,10 +59,10 @@ public class Caps extends SubCommand {
return false; return false;
} }
if (!plot.isAdded(player.getUUID()) && !Permissions if (!plot.isAdded(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_CAPS_OTHER)) { .hasPermission(player, "plots.admin.caps.other")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ADMIN_CAPS_OTHER.getTranslated())); Template.of("node", "plots.admin.caps.other"));
return false; return false;
} }
player.sendMessage(TranslatableCaption.of("info.plot_caps_header")); player.sendMessage(TranslatableCaption.of("info.plot_caps_header"));
@ -82,7 +82,8 @@ public class Caps extends SubCommand {
final int current = countedEntities[type]; final int current = countedEntities[type];
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));
player.sendMessage(TranslatableCaption.of("info.plot_caps_format"), player.sendMessage(
TranslatableCaption.of("info.plot_caps_format"),
Template.of("cap", name), Template.of("cap", name),
Template.of("current", String.valueOf(current)), Template.of("current", String.valueOf(current)),
Template.of("limit", String.valueOf(max)), Template.of("limit", String.valueOf(max)),

View File

@ -52,7 +52,13 @@ import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@CommandDeclaration(command = "claim", aliases = "c", description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER, permission = "plots.claim", usage = "/plot claim") @CommandDeclaration(
command = "claim",
aliases = "c",
description = "Claim the current plot you're standing on",
category = CommandCategory.CLAIMING,
requiredType = RequiredType.PLAYER, permission = "plots.claim",
usage = "/plot claim")
public class Claim extends SubCommand { public class Claim extends SubCommand {
private static final Logger logger = private static final Logger logger =
@ -118,7 +124,7 @@ public class Claim extends SubCommand {
if (!Permissions.hasPermission(player, CaptionUtility if (!Permissions.hasPermission(player, CaptionUtility
.format(player, Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic)) .format(player, Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
&& !Permissions && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC) && !force) { .hasPermission(player, "plots.admin.command.schematic") && !force) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_schematic_permission"), TranslatableCaption.of("permission.no_schematic_permission"),
Template.of("value", schematic) Template.of("value", schematic)
@ -175,7 +181,8 @@ public class Claim extends SubCommand {
if (mergeEvent.getEventResult() == Result.DENY) { if (mergeEvent.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.of("events.event_denied"),
Template.of("value", "Auto merge on claim")); Template.of("value", "Auto merge on claim")
);
} else { } else {
plot.autoMerge(mergeEvent.getDir(), mergeEvent.getMax(), player.getUUID(), true); plot.autoMerge(mergeEvent.getDir(), mergeEvent.getMax(), player.getUUID(), true);
} }

View File

@ -85,11 +85,11 @@ public class Clear extends Command {
} }
boolean force = eventResult == Result.FORCE; boolean force = eventResult == Result.FORCE;
checkTrue(force || plot.isOwner(player.getUUID()) || Permissions checkTrue(force || plot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CLEAR), .hasPermission(player, "plots.admin.command.clear"),
Captions.NO_PLOT_PERMS); Captions.NO_PLOT_PERMS);
checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER); checkTrue(plot.getRunning() == 0, Captions.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, Captions.PERMISSION_CONTINUE), Captions.DONE_ALREADY_DONE); .hasPermission(player, "plots.continue"), Captions.DONE_ALREADY_DONE);
confirm.run(this, () -> { confirm.run(this, () -> {
BackupManager.backup(player, plot, () -> { BackupManager.backup(player, plot, () -> {
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();

View File

@ -28,6 +28,7 @@ package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
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.events.TeleportCause; import com.plotsquared.core.events.TeleportCause;
@ -40,7 +41,6 @@ import com.plotsquared.core.plot.PlotCluster;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
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.TranslatableComponent;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import java.util.HashSet; import java.util.HashSet;
@ -68,10 +68,10 @@ public class Cluster extends SubCommand {
switch (sub) { switch (sub) {
case "l": case "l":
case "list": { case "list": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LIST)) { if (!Permissions.hasPermission(player, "plots.cluster.list")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_LIST.getTranslated()) Template.of("node", "plots.cluster.list")
); );
return false; return false;
} }
@ -121,10 +121,10 @@ public class Cluster extends SubCommand {
} }
case "c": case "c":
case "create": { case "create": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE)) { if (!Permissions.hasPermission(player, "plots.cluster.create")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_CREATE.getTranslated()) Template.of("node", "plots.cluster.create")
); );
return false; return false;
} }
@ -180,20 +180,20 @@ public class Cluster extends SubCommand {
if (!area.contains(pos1) || !area.contains(pos2)) { if (!area.contains(pos1) || !area.contains(pos2)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("cluster.cluster_outside"), TranslatableCaption.of("cluster.cluster_outside"),
Template.of("area", area) Template.of("area", String.valueOf(area))
); );
return false; return false;
} }
Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2); Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2);
if (!plots.isEmpty()) { if (!plots.isEmpty()) {
if (!Permissions if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE_OTHER)) { .hasPermission(player, "plots.cluster.create.other")) {
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
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.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_CREATE_OTHER.getTranslated()) Template.of("node", "plots.cluster.create.other")
); );
return false; return false;
} }
@ -214,7 +214,7 @@ 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.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_SIZE.getTranslated() + "." + (current + cluster.getArea())) Template.of("node", "plots.cluster.size" + "." + (current + cluster.getArea()))
); );
return false; return false;
} }
@ -240,7 +240,7 @@ public class Cluster extends SubCommand {
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE)) { if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_DELETE.getTranslated()) Template.of("node", "plots.cluster.delete")
); );
return false; return false;
} }
@ -278,7 +278,7 @@ public class Cluster extends SubCommand {
.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE_OTHER)) { .hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_DELETE_OTHER.getTranslated())); Template.of("node", "plots.cluster.delete.other"));
return false; return false;
} }
} }
@ -291,7 +291,7 @@ public class Cluster extends SubCommand {
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE)) { if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE.getTranslated())); Template.of("node", "plots.cluster.resize"));
return false; return false;
} }
if (args.length != 3) { if (args.length != 3) {
@ -323,15 +323,15 @@ public class Cluster extends SubCommand {
} }
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_pcluster")); player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
return false; return false;
} }
if (!cluster.hasHelperRights(player.getUUID())) { if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_OTHER)) { .hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_OTHER)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission") TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE_OTHER.getTranslated())); Template.of("node", "plots.cluster.resize.other"));
return false; return false;
} }
} }
@ -356,7 +356,7 @@ public class Cluster extends SubCommand {
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_SHRINK)) { .hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE_SHRINK.getTranslated()) Template.of("node", "plots.cluster.resize.shrink")
); );
return false; return false;
} }
@ -367,7 +367,7 @@ public class Cluster extends SubCommand {
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_EXPAND)) { .hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE_EXPAND.getTranslated()) Template.of("node", "plots.cluster.resize.expand")
); );
return false; return false;
} }
@ -385,23 +385,22 @@ 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.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER.getTranslated() + "." + (current + cluster Template.of("node", "plots.cluster" + "." + (current + cluster.getArea()))
.getArea()))
); );
return false; return false;
} }
// resize cluster // resize cluster
DBFunc.resizeCluster(cluster, pos1, pos2); DBFunc.resizeCluster(cluster, pos1, pos2);
player.sendMessage(TranslatableCaption.of("cluster.clister_resized")); player.sendMessage(TranslatableCaption.of("cluster.cluster_resized"));
return true; return true;
} }
case "add": case "add":
case "inv": case "inv":
case "invite": { case "invite": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE)) { if (!Permissions.hasPermission(player, "plots.cluster.invite")) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_INVITE.getTranslated()) Template.of("node", "plots.cluster.invite")
); );
return false; return false;
} }
@ -766,7 +765,7 @@ public class Cluster extends SubCommand {
message = message.replaceAll("%name%", name); message = message.replaceAll("%name%", name);
message = message.replaceAll("%size%", size); message = message.replaceAll("%size%", size);
message = message.replaceAll("%rights%", rights); message = message.replaceAll("%rights%", rights);
MainUtil.sendMessage(player, message); player.sendMessage(StaticCaption.of(message));
} }
}); });
return true; return true;

View File

@ -240,7 +240,7 @@ public abstract class Command {
// Send the header // Send the header
header = header.replaceAll("%cur", page + 1 + "").replaceAll("%max", totalPages + 1 + "") header = header.replaceAll("%cur", page + 1 + "").replaceAll("%max", totalPages + 1 + "")
.replaceAll("%amount%", c.size() + "").replaceAll("%word%", "all"); .replaceAll("%amount%", c.size() + "").replaceAll("%word%", "all");
MainUtil.sendMessage(player, header); player.sendMessage(StaticCaption.of(header));
// Send the page content // Send the page content
List<T> subList = c.subList(page * size, max); List<T> subList = c.subList(page * size, max);
int i = page * size; int i = page * size;

View File

@ -28,6 +28,7 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.caption.Caption; import com.plotsquared.core.configuration.caption.Caption;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.LocaleHolder; import com.plotsquared.core.configuration.caption.LocaleHolder;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@ -39,42 +40,42 @@ public enum CommandCategory implements Caption {
* Claiming CommandConfig. * Claiming CommandConfig.
* Such as: /plot claim * Such as: /plot claim
*/ */
CLAIMING(Captions.COMMAND_CATEGORY_CLAIMING), CLAIMING(TranslatableCaption.of("category.command_category_claiming")),
/** /**
* Teleportation CommandConfig. * Teleportation CommandConfig.
* Such as: /plot visit * Such as: /plot visit
*/ */
TELEPORT(Captions.COMMAND_CATEGORY_TELEPORT), TELEPORT(TranslatableCaption.of("category.command_category_teleport")),
/** /**
* Protection. * Protection.
*/ */
SETTINGS(Captions.COMMAND_CATEGORY_SETTINGS), SETTINGS(TranslatableCaption.of("category.command_category_settings")),
/** /**
* Chat. * Chat.
*/ */
CHAT(Captions.COMMAND_CATEGORY_CHAT), CHAT(TranslatableCaption.of("category.command_category_chat")),
/** /**
* Web. * Web.
*/ */
SCHEMATIC(Captions.COMMAND_CATEGORY_SCHEMATIC), SCHEMATIC(TranslatableCaption.of("category.command_category_schematic")),
/** /**
* Cosmetic. * Cosmetic.
*/ */
APPEARANCE(Captions.COMMAND_CATEGORY_APPEARANCE), APPEARANCE(TranslatableCaption.of("category.command_category_appearance")),
/** /**
* Information CommandConfig. * Information CommandConfig.
* Such as: /plot info * Such as: /plot info
*/ */
INFO(Captions.COMMAND_CATEGORY_INFO), INFO(TranslatableCaption.of("category.command_category_info")),
/** /**
* Debug CommandConfig. * Debug CommandConfig.
* Such as: /plot debug * Such as: /plot debug
*/ */
DEBUG(Captions.COMMAND_CATEGORY_DEBUG), DEBUG(TranslatableCaption.of("category.command_category_debug")),
/** /**
* Administration commands. * Administration commands.
*/ */
ADMINISTRATION(Captions.COMMAND_CATEGORY_ADMINISTRATION); ADMINISTRATION(TranslatableCaption.of("category.command_category_administration"));
/** /**
* The category name (Readable). * The category name (Readable).
*/ */

View File

@ -26,13 +26,15 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
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.plot.comment.CommentInbox; 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 java.util.Arrays; import java.util.Arrays;
import java.util.Locale; import java.util.Locale;
@ -47,8 +49,10 @@ public class Comment extends SubCommand {
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) { @Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
if (args.length < 2) { if (args.length < 2) {
sendMessage(player, Captions.COMMENT_SYNTAX, player.sendMessage(
StringMan.join(CommentManager.inboxes.keySet(), "|")); TranslatableCaption.of("comment.comment_syntax"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
);
return false; return false;
} }
@ -64,8 +68,10 @@ public class Comment extends SubCommand {
plot = player.getLocation().getPlotAbs(); plot = player.getLocation().getPlotAbs();
} else { } else {
if (args.length < 3) { if (args.length < 3) {
sendMessage(player, Captions.COMMENT_SYNTAX, player.sendMessage(
StringMan.join(CommentManager.inboxes.keySet(), "|")); TranslatableCaption.of("comment.comment_syntax"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
);
return false; return false;
} }
index = 2; index = 2;
@ -73,13 +79,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) {
sendMessage(player, Captions.COMMENT_SYNTAX, player.sendMessage(
StringMan.join(CommentManager.inboxes.keySet(), "|")); TranslatableCaption.of("comment.comment_syntax"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
);
return false; return false;
} }
if (!inbox.canWrite(plot, player)) { if (!inbox.canWrite(plot, player)) {
sendMessage(player, Captions.NO_PERM_INBOX, ""); player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox"));
return false; return false;
} }
@ -89,19 +97,21 @@ public class Comment extends SubCommand {
player.getName(), inbox.toString(), System.currentTimeMillis()); player.getName(), inbox.toString(), System.currentTimeMillis());
boolean result = inbox.addComment(plot, comment); boolean result = inbox.addComment(plot, comment);
if (!result) { if (!result) {
sendMessage(player, Captions.NO_PLOT_INBOX, ""); player.sendMessage(TranslatableCaption.of("comment.no_plot_inbox"));
sendMessage(player, Captions.COMMENT_SYNTAX, player.sendMessage(
StringMan.join(CommentManager.inboxes.keySet(), "|")); TranslatableCaption.of("comment.comment_syntax"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
);
return false; return false;
} }
for (final PlotPlayer pp : PlotSquared.platform().getPlayerManager().getPlayers()) { for (final PlotPlayer pp : PlotSquared.platform().getPlayerManager().getPlayers()) {
if (pp.getAttribute("chatspy")) { if (pp.getAttribute("chatspy")) {
MainUtil.sendMessage(pp, "/plot comment " + StringMan.join(args, " ")); pp.sendMessage(StaticCaption.of("/plot comment " + StringMan.join(args, " ")));
} }
} }
sendMessage(player, Captions.COMMENT_ADDED); player.sendMessage(TranslatableCaption.of("comment.comment_added"));
return true; return true;
} }
} }

View File

@ -266,7 +266,7 @@ public class Condense extends SubCommand {
} }
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value","/plot condense " + area.getWorldName() + " <start|stop|info> [radius]") Template.of("value", "/plot condense " + area.getWorldName() + " <start | stop | info> [radius]")
); );
return false; return false;
} }

View File

@ -26,7 +26,6 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.generator.HybridPlotWorld; import com.plotsquared.core.generator.HybridPlotWorld;
import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.HybridUtils;

View File

@ -65,7 +65,7 @@ import java.util.Map.Entry;
permission = "plots.database", permission = "plots.database",
description = "Convert/Backup Storage", description = "Convert/Backup Storage",
requiredType = RequiredType.CONSOLE, requiredType = RequiredType.CONSOLE,
usage = "/plot database [area] <sqlite|mysql|import>") usage = "/plot database [area] <sqlite | mysql | import>")
public class DatabaseCommand extends SubCommand { public class DatabaseCommand extends SubCommand {
private final PlotAreaManager plotAreaManager; private final PlotAreaManager plotAreaManager;

View File

@ -28,6 +28,8 @@ 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.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.RegionManager; import com.plotsquared.core.util.RegionManager;
@ -38,6 +40,7 @@ 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 com.sk89q.worldedit.world.entity.EntityType; import com.sk89q.worldedit.world.entity.EntityType;
import net.kyori.adventure.text.minimessage.Template;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -68,29 +71,33 @@ public class Debug extends SubCommand {
if (args.length > 0) { if (args.length > 0) {
if ("player".equalsIgnoreCase(args[0])) { if ("player".equalsIgnoreCase(args[0])) {
for (Map.Entry<String, Object> meta : player.getMeta().entrySet()) { for (Map.Entry<String, Object> meta : player.getMeta().entrySet()) {
MainUtil.sendMessage(player, player.sendMessage(StaticCaption.of("Key: " + meta.getKey() + " Value: " + meta.getValue().toString() + " , "));
"Key: " + meta.getKey() + " Value: " + meta.getValue().toString() + " , ");
} }
} }
} }
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();
MainUtil.sendMessage(player, "Fetching loaded chunks..."); player.sendMessage(TranslatableCaption.of("debug.fetching_loaded_chunks"));
TaskManager.runTaskAsync(() -> MainUtil.sendMessage(player, TaskManager.runTaskAsync(() -> player.sendMessage(StaticCaption.of("Loaded chunks: " + this.regionManager.getChunkChunks(player.getLocation().getWorldName()).size() + "(" + (
"Loaded chunks: " + this.regionManager.getChunkChunks(player.getLocation().getWorldName()).size() + "(" + (
System.currentTimeMillis() - start) + "ms) using thread: " + Thread System.currentTimeMillis() - start) + "ms) using thread: " + Thread
.currentThread().getName())); .currentThread().getName())));
return true; return true;
} }
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();
MainUtil.sendMessage(player, String.format("There are %d cached UUIDs", mappings.size())); player.sendMessage(
TranslatableCaption.of("debug.cached_uuids"),
Template.of("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])) {
MainUtil.sendMessage(player, "Player in debug mode: " ); player.sendMessage(TranslatableCaption.of("debug.player_in_debugmode"));
for (final PlotPlayer<?> pp : PlotPlayer.getDebugModePlayers()) { for (final PlotPlayer<?> pp : PlotPlayer.getDebugModePlayers()) {
MainUtil.sendMessage(player, "- " + pp.getName()); player.sendMessage(
TranslatableCaption.of("debug.player_in_debugmode_list"),
Template.of("value", pp.getName())
);
} }
return true; return true;
} }
@ -103,14 +110,14 @@ public class Debug extends SubCommand {
} }
if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) { if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) {
EntityCategories.init(); EntityCategories.init();
player.sendMessage(Captions.PREFIX.getTranslated() + "§cEntity Categories: "); player.sendMessage(TranslatableCaption.of("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");
for (final EntityType entityType : category.getAll()) { for (final EntityType entityType : category.getAll()) {
builder.append(entityType.getId()).append(" "); builder.append(entityType.getId()).append(" ");
} }
player.sendMessage(Captions.PREFIX.getTranslated() + builder.toString()); player.sendMessage(StaticCaption.of("core.prefix" + builder.toString()));
}); });
EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId)) EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId))
.forEach(entityType -> { .forEach(entityType -> {
@ -119,9 +126,8 @@ public class Debug extends SubCommand {
if (categoryCount > 0) { if (categoryCount > 0) {
return; return;
} }
player.sendMessage( player.sendMessage(StaticCaption.of("core.prefix" + entityType.getName() + " is in "
Captions.PREFIX.getTranslated() + entityType.getName() + " is in " + categoryCount + " categories"));
+ categoryCount + " categories");
}); });
return true; return true;
} }
@ -130,7 +136,7 @@ public class Debug extends SubCommand {
for (Captions caption : Captions.values()) { for (Captions caption : Captions.values()) {
msg.append(caption.getTranslated()).append("\n"); msg.append(caption.getTranslated()).append("\n");
} }
MainUtil.sendMessage(player, msg.toString()); player.sendMessage(StaticCaption.of(msg.toString()));
return true; return true;
} }
StringBuilder information = new StringBuilder(); StringBuilder information = new StringBuilder();
@ -145,7 +151,7 @@ public class Debug extends SubCommand {
information.append(getSection(section, "Messages")); information.append(getSection(section, "Messages"));
information.append(getLine(line, "Total Messages", Captions.values().length)); information.append(getLine(line, "Total Messages", Captions.values().length));
information.append(getLine(line, "View all captions", "/plot debug msg")); information.append(getLine(line, "View all captions", "/plot debug msg"));
MainUtil.sendMessage(player, information.toString()); player.sendMessage(StaticCaption.of(information.toString()));
return true; return true;
} }

View File

@ -25,7 +25,6 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions;
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;

View File

@ -65,7 +65,6 @@ import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import javafx.collections.transformation.TransformationList;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@ -28,7 +28,6 @@ package com.plotsquared.core.command;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
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.Captions;
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.PlotId; import com.plotsquared.core.plot.PlotId;

View File

@ -29,7 +29,6 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
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.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption; import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;

View File

@ -26,7 +26,6 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.generator.HybridPlotManager; import com.plotsquared.core.generator.HybridPlotManager;
import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.HybridUtils;

View File

@ -26,7 +26,6 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions;
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;

View File

@ -135,7 +135,7 @@ public class Download extends SubCommand {
player.sendMessage(TranslatableCaption.of("web.generating_link_failed")); player.sendMessage(TranslatableCaption.of("web.generating_link_failed"));
return; return;
} }
player.sendMessage(StaticCaption.of(url.toString()) player.sendMessage(StaticCaption.of(url.toString()));
} }
}); });
} else { } else {

View File

@ -49,6 +49,7 @@ import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.helpmenu.HelpMenu; import com.plotsquared.core.util.helpmenu.HelpMenu;
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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -67,7 +68,7 @@ import java.util.stream.Stream;
@CommandDeclaration(command = "flag", @CommandDeclaration(command = "flag",
aliases = {"f", "flag"}, aliases = {"f", "flag"},
usage = "/plot flag <set|remove|add|list|info> <flag> <value>", usage = "/plot flag <set | remove | add | list | info> <flag> <value>",
description = "Manage plot flags", description = "Manage plot flags",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
@ -80,7 +81,10 @@ public final class FlagCommand extends Command {
} }
private static boolean sendMessage(PlotPlayer player, Captions message, Object... args) { private static boolean sendMessage(PlotPlayer player, Captions message, Object... args) {
message.send(player, args); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot flag <set | remove | add | list | info> <flag> <value>")
);
return true; return true;
} }
@ -126,10 +130,12 @@ public final class FlagCommand extends Command {
} }
} }
} catch (final FlagParseException e) { } catch (final FlagParseException e) {
MainUtil.sendMessage(player, player.sendMessage(
Captions.FLAG_PARSE_ERROR.getTranslated().replace("%flag_name%", flag.getName()) TranslatableCaption.of("flag.flag_parse_error"),
.replace("%flag_value%", e.getValue()) Template.of("flag_name", flag.getName()),
.replace("%error%", e.getErrorMessage())); Template.of("flag_value", e.getValue()),
Template.of("error", e.getErrorMessage())
);
return false; return false;
} catch (final Exception e) { } catch (final Exception e) {
return false; return false;
@ -163,8 +169,10 @@ public final class FlagCommand extends Command {
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_SET_FLAG_OTHER)) { .hasPermission(player, Captions.PERMISSION_SET_FLAG_OTHER)) {
MainUtil player.sendMessage(
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG_OTHER); TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.set.flag.other")
);
return false; return false;
} }
return true; return true;
@ -190,12 +198,15 @@ public final class FlagCommand extends Command {
GlobalFlagContainer.getInstance().getFlagMap().values()); GlobalFlagContainer.getInstance().getFlagMap().values());
final String best = stringComparison.getBestMatch(); final String best = stringComparison.getBestMatch();
if (best != null) { if (best != null) {
MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG_SUGGESTED, best); player.sendMessage(
TranslatableCaption.of("flag.not_valid_flag_suggested"),
Template.of("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) {
MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG); player.sendMessage(TranslatableCaption.of("flag.not_valid_flag"));
} }
return null; return null;
} }
@ -289,7 +300,10 @@ public final class FlagCommand extends Command {
return; return;
} }
if (args.length < 2) { if (args.length < 2) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag set <flag> <value>"); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot flag set <flag> <value>")
);
return; return;
} }
final PlotFlag<?, ?> plotFlag = getFlag(player, args[0]); final PlotFlag<?, ?> plotFlag = getFlag(player, args[0]);
@ -313,13 +327,19 @@ public final class FlagCommand extends Command {
try { try {
parsed = plotFlag.parse(value); parsed = plotFlag.parse(value);
} catch (final FlagParseException e) { } catch (final FlagParseException e) {
MainUtil.sendMessage(player, player.sendMessage(
Captions.FLAG_PARSE_ERROR.getTranslated().replace("%flag_name%", plotFlag.getName()) TranslatableCaption.of("")
.replace("%flag_value%", e.getValue()).replace("%error%", e.getErrorMessage())); );
player.sendMessage(
TranslatableCaption.of("flag.flag_parse_error"),
Template.of("flag_name", plotFlag.getName()),
Template.of("flag_value", e.getValue()),
Template.of("error", e.getErrorMessage())
);
return; return;
} }
plot.setFlag(parsed); plot.setFlag(parsed);
MainUtil.sendMessage(player, Captions.FLAG_ADDED); player.sendMessage(TranslatableCaption.of("flag.flag_added"));
} }
@CommandDeclaration(command = "add", @CommandDeclaration(command = "add",
@ -336,7 +356,10 @@ public final class FlagCommand extends Command {
return; return;
} }
if (args.length < 2) { if (args.length < 2) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag add <flag> <values>"); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot flag add <flag> <values>")
);
return; return;
} }
final PlotFlag<?, ?> plotFlag = getFlag(player, args[0]); final PlotFlag<?, ?> plotFlag = getFlag(player, args[0]);
@ -366,18 +389,21 @@ public final class FlagCommand extends Command {
try { try {
parsed = event.getFlag().parse(value); parsed = event.getFlag().parse(value);
} catch (FlagParseException e) { } catch (FlagParseException e) {
MainUtil.sendMessage(player, player.sendMessage(
Captions.FLAG_PARSE_ERROR.getTranslated().replace("%flag_name%", plotFlag.getName()) TranslatableCaption.of("flag.flag_parse_error"),
.replace("%flag_value%", e.getValue()).replace("%error%", e.getErrorMessage())); Template.of("flag_name", plotFlag.getName()),
Template.of("flag_value", e.getValue()),
Template.of("error", e.getErrorMessage())
);
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) {
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED); player.sendMessage(TranslatableCaption.of("flag.flag_not_added"));
return; return;
} }
MainUtil.sendMessage(player, Captions.FLAG_ADDED); player.sendMessage(TranslatableCaption.of("flag.flag_added"));
} }
@CommandDeclaration(command = "remove", @CommandDeclaration(command = "remove",
@ -394,8 +420,10 @@ public final class FlagCommand extends Command {
return; return;
} }
if (args.length != 1 && args.length != 2) { if (args.length != 1 && args.length != 2) {
MainUtil player.sendMessage(
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag remove <flag> [values]"); TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot flag remove <flag> [values]")
);
return; return;
} }
PlotFlag<?, ?> flag = getFlag(player, args[0]); PlotFlag<?, ?> flag = getFlag(player, args[0]);
@ -431,23 +459,25 @@ public final class FlagCommand extends Command {
try { try {
parsedFlag = listFlag.parse(value); parsedFlag = listFlag.parse(value);
} catch (final FlagParseException e) { } catch (final FlagParseException e) {
MainUtil.sendMessage(player, player.sendMessage(
Captions.FLAG_PARSE_ERROR.getTranslated().replace("%flag_name%", flag.getName()) TranslatableCaption.of("flag.flag_parse_error"),
.replace("%flag_value%", e.getValue()) Template.of("flag_name", flag.getName()),
.replace("%error%", e.getErrorMessage())); Template.of("flag_value", e.getValue()),
Template.of("error", e.getErrorMessage())
);
return; return;
} }
if (((List) parsedFlag.getValue()).isEmpty()) { if (((List) parsedFlag.getValue()).isEmpty()) {
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); player.sendMessage(TranslatableCaption.of("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)) {
MainUtil.sendMessage(player, Captions.FLAG_REMOVED); player.sendMessage(TranslatableCaption.of("flag.flag_removed"));
return; return;
} else { } else {
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
return; return;
} }
} else { } else {
@ -455,30 +485,32 @@ public final class FlagCommand extends Command {
PlotFlag plotFlag = parsedFlag.createFlagInstance(list); PlotFlag plotFlag = parsedFlag.createFlagInstance(list);
PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot);
if (addEvent.getEventResult() == Result.DENY) { if (addEvent.getEventResult() == Result.DENY) {
sendMessage(player, Captions.EVENT_DENIED, player.sendMessage(
"Re-addition of " + plotFlag.getName()); TranslatableCaption.of("events.event_denied"),
Template.of("value", "Re-addition of " + plotFlag.getName())
);
return; return;
} }
if (plot.setFlag(addEvent.getFlag())) { if (plot.setFlag(addEvent.getFlag())) {
MainUtil.sendMessage(player, Captions.FLAG_PARTIALLY_REMOVED); player.sendMessage(TranslatableCaption.of("flag.flag_partially_removed"));
return; return;
} else { } else {
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
return; return;
} }
} }
} else { } else {
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
return; return;
} }
} else { } else {
boolean result = plot.removeFlag(flag); boolean result = plot.removeFlag(flag);
if (!result) { if (!result) {
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED); player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
return; return;
} }
} }
MainUtil.sendMessage(player, Captions.FLAG_REMOVED); player.sendMessage(TranslatableCaption.of("flag.flag_removed"));
} }
@CommandDeclaration(command = "list", @CommandDeclaration(command = "list",
@ -540,12 +572,15 @@ public final class FlagCommand extends Command {
return; return;
} }
if (args.length < 1) { if (args.length < 1) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag info <flag>"); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("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) {
Captions.FLAG_INFO_HEADER.send(player); player.sendMessage(TranslatableCaption.of("flag.flag_info_header"));
// Flag name // Flag name
new PlotMessage(Captions.FLAG_INFO_NAME.getTranslated()) new PlotMessage(Captions.FLAG_INFO_NAME.getTranslated())
.color(Captions.FLAG_INFO_COLOR_KEY.getTranslated()).text(plotFlag.getName()) .color(Captions.FLAG_INFO_COLOR_KEY.getTranslated()).text(plotFlag.getName())
@ -574,7 +609,7 @@ public final class FlagCommand extends Command {
.color(Captions.FLAG_INFO_COLOR_KEY.getTranslated()).text(defaultValue) .color(Captions.FLAG_INFO_COLOR_KEY.getTranslated()).text(defaultValue)
.color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()).send(player); .color(Captions.FLAG_INFO_COLOR_VALUE.getTranslated()).send(player);
// 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
MainUtil.sendMessage(player, "&r" + Captions.FLAG_INFO_FOOTER.getTranslated()); player.sendMessage(TranslatableCaption.of("flag.flag_info_footer"));
} }
} }

View File

@ -26,6 +26,7 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
@ -114,7 +115,7 @@ public class Help extends Command {
Captions.HELP_INFO_ITEM.getTranslated().replaceAll("%category%", "all") Captions.HELP_INFO_ITEM.getTranslated().replaceAll("%category%", "all")
.replaceAll("%category_desc%", "Display all commands")); .replaceAll("%category_desc%", "Display all commands"));
builder.append("\n").append(Captions.HELP_FOOTER.getTranslated()); builder.append("\n").append(Captions.HELP_FOOTER.getTranslated());
MainUtil.sendMessage(player, builder.toString(), false); player.sendMessage(StaticCaption.of(builder.toString()));
return true; return true;
} }
new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages() new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages()

View File

@ -52,7 +52,7 @@ import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "home", @CommandDeclaration(command = "home",
description = "Teleport to your plot(s)", description = "Teleport to your plot(s)",
permission = "plots.home", permission = "plots.home",
usage = "/plot home [<page>|<alias>|<area;x;y>|<area> <x;y>|<area> <page>]", usage = "/plot home [<page> | <alias> | <area;x;y> | <area> <x;y> | <area> <page>]",
aliases = {"h"}, aliases = {"h"},
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
category = CommandCategory.TELEPORT) category = CommandCategory.TELEPORT)

View File

@ -121,9 +121,10 @@ public class Inbox extends SubCommand {
} else { } else {
color = ""; color = "";
} }
sendMessage(player, Captions.INBOX_ITEM, player.sendMessage(
color + inbox.toString() + " (" + total + '/' + unread TranslatableCaption.of("comment.inbox_item"),
+ ')'); Template.of("value", color + inbox.toString() + " (" + total + '/' + unread + ')')
);
return; return;
} }
} }
@ -144,8 +145,10 @@ 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) {
sendMessage(player, Captions.INVALID_INBOX, player.sendMessage(
StringMan.join(CommentManager.inboxes.keySet(), ", ")); TranslatableCaption.of("comment.invalid_inbox"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), ", "))
);
return false; return false;
} }
player.setMeta("inbox:" + inbox.toString(), System.currentTimeMillis()); player.setMeta("inbox:" + inbox.toString(), System.currentTimeMillis());

View File

@ -27,6 +27,7 @@ package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
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.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
@ -100,7 +101,7 @@ public class Info extends SubCommand {
.hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.getTranslated())) { .hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.getTranslated())) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_INFO_FORCE.getTranslated()) Template.of("node", "plots.area.info.force")
); );
return true; return true;
} }
@ -132,13 +133,11 @@ public class Info extends SubCommand {
info = getCaption(arg); info = getCaption(arg);
if (info == null) { if (info == null) {
if (Settings.Ratings.USE_LIKES) { if (Settings.Ratings.USE_LIKES) {
MainUtil.sendMessage(player, player.sendMessage(StaticCaption.of("&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
"&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, " + "&aowner&7, " + " &alikes"));
+ "&aowner&7, " + " &alikes");
} else { } else {
MainUtil.sendMessage(player, player.sendMessage(StaticCaption.of("&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
"&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, " + "&aowner&7, " + " &arating"));
+ "&aowner&7, " + " &arating");
} }
return false; return false;
} }

View File

@ -38,6 +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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.Collection; import java.util.Collection;
@ -51,7 +52,7 @@ import java.util.concurrent.TimeoutException;
aliases = "k", aliases = "k",
description = "Kick a player from your plot", description = "Kick a player from your plot",
permission = "plots.kick", permission = "plots.kick",
usage = "/plot kick <player|*>", usage = "/plot kick <player | *>",
category = CommandCategory.TELEPORT, category = CommandCategory.TELEPORT,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)
public class Kick extends SubCommand { public class Kick extends SubCommand {
@ -75,15 +76,18 @@ public class Kick extends SubCommand {
} }
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_KICK)) { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_KICK)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("permission.no_permission"));
return false; return false;
} }
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT); player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
} else if (throwable != null || uuids.isEmpty()) { } else if (throwable != null || uuids.isEmpty()) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
);
} else { } else {
Set<PlotPlayer<?>> players = new HashSet<>(); Set<PlotPlayer<?>> players = new HashSet<>();
for (UUID uuid : uuids) { for (UUID uuid : uuids) {
@ -104,20 +108,29 @@ 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()) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
);
return; return;
} }
for (PlotPlayer<?> player2 : players) { for (PlotPlayer<?> player2 : players) {
if (!plot.equals(player2.getCurrentPlot())) { if (!plot.equals(player2.getCurrentPlot())) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
);
return; return;
} }
if (Permissions.hasPermission(player2, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) { if (Permissions.hasPermission(player2, Captions.PERMISSION_ADMIN_ENTRY_DENIED)) {
Captions.CANNOT_KICK_PLAYER.send(player, player2.getName()); player.sendMessage(
TranslatableCaption.of("cluster.cannot_kick_player"),
Template.of("name", player2.getName())
);
return; return;
} }
Location spawn = this.worldUtil.getSpawn(location.getWorldName()); Location spawn = this.worldUtil.getSpawn(location.getWorldName());
Captions.YOU_GOT_KICKED.send(player2); player.sendMessage(TranslatableCaption.of("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

@ -27,11 +27,13 @@ package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
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.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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.UUID; import java.util.UUID;
@ -72,9 +74,15 @@ public class Leave extends Command {
if (plot.removeMember(uuid)) { if (plot.removeMember(uuid)) {
this.eventDispatcher.callMember(player, plot, uuid, false); this.eventDispatcher.callMember(player, plot, uuid, false);
} }
MainUtil.sendMessage(player, Captions.PLOT_LEFT, player.getName()); player.sendMessage(
TranslatableCaption.of("member.plot_left"),
Template.of("player", player.getName())
);
} else { } else {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, 1); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", String.valueOf(1))
);
} }
} }
return CompletableFuture.completedFuture(true); return CompletableFuture.completedFuture(true);

View File

@ -40,6 +40,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.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
@ -51,7 +52,7 @@ import java.util.UUID;
@CommandDeclaration(command = "like", @CommandDeclaration(command = "like",
permission = "plots.like", permission = "plots.like",
description = "Like the plot", description = "Like the plot",
usage = "/plot like [next|purge]", usage = "/plot like [next | purge]",
category = CommandCategory.INFO, category = CommandCategory.INFO,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)
public class Like extends SubCommand { public class Like extends SubCommand {
@ -82,11 +83,11 @@ public class Like extends SubCommand {
.isBasePlot() && (!plot.getLikes().containsKey(uuid))) { .isBasePlot() && (!plot.getLikes().containsKey(uuid))) {
plot.teleportPlayer(player, TeleportCause.COMMAND, result -> { plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
}); });
MainUtil.sendMessage(player, Captions.RATE_THIS); player.sendMessage(TranslatableCaption.of("tutorial.rate_this"));
return true; return true;
} }
} }
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS); player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
return true; return true;
} }
case "purge": { case "purge": {
@ -100,7 +101,7 @@ public class Like extends SubCommand {
return false; return false;
} }
plot.clearRatings(); plot.clearRatings();
Captions.RATINGS_PURGED.send(player); player.sendMessage(TranslatableCaption.of("ratings.ratings_purged"));
return true; return true;
} }
} }
@ -111,21 +112,24 @@ public class Like extends SubCommand {
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
sendMessage(player, Captions.RATING_NOT_OWNED); player.sendMessage(TranslatableCaption.of("ratings.rating_not_owned"));
return false; return false;
} }
if (plot.isOwner(player.getUUID())) { if (plot.isOwner(player.getUUID())) {
sendMessage(player, Captions.RATING_NOT_YOUR_OWN); player.sendMessage(TranslatableCaption.of("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)) {
sendMessage(player, Captions.RATING_NOT_DONE); player.sendMessage(TranslatableCaption.of("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) {
sendMessage(player, Captions.RATING_ALREADY_EXISTS, plot.getId().toString()); player.sendMessage(
TranslatableCaption.of("ratings.rating_already_exists"),
Template.of("value", plot.getId().toString())
);
return; return;
} }
final int rating; final int rating;
@ -140,9 +144,15 @@ public class Like extends SubCommand {
if (event.getRating() != null) { if (event.getRating() != null) {
plot.addRating(uuid, event.getRating()); plot.addRating(uuid, event.getRating());
if (like) { if (like) {
sendMessage(player, Captions.RATING_LIKED, plot.getId().toString()); player.sendMessage(
TranslatableCaption.of("ratings.rating_liked"),
Template.of("plot", plot.getId().toString())
);
} else { } else {
sendMessage(player, Captions.RATING_DISLIKED, plot.getId().toString()); player.sendMessage(
TranslatableCaption.of("ratings.rating_disliked"),
Template.of("plot", plot.getId().toString())
);
} }
} }
}; };

View File

@ -48,6 +48,7 @@ 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.query.SortingStrategy; import com.plotsquared.core.util.query.SortingStrategy;
import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -70,7 +71,7 @@ import java.util.stream.Collectors;
description = "List plots", description = "List plots",
permission = "plots.list", permission = "plots.list",
category = CommandCategory.INFO, category = CommandCategory.INFO,
usage = "/plot list <forsale|mine|shared|world|top|all|unowned|player|world|done|fuzzy <search...>> [#]") usage = "/plot list <forsale | mine | shared | world | top | all | unowned | player | world | done | fuzzy <search...>> [#]")
public class ListCmd extends SubCommand { public class ListCmd extends SubCommand {
private final PlotAreaManager plotAreaManager; private final PlotAreaManager plotAreaManager;
@ -158,9 +159,11 @@ public class ListCmd extends SubCommand {
final Consumer<PlotQuery> plotConsumer = query -> { final Consumer<PlotQuery> plotConsumer = query -> {
if (query == null) { if (query == null) {
sendMessage(player, Captions.DID_YOU_MEAN, player.sendMessage(
new StringComparison<>(args[0], new String[] {"mine", "shared", "world", "all"}) TranslatableCaption.of("commandconfig.did_you_mean"),
.getBestMatch()); Template.of("value", new StringComparison<>(args[0], new String[] {"mine", "shared", "world", "all"})
.getBestMatch())
);
return; return;
} }

View File

@ -28,6 +28,7 @@ package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
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.Plot; import com.plotsquared.core.plot.Plot;
@ -39,6 +40,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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.net.MalformedURLException; import java.net.MalformedURLException;
@ -74,16 +76,16 @@ public class Load extends SubCommand {
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_LOAD)) { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_LOAD)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return false; return false;
} }
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
return false; return false;
} }
@ -92,7 +94,7 @@ public class Load extends SubCommand {
List<String> schematics = player.getMeta("plot_schematics"); List<String> schematics = player.getMeta("plot_schematics");
if (schematics == null) { if (schematics == null) {
// No schematics found: // No schematics found:
MainUtil.sendMessage(player, Captions.LOAD_NULL); player.sendMessage(TranslatableCaption.of("web.load_null"));
return false; return false;
} }
String schematic; String schematic;
@ -100,8 +102,10 @@ public class Load extends SubCommand {
schematic = schematics.get(Integer.parseInt(args[0]) - 1); schematic = schematics.get(Integer.parseInt(args[0]) - 1);
} catch (Exception ignored) { } catch (Exception ignored) {
// use /plot load <index> // use /plot load <index>
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, player.sendMessage(
"(1, " + schematics.size() + ')'); TranslatableCaption.of("invalid.not_valid_number"),
Template.of("value", "(1, " + schematics.size() + ')')
);
return false; return false;
} }
final URL url; final URL url;
@ -109,17 +113,19 @@ 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();
MainUtil.sendMessage(player, Captions.LOAD_FAILED); player.sendMessage(TranslatableCaption.of("web.load_failed"));
return false; return false;
} }
plot.addRunning(); plot.addRunning();
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT); player.sendMessage(TranslatableCaption.of("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();
sendMessage(player, Captions.SCHEMATIC_INVALID, player.sendMessage(
"non-existent or not in gzip format"); TranslatableCaption.of("schematics.schematic_invalid"),
Template.of("reason", "non-existent or not in gzip format")
);
return; return;
} }
PlotArea area = plot.getArea(); PlotArea area = plot.getArea();
@ -128,9 +134,9 @@ public class Load extends SubCommand {
@Override public void run(Boolean value) { @Override public void run(Boolean value) {
plot.removeRunning(); plot.removeRunning();
if (value) { if (value) {
sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS); player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
} else { } else {
sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED); player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed"));
} }
} }
}); });
@ -138,7 +144,10 @@ public class Load extends SubCommand {
return true; return true;
} }
plot.removeRunning(); plot.removeRunning();
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot load <index>"); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot load <index>")
);
return false; return false;
} }
@ -151,7 +160,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()) {
MainUtil.sendMessage(player, Captions.LOAD_FAILED); player.sendMessage(TranslatableCaption.of("web.load_failed"));
return; return;
} }
player.setMeta("plot_schematics", schematics1); player.setMeta("plot_schematics", schematics1);
@ -177,15 +186,14 @@ public class Load extends SubCommand {
String world = split[1]; String world = split[1];
PlotId id = PlotId.fromString(split[2] + ';' + split[3]); PlotId id = PlotId.fromString(split[2] + ';' + split[3]);
String size = split[4]; String size = split[4];
String color = "$4"; String color = "<dark_aqua>";
MainUtil.sendMessage(player, player.sendMessage(StaticCaption.of("<dark_gray>[</dark_gray><gray>" + (i + 1) + "</gray><dark_aqua>] </dark_aqua>" + color + time + "<dark_gray> | </dark_gray>" + color + world + ';' + id
"$3[$2" + (i + 1) + "$3] " + color + time + "$3 | " + color + world + ';' + id + "<dark_gray> | </dark_gray>" + color + size + 'x' + size));
+ "$3 | " + color + size + 'x' + size);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
MainUtil.sendMessage(player, Captions.LOAD_LIST); player.sendMessage(TranslatableCaption.of("web.load_list"));
} }
public String secToTime(long time) { public String secToTime(long time) {

View File

@ -52,7 +52,7 @@ import java.util.UUID;
aliases = "m", aliases = "m",
description = "Merge the plot you are standing on with another plot", description = "Merge the plot you are standing on with another plot",
permission = "plots.merge", permission = "plots.merge",
usage = "/plot merge <all|n|e|s|w> [removeroads]", usage = "/plot merge <all | n | e | s | w> [removeroads]",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
confirmation = true) confirmation = true)
@ -100,7 +100,7 @@ public class Merge extends SubCommand {
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false; return false;
} }
Direction direction = null; Direction direction = null;
@ -132,10 +132,14 @@ public class Merge extends SubCommand {
} }
} }
if (direction == null) { if (direction == null) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, player.sendMessage(
"/plot merge <" + StringMan.join(values, "|") + "> [removeroads]"); TranslatableCaption.of("commandconfig.command_syntax"),
MainUtil.sendMessage(player, Captions.DIRECTION.getTranslated() Template.of("value", "/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]")
.replaceAll("%dir%", direction(location.getYaw()))); );
player.sendMessage(
TranslatableCaption.of("help.direction"),
Template.of("dir", direction(location.getYaw()))
);
return false; return false;
} }
final int size = plot.getConnectedPlots().size(); final int size = plot.getConnectedPlots().size();
@ -153,7 +157,10 @@ public class Merge extends SubCommand {
final int maxSize = event.getMax(); final int maxSize = event.getMax();
if (!force && size - 1 > maxSize) { if (!force && size - 1 > maxSize) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, "plots.merge." + (size + 1)); player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.merge." + (size + 1))
);
return false; return false;
} }
final PlotArea plotArea = plot.getArea(); final PlotArea plotArea = plot.getArea();
@ -168,24 +175,29 @@ public class Merge extends SubCommand {
} }
if (!force && !terrain && !Permissions if (!force && !terrain && !Permissions
.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { .hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, player.sendMessage(
Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.merge.keeproad")
);
return true; return true;
} }
if (plot.autoMerge(Direction.ALL, maxSize, uuid, terrain)) { if (plot.autoMerge(Direction.ALL, maxSize, uuid, terrain)) {
if (this.econHandler != null && plotArea.useEconomy() && price > 0d) { if (this.econHandler != null && plotArea.useEconomy() && price > 0d) {
this.econHandler.withdrawMoney(player, price); this.econHandler.withdrawMoney(player, price);
sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price)); player.sendMessage(
TranslatableCaption.of("economy.removed_balance"),
Template.of("money", String.valueOf(price))
);
} }
MainUtil.sendMessage(player, Captions.SUCCESS_MERGE); player.sendMessage(TranslatableCaption.of("merge.success_merge"));
return true; return true;
} }
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE); player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
return false; return false;
} }
if (!force && !plot.isOwner(uuid)) { if (!force && !plot.isOwner(uuid)) {
if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_MERGE)) { if (!Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_MERGE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return false; return false;
} else { } else {
uuid = plot.getOwnerAbs(); uuid = plot.getOwnerAbs();
@ -193,7 +205,10 @@ public class Merge extends SubCommand {
} }
if (!force && this.econHandler != null && plotArea.useEconomy() && price > 0d if (!force && this.econHandler != null && plotArea.useEconomy() && price > 0d
&& this.econHandler.getMoney(player) < price) { && this.econHandler.getMoney(player) < price) {
sendMessage(player, Captions.CANNOT_AFFORD_MERGE, String.valueOf(price)); player.sendMessage(
TranslatableCaption.of("economy.cannot_afford_merge"),
Template.of("money", String.valueOf(price))
);
return false; return false;
} }
final boolean terrain; final boolean terrain;
@ -204,26 +219,34 @@ public class Merge extends SubCommand {
} }
if (!force && !terrain && !Permissions if (!force && !terrain && !Permissions
.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) { .hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, player.sendMessage(
Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated()); TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.merge.keeproad")
);
return true; return true;
} }
if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) { if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) {
if (this.econHandler != null && plotArea.useEconomy() && price > 0d) { if (this.econHandler != null && plotArea.useEconomy() && price > 0d) {
this.econHandler.withdrawMoney(player, price); this.econHandler.withdrawMoney(player, price);
sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price)); player.sendMessage(
TranslatableCaption.of("economy.removed_balance"),
Template.of("money", String.valueOf(price))
);
} }
MainUtil.sendMessage(player, Captions.SUCCESS_MERGE); player.sendMessage(TranslatableCaption.of("success_merge"));
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
.getMerged((direction.getIndex() + 2) % 4) || (!force && adjacent.isOwner(uuid))) { .getMerged((direction.getIndex() + 2) % 4) || (!force && adjacent.isOwner(uuid))) {
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE); player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
return false; return false;
} }
if (!force && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_OTHER)) { if (!force && !Permissions.hasPermission(player, Captions.PERMISSION_MERGE_OTHER)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_MERGE_OTHER); player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.merge.other")
);
return false; return false;
} }
java.util.Set<UUID> uuids = adjacent.getOwners(); java.util.Set<UUID> uuids = adjacent.getOwners();
@ -236,22 +259,28 @@ public class Merge extends SubCommand {
isOnline = true; isOnline = true;
final Direction dir = direction; final Direction dir = direction;
Runnable run = () -> { Runnable run = () -> {
MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED); accepter.sendMessage(TranslatableCaption.of("merge.merge_accepted"));
plot.autoMerge(dir, maxSize - size, owner, terrain); plot.autoMerge(dir, maxSize - size, owner, terrain);
PlotPlayer plotPlayer = PlotSquared.platform().getPlayerManager().getPlayerIfExists(player.getUUID()); PlotPlayer plotPlayer = PlotSquared.platform().getPlayerManager().getPlayerIfExists(player.getUUID());
if (plotPlayer == null) { if (plotPlayer == null) {
sendMessage(accepter, Captions.MERGE_NOT_VALID); accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid"));
return; return;
} }
if (this.econHandler != null && plotArea.useEconomy() && price > 0d) { if (this.econHandler != null && plotArea.useEconomy() && price > 0d) {
if (!force && this.econHandler.getMoney(player) < price) { if (!force && this.econHandler.getMoney(player) < price) {
sendMessage(player, Captions.CANNOT_AFFORD_MERGE, String.valueOf(price)); player.sendMessage(
TranslatableCaption.of("economy.cannot_afford_merge"),
Template.of("money", String.valueOf(price))
);
return; return;
} }
this.econHandler.withdrawMoney(player, price); this.econHandler.withdrawMoney(player, price);
sendMessage(player, Captions.REMOVED_BALANCE, String.valueOf(price)); player.sendMessage(
TranslatableCaption.of("economy.removed_balance"),
Template.of("money", String.valueOf(price))
);
} }
MainUtil.sendMessage(player, Captions.SUCCESS_MERGE); player.sendMessage(TranslatableCaption.of("merge.success_merge"));
}; };
if (!force && hasConfirmation(player)) { if (!force && hasConfirmation(player)) {
CmdConfirm.addPending(accepter, Captions.MERGE_REQUEST_CONFIRM.getTranslated() CmdConfirm.addPending(accepter, Captions.MERGE_REQUEST_CONFIRM.getTranslated()
@ -261,10 +290,10 @@ public class Merge extends SubCommand {
} }
} }
if (!force && !isOnline) { if (!force && !isOnline) {
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE); player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
return false; return false;
} }
MainUtil.sendMessage(player, Captions.MERGE_REQUESTED); player.sendMessage(TranslatableCaption.of("merge.merge_requested"));
return true; return true;
} }
} }

View File

@ -36,6 +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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -66,7 +67,7 @@ public class Move extends SubCommand {
} }
if (!plot1.isOwner(player.getUUID()) && !Permissions if (!plot1.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
boolean override = false; boolean override = false;
@ -89,27 +90,30 @@ public class Move extends SubCommand {
plot2 = area.getPlotAbs(plot1.getId()); plot2 = area.getPlotAbs(plot1.getId());
} }
if (plot1.equals(plot2)) { if (plot1.equals(plot2)) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID); player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot copy <X;Z>"); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot copy <X;Z>")
);
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, Captions.PERMISSION_ADMIN.getTranslated()))) { .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated()))) {
Captions.PLOTWORLD_INCOMPATIBLE.send(player); player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (plot1.isMerged() || plot2.isMerged()) { if (plot1.isMerged() || plot2.isMerged()) {
Captions.MOVE_MERGED.send(player); player.sendMessage(TranslatableCaption.of("move.move_merged"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
return plot1.move(plot2, () -> { return plot1.move(plot2, () -> {
}, false).thenApply(result -> { }, false).thenApply(result -> {
if (result) { if (result) {
MainUtil.sendMessage(player, Captions.MOVE_SUCCESS); player.sendMessage(TranslatableCaption.of("move.move_success"));
return true; return true;
} else { } else {
MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED); player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
return false; return false;
} }
}); });

View File

@ -26,7 +26,6 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions;
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;
@ -74,7 +73,7 @@ public class Music extends SubCommand {
return false; return false;
} }
if (!plot.isAdded(player.getUUID())) { if (!plot.isAdded(player.getUUID())) {
sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return true; return true;
} }
PlotInventory inv = new PlotInventory(this.inventoryUtil, player, 2, "Plot Jukebox") { PlotInventory inv = new PlotInventory(this.inventoryUtil, player, 2, "Plot Jukebox") {
@ -94,7 +93,7 @@ public class Music extends SubCommand {
return true; return true;
} }
plot.removeFlag(event.getFlag()); plot.removeFlag(event.getFlag());
Captions.FLAG_REMOVED.send(player); player.sendMessage(TranslatableCaption.of("flag.flag_removed"));
} else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) { } else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) {
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class) PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class)
.createFlagInstance(item.getType()); .createFlagInstance(item.getType());
@ -106,9 +105,9 @@ public class Music extends SubCommand {
return true; return true;
} }
plot.setFlag(event.getFlag()); plot.setFlag(event.getFlag());
Captions.FLAG_ADDED.send(player); player.sendMessage(TranslatableCaption.of("flag.flag_added"));
} else { } else {
Captions.FLAG_NOT_ADDED.send(player); player.sendMessage(TranslatableCaption.of("flag.flag_not_added"));
} }
return false; return false;
} }

View File

@ -26,11 +26,13 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
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.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 java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -50,7 +52,10 @@ public class Near extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException { RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT); final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
Captions.PLOT_NEAR.send(player, StringMan.join(plot.getPlayersInPlot(), ", ")); player.sendMessage(
TranslatableCaption.of("near.plot_near"),
Template.of("list", StringMan.join(plot.getPlayersInPlot(), ", "))
);
return CompletableFuture.completedFuture(true); return CompletableFuture.completedFuture(true);
} }
} }

View File

@ -65,7 +65,11 @@ public class Owner extends SetCommand {
@Override public boolean set(final PlotPlayer player, final Plot plot, String value) { @Override public boolean set(final PlotPlayer player, final Plot plot, String value) {
if (value == null || value.isEmpty()) { if (value == null || value.isEmpty()) {
Captions.SET_OWNER_MISSING_PLAYER.send(player); player.sendMessage(TranslatableCaption.of("owner.set_owner_missing_player"));
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot setowner <owner>")
);
return false; return false;
} }
Set<Plot> plots = plot.getConnectedPlots(); Set<Plot> plots = plot.getConnectedPlots();
@ -73,7 +77,10 @@ public class Owner extends SetCommand {
final Consumer<UUID> uuidConsumer = uuid -> { final Consumer<UUID> uuidConsumer = uuid -> {
if (uuid == null && !value.equalsIgnoreCase("none") && !value.equalsIgnoreCase("null") if (uuid == null && !value.equalsIgnoreCase("none") && !value.equalsIgnoreCase("null")
&& !value.equalsIgnoreCase("-")) { && !value.equalsIgnoreCase("-")) {
Captions.INVALID_PLAYER.send(player, value); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", value)
);
return; return;
} }
PlotChangeOwnerEvent event = this.eventDispatcher.callOwnerChange(player, plot, plot.hasOwner() ? plot.getOwnerAbs() : null, uuid, PlotChangeOwnerEvent event = this.eventDispatcher.callOwnerChange(player, plot, plot.hasOwner() ? plot.getOwnerAbs() : null, uuid,
@ -105,18 +112,24 @@ public class Owner extends SetCommand {
current.unclaim(); current.unclaim();
current.removeSign(); current.removeSign();
} }
MainUtil.sendMessage(player, Captions.SET_OWNER); player.sendMessage(TranslatableCaption.of("owner.set_owner"));
return; return;
} }
final PlotPlayer<?> other = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); final PlotPlayer<?> other = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if (plot.isOwner(uuid)) { if (plot.isOwner(uuid)) {
Captions.ALREADY_OWNER.send(player, PlayerManager.getName(uuid)); player.sendMessage(
TranslatableCaption.of("member.already_owner"),
Template.of("player", PlayerManager.getName(uuid))
);
return; return;
} }
if (!force && !Permissions if (!force && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER)) { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SET_OWNER)) {
if (other == null) { if (other == null) {
Captions.INVALID_PLAYER_OFFLINE.send(player, value); player.sendMessage(
TranslatableCaption.of("invalid_player_offline"),
Template.of("player", PlayerManager.getName(uuid))
);
return; return;
} }
int size = plots.size(); int size = plots.size();
@ -124,7 +137,7 @@ public class Owner extends SetCommand {
other.getPlotCount() : other.getPlotCount() :
other.getPlotCount(plot.getWorldName())) + size; other.getPlotCount(plot.getWorldName())) + size;
if (currentPlots > other.getAllowedPlots()) { if (currentPlots > other.getAllowedPlots()) {
sendMessage(player, Captions.CANT_TRANSFER_MORE_PLOTS); player.sendMessage(TranslatableCaption.of("permission.cant_transfer_more_plots"));
return; return;
} }
} }
@ -136,13 +149,15 @@ public class Owner extends SetCommand {
if (removeDenied) if (removeDenied)
plot.removeDenied(finalUUID); plot.removeDenied(finalUUID);
plot.setSign(finalName); plot.setSign(finalName);
MainUtil.sendMessage(player, Captions.SET_OWNER); player.sendMessage(TranslatableCaption.of("owner.set_owner"));
if (other != null) { if (other != null) {
MainUtil.sendMessage(other, Captions.NOW_OWNER, other.sendMessage(
plot.getArea() + ";" + plot.getId()); TranslatableCaption.of("owner.now_owner"),
Template.of("plot", plot.getArea() + ";" + plot.getId())
);
} }
} else { } else {
MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED); player.sendMessage(TranslatableCaption.of("owner.set_owner_cancelled"));
} }
}; };
if (hasConfirmation(player)) { if (hasConfirmation(player)) {
@ -161,9 +176,12 @@ public class Owner extends SetCommand {
} else { } else {
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(value, (uuid, throwable) -> { PlotSquared.get().getImpromptuUUIDPipeline().getSingle(value, (uuid, throwable) -> {
if (throwable instanceof TimeoutException) { if (throwable instanceof TimeoutException) {
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT); player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
} else if (throwable != null) { } else if (throwable != null) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, value); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", value)
);
} else { } else {
uuidConsumer.accept(uuid); uuidConsumer.accept(uuid);
} }

View File

@ -26,9 +26,11 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
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;
@CommandDeclaration(command = "plugin", @CommandDeclaration(command = "plugin",
permission = "plots.use", permission = "plots.use",
@ -40,15 +42,16 @@ public class PluginCmd extends SubCommand {
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) { @Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
TaskManager.getPlatformImplementation().taskAsync(() -> { TaskManager.getPlatformImplementation().taskAsync(() -> {
MainUtil.sendMessage(player, String.format( player.sendMessage(
"$2>> $1&l" + PlotSquared.platform().getPluginName() + " $2($1Version$2: $1%s$2)", StaticCaption.of("<gray>>> </gray><gold><bold>" + PlotSquared.platform().getPluginName() + " <reset><gray>(<gold>Version</gold><gray>: </gray><gold><version></gold><gray>)</gray>"),
PlotSquared.get().getVersion())); Template.of("version", String.valueOf(PlotSquared.get().getVersion()))
MainUtil.sendMessage(player, );
"$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21 $2& $1NotMyFault $2& $1SirYwell"); 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>"));
MainUtil.sendMessage(player, player.sendMessage(StaticCaption.of("<gray> >> </gray><gold><bold>Wiki<reset><gray>: </gray><gold>https://wiki.intellectualsites.com/plotsquared/home</gold>"));
"$2>> $1&lWiki$2: $1https://wiki.intellectualsites.com/plotsquared/home"); player.sendMessage(
MainUtil StaticCaption.of("<gray> >> </gray><gold><bold>Premium<reset><gray>: <gold><value></gold>"),
.sendMessage(player, "$2>> $1&lPremium$2: $1" + PremiumVerification.isPremium()); Template.of("value", String.valueOf(PremiumVerification.isPremium()))
);
}); });
return true; return true;
} }

View File

@ -27,8 +27,8 @@ 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.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
@ -38,6 +38,7 @@ import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
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 org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -96,7 +97,10 @@ public class Purge extends SubCommand {
case "a": case "a":
area = this.plotAreaManager.getPlotAreaByString(split[1]); area = this.plotAreaManager.getPlotAreaByString(split[1]);
if (area == null) { if (area == null) {
Captions.NOT_VALID_PLOT_WORLD.send(player, split[1]); player.sendMessage(
TranslatableCaption.of("errors.not_valid_plot_world"),
Template.of("value", split[1])
);
return false; return false;
} }
break; break;
@ -105,7 +109,10 @@ public class Purge extends SubCommand {
try { try {
id = PlotId.fromString(split[1]); id = PlotId.fromString(split[1]);
} catch (IllegalArgumentException ignored) { } catch (IllegalArgumentException ignored) {
Captions.NOT_VALID_PLOT_ID.send(player, split[1]); player.sendMessage(
TranslatableCaption.of("invalid.not_valid_plot_id"),
Template.of("value", split[1])
);
return false; return false;
} }
break; break;
@ -113,7 +120,10 @@ public class Purge extends SubCommand {
case "o": case "o":
owner = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(split[1], Settings.UUID.BLOCKING_TIMEOUT); owner = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(split[1], Settings.UUID.BLOCKING_TIMEOUT);
if (owner == null) { if (owner == null) {
Captions.INVALID_PLAYER.send(player, split[1]); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", split[1])
);
return false; return false;
} }
break; break;
@ -121,7 +131,10 @@ public class Purge extends SubCommand {
case "s": case "s":
added = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(split[1], Settings.UUID.BLOCKING_TIMEOUT); added = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(split[1], Settings.UUID.BLOCKING_TIMEOUT);
if (added == null) { if (added == null) {
Captions.INVALID_PLAYER.send(player, split[1]); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", split[1])
);
return false; return false;
} }
break; break;
@ -179,7 +192,7 @@ public class Purge extends SubCommand {
} }
} }
if (toDelete.isEmpty()) { if (toDelete.isEmpty()) {
Captions.FOUND_NO_PLOTS.send(player); player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
return false; return false;
} }
String cmd = String cmd =
@ -225,7 +238,10 @@ public class Purge extends SubCommand {
} else { } else {
TaskManager.runTask(() -> { TaskManager.runTask(() -> {
DBFunc.purgeIds(ids); DBFunc.purgeIds(ids);
Captions.PURGE_SUCCESS.send(player, ids.size() + "/" + toDelete.size()); player.sendMessage(
TranslatableCaption.of("purge.purge_success"),
Template.of("amount", ids.size() + "/" + toDelete.size())
);
}); });
} }
} }

View File

@ -44,6 +44,7 @@ import com.plotsquared.core.util.InventoryUtil;
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.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
@ -54,7 +55,7 @@ import java.util.UUID;
@CommandDeclaration(command = "rate", @CommandDeclaration(command = "rate",
permission = "plots.rate", permission = "plots.rate",
description = "Rate the plot", description = "Rate the plot",
usage = "/plot rate [#|next|purge]", usage = "/plot rate [# | next | purge]",
aliases = "rt", aliases = "rt",
category = CommandCategory.INFO, category = CommandCategory.INFO,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)
@ -99,11 +100,11 @@ public class Rate extends SubCommand {
.isAdded(uuid)) { .isAdded(uuid)) {
p.teleportPlayer(player, TeleportCause.COMMAND, result -> { p.teleportPlayer(player, TeleportCause.COMMAND, result -> {
}); });
MainUtil.sendMessage(player, Captions.RATE_THIS); player.sendMessage(TranslatableCaption.of("tutorial.rate_this"));
return true; return true;
} }
} }
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS); player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
return false; return false;
} }
case "purge": { case "purge": {
@ -117,7 +118,7 @@ public class Rate extends SubCommand {
return false; return false;
} }
plot.clearRatings(); plot.clearRatings();
Captions.RATINGS_PURGED.send(player); player.sendMessage(TranslatableCaption.of("ratings.ratings_purged"));
return true; return true;
} }
} }
@ -128,23 +129,25 @@ public class Rate extends SubCommand {
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
sendMessage(player, Captions.RATING_NOT_OWNED); player.sendMessage(TranslatableCaption.of("ratings.rating_not_owned"));
return false; return false;
} }
if (plot.isOwner(player.getUUID())) { if (plot.isOwner(player.getUUID())) {
sendMessage(player, Captions.RATING_NOT_YOUR_OWN); player.sendMessage(TranslatableCaption.of("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)) {
sendMessage(player, Captions.RATING_NOT_DONE); player.sendMessage(TranslatableCaption.of("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()) {
final Runnable run = new Runnable() { final Runnable run = new Runnable() {
@Override public void run() { @Override public void run() {
if (plot.getRatings().containsKey(player.getUUID())) { if (plot.getRatings().containsKey(player.getUUID())) {
sendMessage(player, Captions.RATING_ALREADY_EXISTS, player.sendMessage(
plot.getId().toString()); TranslatableCaption.of("ratings.rating_already_exists"),
Template.of("plot", plot.getId().toString())
);
return; return;
} }
final MutableInt index = new MutableInt(0); final MutableInt index = new MutableInt(0);
@ -160,15 +163,19 @@ public class Rate extends SubCommand {
.callRating(this.player, plot, new Rating(rV)); .callRating(this.player, plot, new Rating(rV));
if (event.getRating() != null) { if (event.getRating() != null) {
plot.addRating(this.player.getUUID(), event.getRating()); plot.addRating(this.player.getUUID(), event.getRating());
sendMessage(this.player, Captions.RATING_APPLIED, player.sendMessage(
plot.getId().toString()); TranslatableCaption.of("ratings.rating_applied"),
Template.of("plot", plot.getId().toString())
);
if (Permissions if (Permissions
.hasPermission(this.player, Captions.PERMISSION_COMMENT)) { .hasPermission(this.player, Captions.PERMISSION_COMMENT)) {
Command command = Command command =
MainCommand.getInstance().getCommand(Comment.class); MainCommand.getInstance().getCommand(Comment.class);
if (command != null) { if (command != null) {
MainUtil.sendMessage(this.player, Captions.COMMENT_THIS, player.sendMessage(
command.getUsage()); TranslatableCaption.of("tutorial.comment_this"),
Template.of("plot", "/plot rate")
);
} }
} }
} }
@ -204,7 +211,7 @@ public class Rate extends SubCommand {
return true; return true;
} }
if (args.length < 1) { if (args.length < 1) {
sendMessage(player, Captions.RATING_NOT_VALID); player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid"));
return true; return true;
} }
String arg = args[0]; String arg = args[0];
@ -212,24 +219,30 @@ 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) {
sendMessage(player, Captions.RATING_NOT_VALID); player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid"));
return false; return false;
} }
} else { } else {
sendMessage(player, Captions.RATING_NOT_VALID); player.sendMessage(TranslatableCaption.of("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)) {
sendMessage(player, Captions.RATING_ALREADY_EXISTS, plot.getId().toString()); player.sendMessage(
TranslatableCaption.of("ratings.rating_already_exists"),
Template.of("value", plot.getId().toString())
);
return; return;
} }
PlotRateEvent event = PlotRateEvent event =
this.eventDispatcher.callRating(player, plot, new Rating(rating)); this.eventDispatcher.callRating(player, plot, new Rating(rating));
if (event.getRating() != null) { if (event.getRating() != null) {
plot.addRating(uuid, event.getRating()); plot.addRating(uuid, event.getRating());
sendMessage(player, Captions.RATING_APPLIED, plot.getId().toString()); player.sendMessage(
TranslatableCaption.of("ratings.rating_applied"),
Template.of("value", plot.getId().toString())
);
} }
}; };
if (plot.getSettings().getRatings() == null) { if (plot.getSettings().getRatings() == null) {

View File

@ -26,13 +26,14 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.generator.HybridPlotManager; import com.plotsquared.core.generator.HybridPlotManager;
import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.HybridUtils;
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.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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
@ -60,38 +61,44 @@ public class RegenAllRoads extends SubCommand {
try { try {
height = Integer.parseInt(args[1]); height = Integer.parseInt(args[1]);
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0, 256)"); player.sendMessage(
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, TranslatableCaption.of("invalid.not_valid_number"),
"/plot regenallroads <world> [height]"); Template.of("value", "(0, 256)")
);
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot regenallroads <world> [height]")
);
return false; return false;
} }
} else if (args.length != 1) { } else if (args.length != 1) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, player.sendMessage(
"/plot regenallroads <world> [height]"); TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("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) {
Captions.NOT_VALID_PLOT_WORLD.send(player, args[0]); player.sendMessage(
TranslatableCaption.of("errors.not_valid_plot_world"),
Template.of("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)) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD); player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
return false; return false;
} }
//Set<BlockVector2> chunks = ChunkManager.manager.getChunkChunks(name); //Set<BlockVector2> chunks = ChunkManager.manager.getChunkChunks(name);
MainUtil player.sendMessage(TranslatableCaption.of("debugroadregen.schematic"));
.sendMessage(player, "&cIf no schematic is set, the following will not do anything");
MainUtil.sendMessage(player,
"&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
//MainUtil.sendMessage(player, "&6Potential chunks to update: &7" + (chunks.size() * 1024)); //MainUtil.sendMessage(player, "&6Potential chunks to update: &7" + (chunks.size() * 1024));
//MainUtil.sendMessage(player, "&6Estimated time: &7" + chunks.size() + " seconds"); //MainUtil.sendMessage(player, "&6Estimated time: &7" + chunks.size() + " seconds");
boolean result = this.hybridUtils.scheduleRoadUpdate(area, height); boolean result = this.hybridUtils.scheduleRoadUpdate(area, height);
if (!result) { if (!result) {
MainUtil.sendMessage(player, player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress"));
"&cCannot schedule mass schematic update! (Is one already in progress?)");
return false; return false;
} }
return true; return true;

View File

@ -25,7 +25,7 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.caption.TranslatableCaption;
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.queue.LocalBlockQueue; import com.plotsquared.core.queue.LocalBlockQueue;
@ -52,7 +52,7 @@ public class Relight extends Command {
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
if (plot == null) { if (plot == null) {
Captions.NOT_IN_PLOT.send(player); player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
final LocalBlockQueue queue = plot.getArea().getQueue(false); final LocalBlockQueue queue = plot.getArea().getQueue(false);
@ -62,7 +62,7 @@ public class Relight extends Command {
} }
}, () -> { }, () -> {
plot.refreshChunks(); plot.refreshChunks();
Captions.SET_BLOCK_ACTION_FINISHED.send(player); player.sendMessage(TranslatableCaption.of("setblock.set_block_action_finished"));
}, 5); }, 5);
return CompletableFuture.completedFuture(true); return CompletableFuture.completedFuture(true);

View File

@ -30,6 +30,7 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.MemorySection; import com.plotsquared.core.configuration.MemorySection;
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.inject.annotations.WorldConfig; import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile; import com.plotsquared.core.inject.annotations.WorldFile;
@ -116,10 +117,10 @@ public class Reload extends SubCommand {
} }
}); });
this.worldConfiguration.save(this.worldFile); this.worldConfiguration.save(this.worldFile);
MainUtil.sendMessage(player, Captions.RELOADED_CONFIGS); player.sendMessage(TranslatableCaption.of("reload.reloaded_configs"));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
MainUtil.sendMessage(player, Captions.RELOAD_FAILED); player.sendMessage(TranslatableCaption.of("reload.reload_failed"));
} }
return true; return true;
} }

View File

@ -36,6 +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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.Collection; import java.util.Collection;
@ -46,7 +47,7 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "remove", @CommandDeclaration(command = "remove",
aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"}, aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"},
description = "Remove a player from a plot", description = "Remove a player from a plot",
usage = "/plot remove <player|*>", usage = "/plot remove <player | *>",
category = CommandCategory.SETTINGS, category = CommandCategory.SETTINGS,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
permission = "plots.remove") permission = "plots.remove")
@ -67,22 +68,25 @@ public class Remove extends SubCommand {
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_REMOVE)) { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_REMOVE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("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) {
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT); player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
return; return;
} else if (throwable != null) { } else if (throwable != null) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
);
return; return;
} else if (!uuids.isEmpty()) { } else if (!uuids.isEmpty()) {
for (UUID uuid : uuids) { for (UUID uuid : uuids) {
@ -116,9 +120,15 @@ public class Remove extends SubCommand {
} }
} }
if (count == 0) { if (count == 0) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
);
} else { } else {
MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, count + ""); player.sendMessage(
TranslatableCaption.of("member.removed_players"),
Template.of("amount", count + "")
);
} }
}); });
return true; return true;

View File

@ -71,16 +71,16 @@ public class Save extends SubCommand {
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SAVE)) { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SAVE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return false; return false;
} }
if (plot.getRunning() > 0) { if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
return false; return false;
} }
plot.addRunning(); plot.addRunning();
@ -101,10 +101,10 @@ public class Save extends SubCommand {
@Override public void run(URL url) { @Override public void run(URL url) {
plot.removeRunning(); plot.removeRunning();
if (url == null) { if (url == null) {
MainUtil.sendMessage(player, Captions.SAVE_FAILED); player.sendMessage(TranslatableCaption.of("backups.backup_save_failed"));
return; return;
} }
MainUtil.sendMessage(player, Captions.SAVE_SUCCESS); player.sendMessage(TranslatableCaption.of("web.save_success"));
List<String> schematics = player.getMeta("plot_schematics"); List<String> schematics = player.getMeta("plot_schematics");
if (schematics != null) { if (schematics != null) {
schematics.add(file + ".schem"); schematics.add(file + ".schem");

View File

@ -29,6 +29,7 @@ import com.google.common.collect.Lists;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.ConsolePlayer;
@ -42,8 +43,10 @@ import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.swing.plaf.basic.BasicSliderUI;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -54,7 +57,7 @@ import java.util.UUID;
description = "Schematic command", description = "Schematic command",
aliases = {"sch", "schem"}, aliases = {"sch", "schem"},
category = CommandCategory.SCHEMATIC, category = CommandCategory.SCHEMATIC,
usage = "/plot schematic <save|saveall|paste>") usage = "/plot schematic <save | saveall | paste>")
public class SchematicCmd extends SubCommand { public class SchematicCmd extends SubCommand {
private final PlotAreaManager plotAreaManager; private final PlotAreaManager plotAreaManager;
@ -69,19 +72,27 @@ public class SchematicCmd extends SubCommand {
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) { @Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
if (args.length < 1) { if (args.length < 1) {
sendMessage(player, Captions.SCHEMATIC_MISSING_ARG); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "Possible values: save, paste , exportall, list")
);
return true; return true;
} }
String arg = args[0].toLowerCase(); String arg = args[0].toLowerCase();
switch (arg) { switch (arg) {
case "paste": { case "paste": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_PASTE)) { if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_PASTE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, player.sendMessage(
Captions.PERMISSION_SCHEMATIC_PASTE); TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.schematic.paste")
);
return false; return false;
} }
if (args.length < 2) { if (args.length < 2) {
sendMessage(player, Captions.SCHEMATIC_MISSING_ARG); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "Possible values: save, paste , exportall, list")
);
break; break;
} }
Location loc = player.getLocation(); Location loc = player.getLocation();
@ -91,20 +102,20 @@ public class SchematicCmd extends SubCommand {
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE)) { .hasPermission(player, "plots.admin.command.schematic.paste")) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return false; return false;
} }
if (this.running) { if (this.running) {
MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS); player.sendMessage(TranslatableCaption.of("error.task_in_process"));
return false; return false;
} }
if (plot.isMerged()) { if (plot.isMerged()) {
MainUtil.sendMessage(player, Captions.SCHEMATIC_PASTE_MERGED); player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_merged"));
return false; return false;
} }
final String location = args[1]; final String location = args[1];
@ -119,8 +130,10 @@ public class SchematicCmd extends SubCommand {
schematic = this.schematicHandler.getSchematic(url); schematic = this.schematicHandler.getSchematic(url);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
sendMessage(player, Captions.SCHEMATIC_INVALID, player.sendMessage(
"non-existent url: " + location); TranslatableCaption.of("schematics.schematic_invalid"),
Template.of("reason", "non-existent url: " + location)
);
SchematicCmd.this.running = false; SchematicCmd.this.running = false;
return; return;
} }
@ -133,17 +146,19 @@ public class SchematicCmd extends SubCommand {
} }
if (schematic == null) { if (schematic == null) {
SchematicCmd.this.running = false; SchematicCmd.this.running = false;
sendMessage(player, Captions.SCHEMATIC_INVALID, player.sendMessage(
"non-existent or not in gzip format"); TranslatableCaption.of("schematics.schematic_invalid"),
Template.of("reason", "non-existent or not in gzip format")
);
return; return;
} }
this.schematicHandler.paste(schematic, plot, 0, 1, 0, false, new RunnableVal<Boolean>() { this.schematicHandler.paste(schematic, plot, 0, 1, 0, false, new RunnableVal<Boolean>() {
@Override public void run(Boolean value) { @Override public void run(Boolean value) {
SchematicCmd.this.running = false; SchematicCmd.this.running = false;
if (value) { if (value) {
sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS); player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
} else { } else {
sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED); player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed"));
} }
} }
}); });
@ -153,44 +168,59 @@ public class SchematicCmd extends SubCommand {
case "saveall": case "saveall":
case "exportall": { case "exportall": {
if (!(player instanceof ConsolePlayer)) { if (!(player instanceof ConsolePlayer)) {
MainUtil.sendMessage(player, Captions.NOT_CONSOLE); player.sendMessage(TranslatableCaption.of("console.not_console"));
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_WORLD_ARGS); player.sendMessage(TranslatableCaption.of("schematic_exportall_world_args"));
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "Use /plot sch 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) {
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]); player.sendMessage(
TranslatableCaption.of("errors.not_valid_plot_world"),
Template.of("value", args[1])
);
return false; return false;
} }
Collection<Plot> plots = area.getPlots(); Collection<Plot> plots = area.getPlots();
if (plots.isEmpty()) { if (plots.isEmpty()) {
MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_WORLD); player.sendMessage(TranslatableCaption.of("schematic.schematic_exportall_world"));
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("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,
() -> MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_FINISHED)); () -> player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_finished")));
if (!result) { if (!result) {
MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS); player.sendMessage(TranslatableCaption.of("error.task_in_process"));
return false; return false;
} else { } else {
MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED); player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_started"));
MainUtil.sendMessage(player, player.sendMessage(
"&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots..."); TranslatableCaption.of("schematics.plot_to_schem"),
Template.of("amount", String.valueOf(plots.size()))
);
} }
break; break;
} }
case "export": case "export":
case "save": case "save":
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_SAVE)) { if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_SAVE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, player.sendMessage(
Captions.PERMISSION_SCHEMATIC_SAVE); TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.schematic.save")
);
return false; return false;
} }
if (this.running) { if (this.running) {
MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS); player.sendMessage(TranslatableCaption.of("error.task_in_process"));
return false; return false;
} }
Location location = player.getLocation(); Location location = player.getLocation();
@ -200,38 +230,46 @@ public class SchematicCmd extends SubCommand {
return false; return false;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED); player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false; return false;
} }
if (!plot.isOwner(player.getUUID()) && !Permissions if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE)) { .hasPermission(player, "plots.admin.command.schematic.save")) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("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, () -> {
MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_SINGLE_FINISHED); player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_single_finished"));
SchematicCmd.this.running = false; SchematicCmd.this.running = false;
}); });
if (!result) { if (!result) {
MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS); player.sendMessage(TranslatableCaption.of("error.task_in_process"));
return false; return false;
} else { } else {
MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED); player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_started"));
} }
break; break;
case "list": { case "list": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_LIST)) { if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_LIST)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, player.sendMessage(
Captions.PERMISSION_SCHEMATIC_LIST); TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.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");
Captions.SCHEMATIC_LIST.send(player, string); player.sendMessage(
TranslatableCaption.of("schematics.schematic_list"),
Template.of("list", string)
);
} }
break; break;
default: default:
sendMessage(player, Captions.SCHEMATIC_MISSING_ARG); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "Possible values: save, paste , exportall, list")
);
break; break;
} }
return true; return true;

View File

@ -45,6 +45,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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
@ -59,7 +60,7 @@ import java.util.stream.Stream;
@CommandDeclaration(command = "set", @CommandDeclaration(command = "set",
description = "Set a plot value", description = "Set a plot value",
aliases = {"s"}, aliases = {"s"},
usage = "/plot set <biome|alias|home|flag> <value...>", usage = "/plot set <biome | alias | home | flag> <value...>",
permission = "plots.set", permission = "plots.set",
category = CommandCategory.APPEARANCE, category = CommandCategory.APPEARANCE,
requiredType = RequiredType.NONE) requiredType = RequiredType.NONE)
@ -127,7 +128,10 @@ public class Set extends SubCommand {
} else if (!blockType.contains(forbiddenType)) { } else if (!blockType.contains(forbiddenType)) {
continue; continue;
} }
Captions.COMPONENT_ILLEGAL_BLOCK.send(player, forbiddenType); player.sendMessage(
TranslatableCaption.of("invalid.component_illegal_block"),
Template.of("value", forbiddenType)
);
return true; return true;
} }
} }
@ -144,14 +148,14 @@ public class Set extends SubCommand {
return false; return false;
} }
if (args.length < 2) { if (args.length < 2) {
MainUtil.sendMessage(player, Captions.NEED_BLOCK); player.sendMessage(TranslatableCaption.of("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) {
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER); player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
return false; return false;
} }
@ -160,7 +164,7 @@ public class Set extends SubCommand {
for (Plot current : plot.getConnectedPlots()) { for (Plot current : plot.getConnectedPlots()) {
current.setComponent(component, pattern); current.setComponent(component, pattern);
} }
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT); player.sendMessage(TranslatableCaption.of("working.generating_component"));
blockQueue.addEmptyTask(plot::removeRunning); blockQueue.addEmptyTask(plot::removeRunning);
}); });
return true; return true;

View File

@ -49,7 +49,7 @@ public abstract class SetCommand extends SubCommand {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
.format(player, Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), .format(player, Captions.PERMISSION_ADMIN_COMMAND.getTranslated(),
getFullId())); getFullId()));
MainUtil.sendMessage(player, Captions.PLOT_NOT_CLAIMED); player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
return false; return false;
} }
} }
@ -59,7 +59,7 @@ public abstract class SetCommand extends SubCommand {
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
.format(player, Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), .format(player, Captions.PERMISSION_ADMIN_COMMAND.getTranslated(),
getFullId())); getFullId()));
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return false; return false;
} }
} }

View File

@ -25,11 +25,12 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.location.BlockLoc; 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;
@CommandDeclaration(command = "sethome", @CommandDeclaration(command = "sethome",
permission = "plots.set.home", permission = "plots.set.home",
@ -48,7 +49,7 @@ public class SetHome extends SetCommand {
case "none": { case "none": {
Plot base = plot.getBasePlot(false); Plot base = plot.getBasePlot(false);
base.setHome(null); base.setHome(null);
return MainUtil.sendMessage(player, Captions.POSITION_UNSET); player.sendMessage(TranslatableCaption.of("position.position_unset"));
} }
case "": case "":
Plot base = plot.getBasePlot(false); Plot base = plot.getBasePlot(false);
@ -57,9 +58,12 @@ public class SetHome extends SetCommand {
BlockLoc rel = new BlockLoc(location.getX() - bottom.getX(), location.getY(), BlockLoc rel = new BlockLoc(location.getX() - bottom.getX(), location.getY(),
location.getZ() - bottom.getZ(), location.getYaw(), location.getPitch()); location.getZ() - bottom.getZ(), location.getYaw(), location.getPitch());
base.setHome(rel); base.setHome(rel);
return MainUtil.sendMessage(player, Captions.POSITION_SET); player.sendMessage(TranslatableCaption.of("position.position_set"));
default: default:
MainUtil.sendMessage(player, Captions.HOME_ARGUMENT); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "Use /plot set home [none]")
);
return false; return false;
} }
} }

View File

@ -28,11 +28,14 @@ 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.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.generator.GeneratorWrapper;
import com.plotsquared.core.player.PlotPlayer; 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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
@ -67,14 +70,18 @@ public class Setup extends SubCommand {
message.append("\n&8 - &7").append(entry.getKey()).append(" (Unknown structure)"); message.append("\n&8 - &7").append(entry.getKey()).append(" (Unknown structure)");
} }
} }
MainUtil.sendMessage(player, message.toString()); player.sendMessage(StaticCaption.of(message.toString()));
} }
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) { @Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
SetupProcess process = player.getMeta("setup"); SetupProcess process = player.getMeta("setup");
if (process == null) { if (process == null) {
if (args.length > 0) { if (args.length > 0) {
MainUtil.sendMessage(player, Captions.SETUP_NOT_STARTED); player.sendMessage(TranslatableCaption.of("setup.setup_not_started"));
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "Use /plot setup to start a setup process.")
);
return true; return true;
} }
process = new SetupProcess(); process = new SetupProcess();
@ -91,7 +98,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])) {
player.deleteMeta("setup"); player.deleteMeta("setup");
MainUtil.sendMessage(player, Captions.SETUP_CANCELLED); player.sendMessage(TranslatableCaption.of("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

@ -26,12 +26,14 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
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 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 java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -55,7 +57,7 @@ public class Swap extends SubCommand {
} }
if (!plot1.isOwner(player.getUUID()) && !Permissions if (!plot1.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) { .hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (args.length != 1) { if (args.length != 1) {
@ -67,26 +69,29 @@ public class Swap extends SubCommand {
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (plot1.equals(plot2)) { if (plot1.equals(plot2)) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID); player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot copy <X;Z>"); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot copy <X;Z>")
);
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (!plot1.getArea().isCompatible(plot2.getArea())) { if (!plot1.getArea().isCompatible(plot2.getArea())) {
Captions.PLOTWORLD_INCOMPATIBLE.send(player); player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
if (plot1.isMerged() || plot2.isMerged()) { if (plot1.isMerged() || plot2.isMerged()) {
Captions.SWAP_MERGED.send(player); player.sendMessage(TranslatableCaption.of("swap.swap_merged"));
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
return plot1.move(plot2, () -> { return plot1.move(plot2, () -> {
}, true).thenApply(result -> { }, true).thenApply(result -> {
if (result) { if (result) {
MainUtil.sendMessage(player, Captions.SWAP_SUCCESS); player.sendMessage(TranslatableCaption.of("swap.swap_success"));
return true; return true;
} else { } else {
MainUtil.sendMessage(player, Captions.SWAP_OVERLAP); player.sendMessage(TranslatableCaption.of("swap.swap_overlap"));
return false; return false;
} }
}); });

View File

@ -25,15 +25,16 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.caption.TranslatableCaption;
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 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;
@CommandDeclaration(command = "target", @CommandDeclaration(command = "target",
usage = "/plot target <<plot>|nearest>", usage = "/plot target <<plot> | nearest>",
description = "Target a plot with your compass", description = "Target a plot with your compass",
permission = "plots.target", permission = "plots.target",
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
@ -47,11 +48,14 @@ public class Target extends SubCommand {
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) { @Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
Location location = player.getLocation(); Location location = player.getLocation();
if (!location.isPlotArea()) { if (!location.isPlotArea()) {
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT_WORLD); player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
return false; return false;
} }
if (args.length == 0) { if (args.length == 0) {
MainUtil.sendMessage(player, this.getUsage()); player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot target <<plot> | nearest>")
);
return false; return false;
} }
Plot target = null; Plot target = null;
@ -65,14 +69,14 @@ public class Target extends SubCommand {
} }
} }
if (target == null) { if (target == null) {
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS); player.sendMessage(TranslatableCaption.of("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) {
return false; return false;
} }
target.getCenter(player::setCompassTarget); target.getCenter(player::setCompassTarget);
MainUtil.sendMessage(player, Captions.COMPASS_TARGET); player.sendMessage(TranslatableCaption.of("compass.compass_target"));
return true; return true;
} }
} }

View File

@ -28,17 +28,15 @@ 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.ConfigurationUtil; import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.inject.annotations.WorldConfig; import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile; import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationNode; import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.InvalidConfigurationException; import com.plotsquared.core.configuration.InvalidConfigurationException;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
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;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile;
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.PlotManager; import com.plotsquared.core.plot.PlotManager;
@ -48,7 +46,6 @@ import com.plotsquared.core.setup.PlotAreaBuilder;
import com.plotsquared.core.setup.SettingsNodesWrapper; import com.plotsquared.core.setup.SettingsNodesWrapper;
import com.plotsquared.core.util.FileBytes; import com.plotsquared.core.util.FileBytes;
import com.plotsquared.core.util.FileUtils; import com.plotsquared.core.util.FileUtils;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.SetupUtils;
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;
@ -66,7 +63,7 @@ import java.util.zip.ZipOutputStream;
@CommandDeclaration(command = "template", @CommandDeclaration(command = "template",
permission = "plots.admin", permission = "plots.admin",
description = "Create or use a world template", description = "Create or use a world template",
usage = "/plot template [import|export] <world> <template>", usage = "/plot template [import | export] <world> <template>",
category = CommandCategory.ADMINISTRATION) category = CommandCategory.ADMINISTRATION)
public class Template extends SubCommand { public class Template extends SubCommand {
@ -167,12 +164,16 @@ public class Template extends SubCommand {
if (args.length != 2 && args.length != 3) { if (args.length != 2 && args.length != 3) {
if (args.length == 1) { if (args.length == 1) {
if (args[0].equalsIgnoreCase("export")) { if (args[0].equalsIgnoreCase("export")) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, player.sendMessage(
"/plot template export <world>"); TranslatableCaption.of("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template export <world>")
);
return true; return true;
} else if (args[0].equalsIgnoreCase("import")) { } else if (args[0].equalsIgnoreCase("import")) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, player.sendMessage(
"/plot template import <world> <template>"); TranslatableCaption.of("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template import <world> <template>")
);
return true; return true;
} }
} }
@ -183,18 +184,25 @@ public class Template extends SubCommand {
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "import": { case "import": {
if (args.length != 3) { if (args.length != 3) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, player.sendMessage(
"/plot template import <world> <template>"); TranslatableCaption.of("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template import <world> <template>")
);
return false; return false;
} }
if (this.plotAreaManager.hasPlotArea(world)) { if (this.plotAreaManager.hasPlotArea(world)) {
MainUtil.sendMessage(player, Captions.SETUP_WORLD_TAKEN, world); player.sendMessage(
TranslatableCaption.of("setup.setup_world_taken"),
net.kyori.adventure.text.minimessage.Template.of("value", world)
);
return false; return false;
} }
boolean result = extractAllFiles(world, args[2]); boolean result = extractAllFiles(world, args[2]);
if (!result) { if (!result) {
MainUtil player.sendMessage(
.sendMessage(player, "&cInvalid template file: " + args[2] + ".template"); TranslatableCaption.of("template.invalid_template"),
net.kyori.adventure.text.minimessage.Template.of("value", args[2])
);
return false; return false;
} }
File worldFile = FileUtils.getFile(PlotSquared.platform().getDirectory(), File worldFile = FileUtils.getFile(PlotSquared.platform().getDirectory(),
@ -220,20 +228,22 @@ public class Template extends SubCommand {
this.setupUtils.setupWorld(builder); this.setupUtils.setupWorld(builder);
this.globalBlockQueue.addEmptyTask(() -> { this.globalBlockQueue.addEmptyTask(() -> {
MainUtil.sendMessage(player, "Done!"); player.sendMessage(TranslatableCaption.of("debugimportworlds.done"));
player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND); player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND);
}); });
return true; return true;
} }
case "export": case "export":
if (args.length != 2) { if (args.length != 2) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, player.sendMessage(
"/plot template export <world>"); TranslatableCaption.of("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("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) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD); player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
return false; return false;
} }
final PlotManager manager = area.getPlotManager(); final PlotManager manager = area.getPlotManager();
@ -242,10 +252,13 @@ public class Template extends SubCommand {
manager.exportTemplate(); manager.exportTemplate();
} 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();
MainUtil.sendMessage(player, "Failed: " + e.getMessage()); player.sendMessage(
TranslatableCaption.of("template.template_failed"),
net.kyori.adventure.text.minimessage.Template.of("value", e.getMessage())
);
return; return;
} }
MainUtil.sendMessage(player, "Done!"); player.sendMessage(TranslatableCaption.of("debugimportworlds.done"));
}); });
return true; return true;
default: default:

View File

@ -26,14 +26,16 @@
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
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;
@CommandDeclaration(command = "toggle", @CommandDeclaration(command = "toggle",
aliases = {"attribute"}, aliases = {"attribute"},
permission = "plots.use", permission = "plots.use",
usage = "/plot toggle <chat|chatspy|clear-confirmation|time|titles|worldedit>", usage = "/plot toggle <chat | chatspy | clear-confirmation | time | titles | worldedit>",
description = "Toggle per user settings", description = "Toggle per user settings",
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
category = CommandCategory.SETTINGS) category = CommandCategory.SETTINGS)
@ -50,9 +52,15 @@ public class Toggle extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "chatspy")) { if (toggle(player, "chatspy")) {
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"),
Template.of("setting", command.toString())
);
} else { } else {
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"),
Template.of("setting", command.toString())
);
} }
} }
@ -64,9 +72,15 @@ public class Toggle extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "worldedit")) { if (toggle(player, "worldedit")) {
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"),
Template.of("setting", command.toString())
);
} else { } else {
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"),
Template.of("setting", command.toString())
);
} }
} }
@ -77,9 +91,15 @@ public class Toggle extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "chat")) { if (toggle(player, "chat")) {
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"),
Template.of("setting", command.toString())
);
} else { } else {
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"),
Template.of("setting", command.toString())
);
} }
} }
@ -90,9 +110,15 @@ public class Toggle extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "ignoreExpireTask")) { if (toggle(player, "ignoreExpireTask")) {
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"),
Template.of("setting", command.toString())
);
} else { } else {
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"),
Template.of("setting", command.toString())
);
} }
} }
@ -103,9 +129,15 @@ public class Toggle extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "disabletitles")) { if (toggle(player, "disabletitles")) {
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"),
Template.of("setting", command.toString())
);
} else { } else {
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"),
Template.of("setting", command.toString())
);
} }
} }
@ -116,9 +148,15 @@ public class Toggle extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
if (toggle(player, "disabletime")) { if (toggle(player, "disabletime")) {
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"),
Template.of("setting", command.toString())
);
} else { } else {
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"),
Template.of("setting", command.toString())
);
} }
} }
@ -129,9 +167,15 @@ public class Toggle extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
if (!toggle(player, "debug")) { if (!toggle(player, "debug")) {
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_disabled"),
Template.of("setting", command.toString())
);
} else { } else {
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString()); player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"),
Template.of("setting", command.toString())
);
} }
player.refreshDebug(); player.refreshDebug();
} }

View File

@ -27,7 +27,8 @@ 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.Captions; import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
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;
@ -92,16 +93,16 @@ public class Trim extends SubCommand {
if (result == null) { if (result == null) {
return false; return false;
} }
MainUtil.sendMessage(null, "Collecting region data..."); TranslatableCaption.of("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());
} }
result.value1 = new HashSet<>(PlotSquared.platform().getRegionManager().getChunkChunks(world)); result.value1 = new HashSet<>(PlotSquared.platform().getRegionManager().getChunkChunks(world));
result.value2 = new HashSet<>(); result.value2 = new HashSet<>();
MainUtil.sendMessage(null, " - MCA #: " + result.value1.size()); StaticCaption.of(" - MCA #: " + result.value1.size());
MainUtil.sendMessage(null, " - CHUNKS: " + (result.value1.size() * 1024) + " (max)"); StaticCaption.of(" - CHUNKS: " + (result.value1.size() * 1024) + " (max)");
MainUtil.sendMessage(null, " - TIME ESTIMATE: 12 Parsecs"); StaticCaption.of(" - TIME ESTIMATE: 12 Parsecs");
TaskManager.getPlatformImplementation().objectTask(plots, new RunnableVal<Plot>() { TaskManager.getPlatformImplementation().objectTask(plots, new RunnableVal<Plot>() {
@Override public void run(Plot plot) { @Override public void run(Plot plot) {
Location pos1 = plot.getCorners()[0]; Location pos1 = plot.getCorners()[0];
@ -131,11 +132,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)) {
MainUtil.sendMessage(player, Captions.NOT_VALID_WORLD); player.sendMessage(TranslatableCaption.of("errors.not_valid_world"));
return false; return false;
} }
if (Trim.TASK) { if (Trim.TASK) {
Captions.TRIM_IN_PROGRESS.send(player); player.sendMessage(TranslatableCaption.of("trim.trim_in_progress"));
return false; return false;
} }
Trim.TASK = true; Trim.TASK = true;
@ -151,7 +152,7 @@ public class Trim extends SubCommand {
@Override public void run() { @Override public void run() {
if (nonViable.isEmpty()) { if (nonViable.isEmpty()) {
Trim.TASK = false; Trim.TASK = false;
player.sendMessage("Trim done!"); player.sendMessage(TranslatableCaption.of("trim.trim_done"));
logger.info("[P2] Trim done!"); logger.info("[P2] Trim done!");
return; return;
} }
@ -201,7 +202,8 @@ public class Trim extends SubCommand {
} else { } else {
regenTask = () -> { regenTask = () -> {
Trim.TASK = false; Trim.TASK = false;
player.sendMessage("Trim done!"); player.sendMessage(TranslatableCaption.of("trim.trim_done"));
logger.info("[P2] Trim done!");
}; };
} }
regionManager.deleteRegionFiles(world, viable, regenTask); regionManager.deleteRegionFiles(world, viable, regenTask);

View File

@ -37,6 +37,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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.Collection; import java.util.Collection;
@ -49,7 +50,7 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "trust", @CommandDeclaration(command = "trust",
aliases = {"t"}, aliases = {"t"},
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
usage = "/plot trust <player|*>", usage = "/plot trust <player | *>",
description = "Allow a user to build in a plot and use WorldEdit while the plot owner is offline.", description = "Allow a user to build in a plot and use WorldEdit while the plot owner is offline.",
category = CommandCategory.SETTINGS) category = CommandCategory.SETTINGS)
public class Trust extends Command { public class Trust extends Command {
@ -79,9 +80,12 @@ public class Trust extends Command {
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) {
Captions.FETCHING_PLAYERS_TIMEOUT.send(player); player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
} else { } else {
Captions.INVALID_PLAYER.send(player, args[0]); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
);
} }
future.completeExceptionally(throwable); future.completeExceptionally(throwable);
return; return;
@ -94,17 +98,26 @@ public class Trust extends Command {
if (uuid == DBFunc.EVERYONE && !( if (uuid == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST))) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, PlayerManager.getName(uuid)); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", PlayerManager.getName(uuid))
);
iterator.remove(); iterator.remove();
continue; continue;
} }
if (currentPlot.isOwner(uuid)) { if (currentPlot.isOwner(uuid)) {
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, PlayerManager.getName(uuid)); player.sendMessage(
TranslatableCaption.of("member.already_added"),
Template.of("value", PlayerManager.getName(uuid))
);
iterator.remove(); iterator.remove();
continue; continue;
} }
if (currentPlot.getTrusted().contains(uuid)) { if (currentPlot.getTrusted().contains(uuid)) {
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, PlayerManager.getName(uuid)); player.sendMessage(
TranslatableCaption.of("member.already_added"),
Template.of("value", PlayerManager.getName(uuid))
);
iterator.remove(); iterator.remove();
continue; continue;
} }

View File

@ -67,7 +67,7 @@ public class Unlink extends SubCommand {
return !sendMessage(player, Captions.PLOT_UNOWNED); return !sendMessage(player, Captions.PLOT_UNOWNED);
} }
if (!plot.isMerged()) { if (!plot.isMerged()) {
return sendMessage(player, Captions.UNLINK_IMPOSSIBLE); player.sendMessage(TranslatableCaption.of("merge.unlink_impossible"));
} }
final boolean createRoad; final boolean createRoad;
if (args.length != 0) { if (args.length != 0) {
@ -92,14 +92,14 @@ public class Unlink extends SubCommand {
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, Captions.PERMISSION_ADMIN_COMMAND_UNLINK)) { .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_UNLINK)) {
return sendMessage(player, Captions.NO_PLOT_PERMS); player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
} }
Runnable runnable = () -> { Runnable runnable = () -> {
if (!plot.unlinkPlot(createRoad, createRoad)) { if (!plot.unlinkPlot(createRoad, createRoad)) {
MainUtil.sendMessage(player, Captions.UNMERGE_CANCELLED); player.sendMessage(TranslatableCaption.of("merge.unmerge_cancelled"));
return; return;
} }
MainUtil.sendMessage(player, Captions.UNLINK_SUCCESS); player.sendMessage(TranslatableCaption.of("merge.unlink_success"));
}; };
if (hasConfirmation(player)) { if (hasConfirmation(player)) {
CmdConfirm.addPending(player, "/plot unlink " + plot.getId(), runnable); CmdConfirm.addPending(player, "/plot unlink " + plot.getId(), runnable);

View File

@ -44,6 +44,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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
@ -57,7 +58,7 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "visit", @CommandDeclaration(command = "visit",
permission = "plots.visit", permission = "plots.visit",
description = "Visit someones plot", description = "Visit someones plot",
usage = "/plot visit <player>|<alias>|<plot> [area]|[#] [#]", usage = "/plot visit <player> | <alias> | <plot> [area]|[#] [#]",
aliases = {"v", "tp", "teleport", "goto", "warp"}, aliases = {"v", "tp", "teleport", "goto", "warp"},
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
category = CommandCategory.TELEPORT) category = CommandCategory.TELEPORT)
@ -187,7 +188,7 @@ 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) {
Captions.FETCHING_PLAYERS_TIMEOUT.send(player); player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
} else if (throwable != null || uuids.size() != 1) { } else if (throwable != null || uuids.size() != 1) {
player.sendMessage(TranslatableCaption.of("commandconfig.command_syntax"), player.sendMessage(TranslatableCaption.of("commandconfig.command_syntax"),
Templates.of("value", getUsage())); Templates.of("value", getUsage()));
@ -210,16 +211,19 @@ 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
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT); player.sendMessage(TranslatableCaption.of("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
MainUtil.sendMessage(player, Captions.PLAYER_NO_PLOTS); player.sendMessage(TranslatableCaption.of("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) {
this.visit(player, PlotQuery.newQuery().withAlias(finalArgs[0]), player.getApplicablePlotArea(), confirm, whenDone, 1); this.visit(player, PlotQuery.newQuery().withAlias(finalArgs[0]), player.getApplicablePlotArea(), confirm, whenDone, 1);
} else { } else {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, finalArgs[0]); player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", finalArgs[0])
);
} }
} else { } else {
this.visit(player, PlotQuery.newQuery().ownedBy(uuid).whereBasePlot(), null, confirm, whenDone, finalPage); this.visit(player, PlotQuery.newQuery().ownedBy(uuid).whereBasePlot(), null, confirm, whenDone, finalPage);

View File

@ -30,6 +30,7 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.backup.BackupManager; import com.plotsquared.core.backup.BackupManager;
import com.plotsquared.core.command.MainCommand; import com.plotsquared.core.command.MainCommand;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
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.configuration.serialization.ConfigurationSerialization; import com.plotsquared.core.configuration.serialization.ConfigurationSerialization;
import com.plotsquared.core.generator.ClassicPlotManagerComponent; import com.plotsquared.core.generator.ClassicPlotManagerComponent;
@ -193,7 +194,7 @@ public class ComponentPresetManager {
for (Plot current : plot.getConnectedPlots()) { for (Plot current : plot.getConnectedPlots()) {
current.setComponent(componentPreset.getComponent().name(), pattern); current.setComponent(componentPreset.getComponent().name(), pattern);
} }
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT); player.sendMessage(TranslatableCaption.of("working.generating_component"));
PlotSquared.platform().getGlobalBlockQueue().addEmptyTask(plot::removeRunning); PlotSquared.platform().getGlobalBlockQueue().addEmptyTask(plot::removeRunning);
}); });
return false; return false;

View File

@ -66,6 +66,7 @@ import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes; 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.Template;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.HashMap; import java.util.HashMap;
@ -164,9 +165,11 @@ public class PlotListener {
for (UUID uuid : plot.getOwners()) { for (UUID uuid : plot.getOwners()) {
final PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); final PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if (owner != null && !owner.getUUID().equals(player.getUUID())) { if (owner != null && !owner.getUUID().equals(player.getUUID())) {
MainUtil.sendMessage(owner, Captions.NOTIFY_ENTER.getTranslated() player.sendMessage(
.replace("%player", player.getName()) TranslatableCaption.of("notification.notify_enter"),
.replace("%plot", plot.getId().toString())); Template.of("player", player.getName()),
Template.of("plot", plot.getId().toString())
);
} }
} }
} }
@ -189,9 +192,11 @@ public class PlotListener {
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) { if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
player.setGameMode(gameMode); player.setGameMode(gameMode);
} else { } else {
MainUtil.sendMessage(player, StringMan player.sendMessage(
.replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}", TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
plot.getId(), "{gamemode}", gameMode)); Template.of("gamemode", String.valueOf(gameMode)),
Template.of("plot", String.valueOf(plot.getId()))
);
} }
} }
} }
@ -202,9 +207,11 @@ public class PlotListener {
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) { if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
player.setGameMode(guestGameMode); player.setGameMode(guestGameMode);
} else { } else {
MainUtil.sendMessage(player, StringMan player.sendMessage(
.replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}", TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
plot.getId(), "{gamemode}", guestGameMode)); Template.of("gamemode", String.valueOf(guestGameMode)),
Template.of("plot", String.valueOf(plot.getId()))
);
} }
} }
} }
@ -313,10 +320,11 @@ public class PlotListener {
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) { if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
player.setGameMode(pw.getGameMode()); player.setGameMode(pw.getGameMode());
} else { } else {
MainUtil.sendMessage(player, StringMan player.sendMessage(
.replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}", TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
plot.toString(), "{gamemode}", Template.of("gamemode", pw.getGameMode().getName().toLowerCase()),
pw.getGameMode().getName().toLowerCase())); Template.of("plot", plot.toString())
);
} }
} }
} }
@ -332,9 +340,11 @@ public class PlotListener {
for (UUID uuid : plot.getOwners()) { for (UUID uuid : plot.getOwners()) {
final PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); final PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if ((owner != null) && !owner.getUUID().equals(player.getUUID())) { if ((owner != null) && !owner.getUUID().equals(player.getUUID())) {
MainUtil.sendMessage(owner, Captions.NOTIFY_LEAVE.getTranslated() player.sendMessage(
.replace("%player", player.getName()) TranslatableCaption.of("notification.notify_leave"),
.replace("%plot", plot.getId().toString())); Template.of("player", player.getName()),
Template.of("plot", plot.getId().toString())
);
} }
} }
} }

View File

@ -28,6 +28,7 @@ package com.plotsquared.core.listener;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
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.plot.world.PlotAreaManager; import com.plotsquared.core.plot.world.PlotAreaManager;
@ -90,7 +91,7 @@ public class WESubscriber {
mask = WEManager.getMask(plotPlayer); mask = WEManager.getMask(plotPlayer);
if (mask.isEmpty()) { if (mask.isEmpty()) {
if (Permissions.hasPermission(plotPlayer, "plots.worldedit.bypass")) { if (Permissions.hasPermission(plotPlayer, "plots.worldedit.bypass")) {
MainUtil.sendMessage(plotPlayer, Captions.WORLDEDIT_BYPASS); plotPlayer.sendMessage(TranslatableCaption.of("worldedit.worldedit_bypass"));
} }
if (this.plotAreaManager.hasPlotArea(world)) { if (this.plotAreaManager.hasPlotArea(world)) {
event.setExtent(new NullExtent()); event.setExtent(new NullExtent());

View File

@ -35,6 +35,7 @@ import com.plotsquared.core.configuration.caption.CaptionUtility;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
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.StaticCaption;
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.events.PlotComponentSetEvent; import com.plotsquared.core.events.PlotComponentSetEvent;
@ -349,13 +350,13 @@ public class Plot {
} }
} }
if (message) { if (message) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID); player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
} }
return null; return null;
} }
if (area == null) { if (area == null) {
if (message) { if (message) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD); player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
} }
return null; return null;
} }
@ -1076,8 +1077,7 @@ public class Plot {
regionManager.regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false, regionManager.regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false,
this); this);
} catch (UnsupportedOperationException exception) { } catch (UnsupportedOperationException exception) {
MainUtil.sendMessage(null, logger.info("[P2] Please ask md_5 to fix regenerateChunk() because it breaks plugins. We apologize for the inconvenience.");
"Please ask md_5 to fix regenerateChunk() because it breaks plugins. We apologize for the inconvenience");
return; return;
} }
return; return;
@ -1856,7 +1856,7 @@ public class Plot {
updateWorldBorder(); updateWorldBorder();
} }
setSign(player.getName()); setSign(player.getName());
MainUtil.sendMessage(player, Captions.CLAIMED); player.sendMessage(TranslatableCaption.of("working.claimed"));
if (teleport && Settings.Teleport.ON_CLAIM) { if (teleport && Settings.Teleport.ON_CLAIM) {
teleportPlayer(player, TeleportCause.COMMAND, result -> { teleportPlayer(player, TeleportCause.COMMAND, result -> {
}); });
@ -1881,9 +1881,9 @@ public class Plot {
new RunnableVal<Boolean>() { new RunnableVal<Boolean>() {
@Override public void run(Boolean value) { @Override public void run(Boolean value) {
if (value) { if (value) {
MainUtil.sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS); player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
} else { } else {
MainUtil.sendMessage(player, Captions.SCHEMATIC_PASTE_FAILED); player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_failed"));
} }
} }
}); });
@ -3005,7 +3005,7 @@ public class Plot {
Captions.PLOT_DEBUG.getTranslated().replace("%plot%", this.toString()).replace("%message%", message); Captions.PLOT_DEBUG.getTranslated().replace("%plot%", this.toString()).replace("%message%", message);
for (final PlotPlayer<?> player : players) { for (final PlotPlayer<?> player : players) {
if (isOwner(player.getUUID()) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_DEBUG_OTHER)) { if (isOwner(player.getUUID()) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_DEBUG_OTHER)) {
player.sendMessage(string); player.sendMessage(StaticCaption.of(string));
} }
} }
} catch (final Exception ignored) {} } catch (final Exception ignored) {}
@ -3072,13 +3072,15 @@ 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")) {
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT); player.sendMessage(TranslatableCaption.of("teleport.teleported_to_plot"));
player.teleport(location, cause); player.teleport(location, cause);
resultConsumer.accept(true); resultConsumer.accept(true);
return; return;
} }
MainUtil player.sendMessage(
.sendMessage(player, Captions.TELEPORT_IN_SECONDS, Settings.Teleport.DELAY + ""); TranslatableCaption.of("teleport.teleport_in_seconds"),
Template.of("amount", String.valueOf(Settings.Teleport.DELAY))
);
final String name = player.getName(); final String name = player.getName();
TaskManager.addToTeleportQueue(name); TaskManager.addToTeleportQueue(name);
TaskManager.runTaskLater(() -> { TaskManager.runTaskLater(() -> {
@ -3086,7 +3088,7 @@ public class Plot {
return; return;
} }
if (player.isOnline()) { if (player.isOnline()) {
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT); player.sendMessage(TranslatableCaption.of("teleport.teleported_to_plot"));
player.teleport(location, cause); player.teleport(location, cause);
} }
}, TaskTime.seconds(Settings.Teleport.DELAY)); }, TaskTime.seconds(Settings.Teleport.DELAY));

View File

@ -42,7 +42,6 @@ import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.AnalysisFlag; import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
import com.plotsquared.core.plot.flag.implementations.KeepFlag; import com.plotsquared.core.plot.flag.implementations.KeepFlag;
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag; import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
import com.plotsquared.core.plot.message.PlotMessage;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
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;

View File

@ -29,8 +29,10 @@ import com.plotsquared.core.command.Command;
import com.plotsquared.core.command.RequiredType; import com.plotsquared.core.command.RequiredType;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationNode; import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.TabCompletions; import com.plotsquared.core.util.TabCompletions;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -73,9 +75,13 @@ public class SettingsNodeStep implements SetupStep {
} }
@Override public void announce(PlotPlayer<?> plotPlayer) { @Override public void announce(PlotPlayer<?> plotPlayer) {
MainUtil.sendMessage(plotPlayer, Captions.SETUP_STEP, this.getId() + 1, plotPlayer.sendMessage(
this.configurationNode.getDescription(), this.configurationNode.getType().getType(), TranslatableCaption.of("setup.setup_step"),
String.valueOf(this.configurationNode.getDefaultValue())); Template.of("step", String.valueOf(this.getId() + 1)),
Template.of("description", this.configurationNode.getDescription()),
Template.of("type", this.configurationNode.getType().getType()),
Template.of("value", String.valueOf(this.configurationNode.getDefaultValue()))
);
} }
@Override public Collection<Command> createSuggestions(PlotPlayer<?> plotPlayer, String argument) { @Override public Collection<Command> createSuggestions(PlotPlayer<?> plotPlayer, String argument) {

View File

@ -29,6 +29,7 @@ import com.google.common.eventbus.EventBus;
import com.plotsquared.core.configuration.caption.CaptionUtility; import com.plotsquared.core.configuration.caption.CaptionUtility;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.events.PlayerAutoPlotEvent; import com.plotsquared.core.events.PlayerAutoPlotEvent;
import com.plotsquared.core.events.PlayerClaimPlotEvent; import com.plotsquared.core.events.PlayerClaimPlotEvent;
import com.plotsquared.core.events.PlayerEnterPlotEvent; import com.plotsquared.core.events.PlayerEnterPlotEvent;
@ -72,6 +73,7 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
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 javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -240,7 +242,7 @@ public class EventDispatcher {
} }
if (this.worldEdit != null) { if (this.worldEdit != null) {
if (player.getAttribute("worldedit")) { if (player.getAttribute("worldedit")) {
MainUtil.sendMessage(player, Captions.WORLDEDIT_BYPASSED); player.sendMessage(TranslatableCaption.of("worldedit.worldedit_bypassed"));
} }
} }
final Plot plot = player.getCurrentPlot(); final Plot plot = player.getCurrentPlot();
@ -248,9 +250,7 @@ public class EventDispatcher {
.getArea() instanceof SinglePlotArea)) { .getArea() instanceof SinglePlotArea)) {
TaskManager.runTask(() -> plot.teleportPlayer(player, result -> { TaskManager.runTask(() -> plot.teleportPlayer(player, result -> {
})); }));
MainUtil.sendMessage(player, player.sendMessage(TranslatableCaption.of("teleport.teleported_to_road"));
CaptionUtility.format(player, Captions.TELEPORTED_TO_ROAD.getTranslated())
+ " (on-login) " + "(" + plot.getId().getX() + ";" + plot.getId().getY() + ")");
} }
} }
@ -259,7 +259,7 @@ public class EventDispatcher {
if (Settings.Teleport.ON_DEATH && plot != null) { if (Settings.Teleport.ON_DEATH && plot != null) {
TaskManager.runTask(() -> plot.teleportPlayer(player, result -> { TaskManager.runTask(() -> plot.teleportPlayer(player, result -> {
})); }));
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_ROAD); player.sendMessage(TranslatableCaption.of("teleport.teleported_to_road"));
} }
} }

View File

@ -28,7 +28,9 @@ package com.plotsquared.core.util;
import com.plotsquared.core.command.CommandCaller; import com.plotsquared.core.command.CommandCaller;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import net.kyori.adventure.text.minimessage.Template;
import java.util.HashMap; import java.util.HashMap;
@ -124,7 +126,10 @@ public class Permissions {
public static boolean hasPermission(PlotPlayer player, String permission, boolean notify) { public static boolean hasPermission(PlotPlayer player, String permission, boolean notify) {
if (!hasPermission(player, permission)) { if (!hasPermission(player, permission)) {
if (notify) { if (notify) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT, permission); player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", permission)
);
} }
return false; return false;
} }

View File

@ -27,8 +27,11 @@ package com.plotsquared.core.util.helpmenu;
import com.plotsquared.core.command.CommandCategory; import com.plotsquared.core.command.CommandCategory;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import net.kyori.adventure.text.minimessage.Template;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -47,12 +50,15 @@ public class HelpPage {
public void render(PlotPlayer player) { public void render(PlotPlayer player) {
if (this.helpObjects.size() < 1) { if (this.helpObjects.size() < 1) {
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0)"); player.sendMessage(
TranslatableCaption.of("invalid.not_valid_number"),
Template.of("value", "(0)")
);
} else { } else {
String message = String message =
Captions.HELP_HEADER.getTranslated() + "\n" + this.header + "\n" + StringMan Captions.HELP_HEADER.getTranslated() + "\n" + this.header + "\n" + StringMan
.join(this.helpObjects, "\n") + "\n" + Captions.HELP_FOOTER.getTranslated(); .join(this.helpObjects, "\n") + "\n" + Captions.HELP_FOOTER.getTranslated();
MainUtil.sendMessage(player, message, false); player.sendMessage(StaticCaption.of(message));
} }
} }

View File

@ -4,15 +4,20 @@
"confirm.requires_confirm": "<prefix><gray>Are you sure you wish to execute: </gray><gold><command></orange><gray>?</gray>\n<red>This cannot be undone! If you are sure: </red><gray>/plot confirm</gray>", "confirm.requires_confirm": "<prefix><gray>Are you sure you wish to execute: </gray><gold><command></orange><gray>?</gray>\n<red>This cannot be undone! If you are sure: </red><gray>/plot confirm</gray>",
"move.move_success": "<prefix><dark_aqua>Successfully moved plot.</dark_aqua>", "move.move_success": "<prefix><dark_aqua>Successfully moved plot.</dark_aqua>",
"move.move_merged": "<prefix><gray>Merged plots may not be moved. Please unmerge the plot before performing the move.</gray>", "move.move_merged": "<prefix><red>Merged plots may not be moved. Please unmerge the plot before performing the move.</red>",
"move.copy_success": "<prefix><dark_aqua>Successfully copied plot.</dark_aqua>", "move.copy_success": "<prefix><dark_aqua>Successfully copied plot.</dark_aqua>",
"move.requires_unowned": "<prefix><gray>The location specified is already occupied.</gray>", "move.requires_unowned": "<prefix><red>The location specified is already occupied.</red>",
"debug.requires_unmerged": "<prefix><red>The plot cannot be merged.</red>", "debug.requires_unmerged": "<prefix><red>The plot cannot be merged.</red>",
"debug.debug_header": "<prefix> <gold>Debug Information</orange>\n", "debug.debug_header": "<prefix> <gold>Debug Information</orange>\n",
"debug.debug_section": "<gray>>></gray> <gold><bold>&l<val></bold></gold>", "debug.debug_section": "<gray>>></gray> <gold><bold>&l<val></bold></gold>",
"debug.debug_line": "<gray>>></gray> <gold><var></gold><gray>:</gray><gold> <val></gold>\n", "debug.debug_line": "<gray>>></gray> <gold><var></gold><gray>:</gray><gold> <val></gold>\n",
"debug.plot_debug": "<gray>[<gold>Plot </gold><gray>Debug] (</gray><gold><plot></gold><gray>): <message></gray>", "debug.plot_debug": "<gray>[<gold>Plot </gold><gray>Debug] (</gray><gold><plot></gold><gray>): <message></gray>",
"debug.fetching_loaded_chunks": "<prefix><gold>Fetching loaded chunks...</gold>",
"debug.cached_uuids": "<prefix><gold>There are </gold><gray><value></gray> <gold>cached UUIDs.</gold>",
"debug.player_in_debugmode": "<prefix><gold>Player(s) in debug mode: </gold>",
"debug.player_in_debugmode_list": "<gold>- </gold><gray><value></gray>\n",
"debug.entity_categories": "<prefix><red>Entity categories:</red>",
"set.set_attribute": "<prefix><dark_aqua>Successfully set <attribute> to <value>.</dark_aqua>", "set.set_attribute": "<prefix><dark_aqua>Successfully set <attribute> to <value>.</dark_aqua>",
@ -58,9 +63,9 @@
"worldedit.worldedit_bypass": "<prefix><gray><italic>To bypass your restrictions use </gray><dark_aqua>/plot wea</dark_aqua></italic>", "worldedit.worldedit_bypass": "<prefix><gray><italic>To bypass your restrictions use </gray><dark_aqua>/plot wea</dark_aqua></italic>",
"worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>", "worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>",
"gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray>{gamemode}</gray><gold>) <gold>set for </gold><gray>{plot}</gray>", "gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray><gamemode></gray><gold>) <gold>set for </gold><gray><plot>.</gray>",
"height.height_limit": "<prefix><gold>This plot area has a height limit of </gold><gray>{limit}.</gray>", "height.height_limit": "<prefix><gold>This plot area has a height limit of </gold><gray><limit>.</gray>",
"notification.notify_enter": "<prefix><gray><player> entered your plot (</gray><gold><plot></gold><gray>).</gray>", "notification.notify_enter": "<prefix><gray><player> entered your plot (</gray><gold><plot></gold><gray>).</gray>",
"notification.notify_leave": "<prefix><gray><player> left your plot (</gray><gold><plot></gold><gray>).</gray>", "notification.notify_leave": "<prefix><gray><player> left your plot (</gray><gold><plot></gold><gray>).</gray>",
@ -121,13 +126,13 @@
"economy.removed_balance": "<prefix><gold><money> </gold><gray>has been taken from your balance.</gray>", "economy.removed_balance": "<prefix><gold><money> </gold><gray>has been taken from your balance.</gray>",
"economy.removed_granted_plot": "<prefix><gray>You used <usedGrants> plot grant(s), you've got </gray><gold><remainingGrants></gold> <gray>left.</gray>", "economy.removed_granted_plot": "<prefix><gray>You used <usedGrants> plot grant(s), you've got </gray><gold><remainingGrants></gold> <gray>left.</gray>",
"setup.setup_not_started": "<prefix><gold>No setup started. Use </gold><gray>/plot setup</gray> <gold>to start a setup process.</gold>", "setup.setup_not_started": "<prefix><gold>No setup started.</gold>",
"setup.setup_init": "<prefix><gold>Usage: </gold><gray>/plot setup </gray><value>", "setup.setup_init": "<prefix><gold>Usage: </gold><gray>/plot setup </gray><value>",
"setup.setup_step": "<gold><dark_gray>[</dark_gray>Step <step><dark_gray>]</dark_gray> <description> <gray>-</gray> Expecting: <gray><type></gray> Default: <gray><value></gray></gold>", "setup.setup_step": "<gold><dark_gray>[</dark_gray>Step <step><dark_gray>]</dark_gray> <description> <gray>-</gray> Expecting: <gray><type></gray> Default: <gray><value></gray></gold>",
"setup.setup_invalid_arg": "<prefix><gray><value> is not a valid argument for step <step>. To cancel setup use: </gray><gold>/plot setup cancel.</gold>", "setup.setup_invalid_arg": "<prefix><gray><value> is not a valid argument for step <step>. To cancel setup use: </gray><gold>/plot setup cancel.</gold>",
"setup.setup_valid_arg": "<prefix><gray>Value </gray><gold><description></gold> <gray>set to <value>.</gray>", "setup.setup_valid_arg": "<prefix><gray>Value </gray><gold><description></gold> <gray>set to <value>.</gray>",
"setup.setup_finished": "<prefix><dark_aqua>You should have been teleported to the created world. Otherwise you will need to set the generator manually using the bukkit.yml or your chosen world management plugin.</dark_aqua>", "setup.setup_finished": "<prefix><dark_aqua>You should have been teleported to the created world. Otherwise you will need to set the generator manually using the bukkit.yml or your chosen world management plugin.</dark_aqua>",
"setup.setup_world_taken": "<prefix><red><value> is already a world. Choose a different name.</red>", "setup.setup_world_taken": "<prefix><gray><value> </gray><red>is already a world. Choose a different name.</red>",
"setup.setup_cancelled": "<prefix><red>Cancelled setup.</red>", "setup.setup_cancelled": "<prefix><red>Cancelled setup.</red>",
"setup.setup_world_name": "<prefix><gold>What do you want your world to be called?</gold>", "setup.setup_world_name": "<prefix><gold>What do you want your world to be called?</gold>",
"setup.setup_world_name_error": "<prefix><red>You need to choose a world name!</red>", "setup.setup_world_name_error": "<prefix><red>You need to choose a world name!</red>",
@ -153,7 +158,6 @@
"plotareatype.plot_area_type_partial": "<gray>Vanilla with clusters of plots</gray>", "plotareatype.plot_area_type_partial": "<gray>Vanilla with clusters of plots</gray>",
"schematics.schematic_too_large": "<prefix><red>The plot is too large for this action!</red>", "schematics.schematic_too_large": "<prefix><red>The plot is too large for this action!</red>",
"schematics.schematic_missing_arg": "<prefix><gray>You need to specify an argument. Possible values: </gray><gold>save</gold><gray>, </gray><gold>paste </gold><gray>, </gray><gold>exportall</gold><gray>, </gray><gold>list</gold>",
"schematics.schematic_invalid": "<prefix><red>That is not a valid schematic. Reason: </red><gray><reason>.</gray>", "schematics.schematic_invalid": "<prefix><red>That is not a valid schematic. Reason: </red><gray><reason>.</gray>",
"schematics.schematic_invalid_named": "<prefix><red><schemname> is not a valid schematic. Reason: </red><gray><reason>.</gray>", "schematics.schematic_invalid_named": "<prefix><red><schemname> is not a valid schematic. Reason: </red><gray><reason>.</gray>",
"schematics.schematic_paste_merged": "<prefix><red>Schematics cannot be pasted onto merged plots. Please unmerge the plot before performing the paste.</red>", "schematics.schematic_paste_merged": "<prefix><red>Schematics cannot be pasted onto merged plots. Please unmerge the plot before performing the paste.</red>",
@ -162,10 +166,11 @@
"schematics.schematic_list": "<prefix><dark_aqua>Saved Schematics: </dark_aqua><gold><list></gold>", "schematics.schematic_list": "<prefix><dark_aqua>Saved Schematics: </dark_aqua><gold><list></gold>",
"schematics.mca_file_size": "<prefix><gold>Note: The `.mca` files are 512x512.</gold>", "schematics.mca_file_size": "<prefix><gold>Note: The `.mca` files are 512x512.</gold>",
"schematics.schematic_exportall_started": "<prefix><gold>Starting export...</gold>", "schematics.schematic_exportall_started": "<prefix><gold>Starting export...</gold>",
"schematics.schematic_exportall_world_args": "<prefix><gold>Need world argument. Use </gold><dark_gray>/plot sch exportall area</dark_gray>", "schematics.schematic_exportall_world_args": "<prefix><gray>Need world argument<gray>",
"schematics.schematic_exportall_finished": "<prefix><gold>Finished mass export.</gold>", "schematics.schematic_exportall_finished": "<prefix><gold>Finished mass export.</gold>",
"schematics.schematic_exportall_single_finished": "<prefix><gold>Finished export.</gold>", "schematics.schematic_exportall_single_finished": "<prefix><gold>Finished export.</gold>",
"schematic.schematic_exportall_world": "<prefix><red>Invalid world. Use </red><dark_aqua>/plot sch exportall <area></dark_aqua><red>.</red>", "schematic.schematic_exportall_world": "<prefix><red>Invalid world.</red>",
"schematics.plot_to_schem": "<dark_aqua>Plot</dark_aqua><dark_gray>-></dark_gray><dark_aqua>Schematic</dark_aqua><dark_gray>: </dark_gray><gray>Found </gray><red><amount></red><gray> plots...</gray>",
"error.task_in_process": "<prefix><gold>Task is already running.</gold>", "error.task_in_process": "<prefix><gold>Task is already running.</gold>",
@ -190,7 +195,6 @@
"position.position_set": "<prefix><gold>Home position set to your current location.</gold>", "position.position_set": "<prefix><gold>Home position set to your current location.</gold>",
"position.position_unset": "<prefix><gold>Home position reset to the default location.</gold>", "position.position_unset": "<prefix><gold>Home position reset to the default location.</gold>",
"position.home_argument": "<prefix><gray>Use /plot set home [none]</gray>",
"permission.no_schematic_permission": "<prefix><red>You don't have the permission required to use schematic </red><gold><value></gold><red>.</red>", "permission.no_schematic_permission": "<prefix><red>You don't have the permission required to use schematic </red><gold><value></gold><red>.</red>",
"permission.no_permission": "<prefix><red>You are lacking the permission node: <gold><node></gold>.</red>", "permission.no_permission": "<prefix><red>You are lacking the permission node: <gold><node></gold>.</red>",
@ -259,6 +263,9 @@
"database.invalid_args": "<prefix><red>Please make sure you are using the correct arguments.</red>", "database.invalid_args": "<prefix><red>Please make sure you are using the correct arguments.</red>",
"database.failed_to_open": "<prefix><red>Failed to open connection, read stacktrace for info.</red>", "database.failed_to_open": "<prefix><red>Failed to open connection, read stacktrace for info.</red>",
"template.invalid_template": "<prefix><red>Invalid template file: </red><gray><value>.template</gray>",
"template.template_failed": "<prefix><red>Failed: </red><gray><value></gray>",
"debugexec.changes_column": "<prefix><gold>Changes/column: </gold><gray><value></gray>", "debugexec.changes_column": "<prefix><gold>Changes/column: </gold><gray><value></gray>",
"debugexec.starting_task": "<prefix><gold>Starting task...</gold>", "debugexec.starting_task": "<prefix><gold>Starting task...</gold>",
"debugexec.threshold_default": "<prefix><gray>`threshold` = The percentage of plots you want to clear (100 clears 100% of plots so no point calibrating it.</gray>", "debugexec.threshold_default": "<prefix><gray>`threshold` = The percentage of plots you want to clear (100 clears 100% of plots so no point calibrating it.</gray>",
@ -284,8 +291,8 @@
"debugroadregen.schematic": "<prefix><red>If no schematic is set, the following will not do anything.</red>\n<gray> - To set a schematic, stand in a plot and use </gray><red>/plot createroadschematic</red>", "debugroadregen.schematic": "<prefix><red>If no schematic is set, the following will not do anything.</red>\n<gray> - To set a schematic, stand in a plot and use </gray><red>/plot createroadschematic</red>",
"debugroadregen.regenallroads": "<prefix><red>To regenerate all roads: /plot regenallroads</red>", "debugroadregen.regenallroads": "<prefix><red>To regenerate all roads: /plot regenallroads</red>",
"errors.invalid_player": "<prefix><red>Player not found: <gray><value></gray>.</red>", "errors.invalid_player": "<prefix><red>Player not found: </red><gray><value></gray><red>.</red>",
"errors.invalid_player_offline": "<prefix><red>The player must be online: <gray><player></gray>.</red>", "errors.invalid_player_offline": "<prefix><gray><player></gray><red> must be online.</red>",
"errors.invalid_command_flag": "<prefix><red>Invalid command flag: </red><value></gray>", "errors.invalid_command_flag": "<prefix><red>Invalid command flag: </red><value></gray>",
"errors.error": "<prefix><red>An error occurred: </gray><value></gray></red>", "errors.error": "<prefix><red>An error occurred: </gray><value></gray></red>",
"errors.error_create": "<prefix><red>An error occurred while creating the world: <gray><world></gray></red>", "errors.error_create": "<prefix><red>An error occurred while creating the world: <gray><world></gray></red>",
@ -317,6 +324,8 @@
"players.fetching_players_timeout": "<prefix><red>The specified users did not exist in the cache and will be fetched in the background. Please wait a couple of minutes.</red>", "players.fetching_players_timeout": "<prefix><red>The specified users did not exist in the cache and will be fetched in the background. Please wait a couple of minutes.</red>",
"trim.trim_in_progress": "<prefix><red>A world trim task is already in progress!</red>", "trim.trim_in_progress": "<prefix><red>A world trim task is already in progress!</red>",
"trim.trim_done": "<prefix><gold>Trim done.</gold>",
"trim.trim_starting": "<prefix><gold>Collecting region data...</gold>",
"blocklist.block_list_separator": "<gold>,</gold><gray> ", "blocklist.block_list_separator": "<gold>,</gold><gray> ",
@ -363,7 +372,6 @@
"info.plot_user_list": "<gray><user></gray>", "info.plot_user_list": "<gray><user></gray>",
"info.plot_flag_list": "<gray><flag>: <value></gray>", "info.plot_flag_list": "<gray><flag>: <value></gray>",
"info.plot_no_description": "<prefix><gray>No description set.</gray>", "info.plot_no_description": "<prefix><gray>No description set.</gray>",
"info.info_syntax_console": "<prefix><gray>/plot info X;Z</gray>",
"info.plot_caps_header": "<dark_gray><strikethrough>--------- <reset><gold>CAPS </gold><dark_gray><strikethrough>---------<reset>", "info.plot_caps_header": "<dark_gray><strikethrough>--------- <reset><gold>CAPS </gold><dark_gray><strikethrough>---------<reset>",
"info.plot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>", "info.plot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>",
@ -388,14 +396,14 @@
"deny.you_got_denied": "<prefix><dark_aqua>You are denied from the plot you were previously on, and got teleported to spawn.</dark_aqua>.", "deny.you_got_denied": "<prefix><dark_aqua>You are denied from the plot you were previously on, and got teleported to spawn.</dark_aqua>.",
"deny.cant_remove_owner": "<prefix><red>You can't remove the plot owner.</red>", "deny.cant_remove_owner": "<prefix><red>You can't remove the plot owner.</red>",
"kick.you_got_kicked": "<prefix><red>You got kicked from the plot!</red>", "kick.you_got_kicked": "<prefix><dark_aqua>You got kicked from the plot!</dark_aqua>",
"trusted.trusted_added": "<prefix><dark_aqua>You successfully trusted a user to the plot.</dark_aqua>", "trusted.trusted_added": "<prefix><dark_aqua>You successfully trusted a user to the plot.</dark_aqua>",
"trusted.plot_removed_user": "<prefix><red>Plot <plot> of which you were added to has been deleted due to owner inactivity.</red>", "trusted.plot_removed_user": "<prefix><red>Plot <plot> of which you were added to has been deleted due to owner inactivity.</red>",
"member.removed_players": "<prefix><gray>Removed <amount> player(s) from this plot.</gray>", "member.removed_players": "<prefix><gray>Removed <amount> player(s) from this plot.</gray>",
"member.plot_left": "<prefix><gray><player> left the plot.</gray>", "member.plot_left": "<prefix><gray><player> left the plot.</gray>",
"member.already_owner": "<prefix><gray>That user is already the plot owner: <player></gray>", "member.already_owner": "<prefix><gray><player></gray><gold> is already the plot owner.</gold>",
"member.already_added": "<prefix><gray>That user is already added to that category: <player></gray>", "member.already_added": "<prefix><gray>That user is already added to that category: <player></gray>",
"member.member_added": "<prefix><dark_aqua>That user can now build while the plot owner is online.</dark_aqua>", "member.member_added": "<prefix><dark_aqua>That user can now build while the plot owner is online.</dark_aqua>",
"members.plot_max_members": "<prefix><red>You are not allowed to add any more players to this plot.</red>", "members.plot_max_members": "<prefix><red>You are not allowed to add any more players to this plot.</red>",
@ -403,8 +411,8 @@
"owner.set_owner": "<prefix><dark_aqua>You successfully set the plot owner.</dark_aqua>", "owner.set_owner": "<prefix><dark_aqua>You successfully set the plot owner.</dark_aqua>",
"owner.set_owner_cancelled": "<prefix><red>The set owner action was cancelled.</red>", "owner.set_owner_cancelled": "<prefix><red>The set owner action was cancelled.</red>",
"owner.set_owner_missing_player": "<prefix><red>You need to specify a new owner. Correct usage is: </red><gray>/plot setowner <owner></gray>", "owner.set_owner_missing_player": "<prefix><red>You need to specify a new owner.</red>",
"owner.now_owner": "<prefix><dark_aqua>You are now the plot owner of <plot></dark_aqua>", "owner.now_owner": "<prefix><dark_aqua>You are now the plot owner of plot <plot>.</dark_aqua>",
"signs.owner_sign_line_1": "<gold>ID: </gold><gray><id></gray>", "signs.owner_sign_line_1": "<gold>ID: </gold><gray><id></gray>",
"signs.owner_sign_line_2": "<gold>Owner:</gold>", "signs.owner_sign_line_2": "<gold>Owner:</gold>",
@ -417,7 +425,7 @@
"help.help_info_item": "<gold>/plot help <gray><category> </gray><dark_gray>- </dark_gray><gray><category_desc></gray>", "help.help_info_item": "<gold>/plot help <gray><category> </gray><dark_gray>- </dark_gray><gray><category_desc></gray>",
"help.help_item": "<gold><usage> <gray>[</gray><gold><alias></gray>]</gray>\n <dark_gray>- </dark_gray><gray><desc></gray>\n", "help.help_item": "<gold><usage> <gray>[</gray><gold><alias></gray>]</gray>\n <dark_gray>- </dark_gray><gray><desc></gray>\n",
"help.help_display_all_commands": "<prefix><gray>Display all commands.</gray>", "help.help_display_all_commands": "<prefix><gray>Display all commands.</gray>",
"help.direction": "<prefix><gold>Current direction: <dir></gold>", "help.direction": "<prefix><gold>Current direction: </gold><gray><dir></gray>",
"category.command_category_claiming": "<gray>Claiming</gray>", "category.command_category_claiming": "<gray>Claiming</gray>",
"category.command_category_teleport": "<gray>Teleport</gray>", "category.command_category_teleport": "<gray>Teleport</gray>",
@ -483,9 +491,9 @@
"flag.not_valid_value": "<prefix><red>Flag values must be alphanumerical.</red>", "flag.not_valid_value": "<prefix><red>Flag values must be alphanumerical.</red>",
"flag.flag_not_removed": "<prefix><red>The flag could not be removed.</red>", "flag.flag_not_removed": "<prefix><red>The flag could not be removed.</red>",
"flag.flag_not_added": "<prefix><red>The flag could not be added.</red>", "flag.flag_not_added": "<prefix><red>The flag could not be added.</red>",
"flag.flag_removed": "<prefix><dark_aqua>Successfully removed flag.</dark_aqua>", "flag.flag_removed": "<prefix><dark_aqua>The flag has been removed successfully.</dark_aqua>",
"flag.flag_partially_removed": "<prefix><dark_aqua>Successfully removed flag value(s).</dark_aqua>", "flag.flag_partially_removed": "<prefix><dark_aqua>Successfully removed flag value(s).</dark_aqua>",
"flag.flag_added": "<prefix><dark_aqua>Successfully added flag.</dark_aqua>", "flag.flag_added": "<prefix><dark_aqua>The flag has been added successfully.</dark_aqua>",
"flag.flag_list_see_info": "<prefix><gray>Click to view information about the flag.</gray>", "flag.flag_list_see_info": "<prefix><gray>Click to view information about the flag.</gray>",
"flag.flag_parse_error": "<red>Failed to parse flag </red><gray><flag_name><red>, value </red><gray><flag_value></gray><red>: <error></red>", "flag.flag_parse_error": "<red>Failed to parse flag </red><gray><flag_name><red>, value </red><gray><flag_value></gray><red>: <error></red>",
"flag.flag_info_header": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>", "flag.flag_info_header": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
@ -648,5 +656,37 @@
"commands.description.help": "<gray>Get this help menu.</gray>", "commands.description.help": "<gray>Get this help menu.</gray>",
"commands.description.home": "<gray>Teleport to your plot(s).</gray>", "commands.description.home": "<gray>Teleport to your plot(s).</gray>",
"commands.description.inbox": "<gray>Review the comments for a plot.</gray>", "commands.description.inbox": "<gray>Review the comments for a plot.</gray>",
"commands.description.info": "<gray>Display information about the plot.</gray>" "commands.description.info": "<gray>Display information about the plot.</gray>",
"commands.description.kick": "<gray>Kick a player from your plot.</gray>",
"commands.description.leave": "<gray>Remove yourself from being trusted or added of a plot.</gray>",
"commands.description.like": "<gray>Like the plot you are standing on.</gray>",
"commands.description.list": "<gray>List plots.</gray>",
"commands.description.load": "<gray>Load your plot.</gray>",
"commands.description.merge": "<gray>Merge the plot you are standing on with another plot.</gray>",
"commands.description.middle": "<gray>Teleports you to the center of the plot.</gray>",
"commands.description.move": "<gray>Move a plot.</gray>",
"commands.description.music": "<gray>Play music in your plot.</gray>",
"commands.description.near": "<gray>Display nearby players.</gray>",
"commands.description.owner": "<gray>Set the plot owner.</gray>",
"commands.description.plugin": "<gray>Show plugin information.</gray>",
"commands.description.purge": "<gray>Purge all plots for a world.</gray>",
"commands.description.rate": "<gray>Rate a plot.</gray>",
"commands.description.regenallroads": "<gray>Regenerate all roads in the map using the set road schematic.</gray>",
"commands.description.relight": "<gray>Relight your plot.</gray>",
"commands.description.reload": "<gray>Reload translations and world settings.</gray>",
"commands.description.remove": "<gray>Remove a player from a plot.</gray>",
"commands.description.save": "<gray>Save your plot.</gray>",
"commands.description.schematic": "<gray>Manage schematics.</gray>",
"commands.description.set": "<gray>Set a plot value.</gray>",
"commands.description.sethome": "<gray>Set the plot home.</gray>",
"commands.description.setup": "<gray>Setup wizard for plot worlds.</gray>",
"commands.description.swap": "<gray>Swap two plots.</gray>",
"commands.description.target": "<gray>Target a plot with your compass.</gray>",
"commands.description.template": "<gray>Create or use a world template.</gray>",
"commands.description.toggle": "<gray>Toggle per user settings.</gray>",
"commands.description.trim": "<gray>Delete unmodified portions of your plotworld.</gray>",
"commands.description.trust": "<gray>Allow a user to build in a plot and use WorldEdit while the plot owner is offline.</gray>",
"commands.description.unlink": "<gray>Unlink a mega-plot.</gray>",
"commands.description.visit": "<gray>Visit someones plot.</gray>",
"commands.description.weanywhere": "<gray>Force bypass of WorldEdit restrictions.</gray>"
} }