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

View File

@ -96,7 +96,7 @@ public class Alias extends SubCommand {
return true;
} else {
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ALIAS_SET.getTranslated()));
Template.of("node", "plots.alias.set"));
}
break;
@ -111,7 +111,7 @@ public class Alias extends SubCommand {
result = removeAlias(player, plot);
} else {
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ALIAS_REMOVE.getTranslated()));
Template.of("node", "plots.alias.remove"));
}
break;
default:
@ -168,7 +168,7 @@ public class Alias extends SubCommand {
private boolean removeAlias(PlotPlayer<?> player, Plot plot) {
plot.setAlias(null);
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ALIAS_REMOVE.getTranslated()));
Template.of("node", "plots.alias.remove"));
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.WorldUtil;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal3;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
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.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import net.kyori.adventure.text.TranslatableComponent;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
@ -130,9 +128,9 @@ public class Area extends SubCommand {
player.sendMessage(RequiredType.CONSOLE.getErrorMessage());
return false;
}
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_CREATE)) {
if (!Permissions.hasPermission(player, "plots.area.create")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_CREATE.getTranslated()));
Template.of("node", "plots.area.create"));
return false;
}
if (args.length < 2) {
@ -245,8 +243,10 @@ public class Area extends SubCommand {
PlotSquared.get().loadWorld(world, null);
player.sendMessage(TranslatableCaption.of("single.single_area_created"));
} else {
player.sendMessage(TranslatableCaption.of("errors.error_create"),
Template.of("world", hybridPlotWorld.getWorldName()));
player.sendMessage(
TranslatableCaption.of("errors.error_create"),
Template.of("world", hybridPlotWorld.getWorldName())
);
}
};
singleRun.run();
@ -254,9 +254,9 @@ public class Area extends SubCommand {
case "c":
case "setup":
case "create":
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_CREATE)) {
if (!Permissions.hasPermission(player, "plots.area.create")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_CREATE.getTranslated()));
Template.of("node", "plots.area.create"));
return false;
}
switch (args.length) {
@ -498,8 +498,7 @@ public class Area extends SubCommand {
if (pa.getId() == null) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", getCommandString + )
);
Template.of("value", getUsage()));
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax_extended"),
Template.of("value1", getCommandString()),
@ -529,9 +528,9 @@ public class Area extends SubCommand {
return true;
case "i":
case "info": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_INFO)) {
if (!Permissions.hasPermission(player, "plots.area.info")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_INFO.getTranslated()));
Template.of("node", "plots.area.info"));
return false;
}
PlotArea area;
@ -589,9 +588,9 @@ public class Area extends SubCommand {
}
case "l":
case "list":
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_LIST)) {
if (!Permissions.hasPermission(player, "plots.area.list")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_LIST.getTranslated()));
Template.of("node", "plots.area.list"));
return false;
}
int page;
@ -658,9 +657,9 @@ public class Area extends SubCommand {
case "clear":
case "reset":
case "regenerate": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_REGEN)) {
if (!Permissions.hasPermission(player, "plots.area.regen")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_REGEN.getTranslated()));
Template.of("node", "plots.area.regen"));
return false;
}
final PlotArea area = player.getApplicablePlotArea();
@ -684,8 +683,7 @@ public class Area extends SubCommand {
.generate(null, area.getWorldName(), value.getX(), value.getZ(),
null);
}
}, () -> player.sendMessage(
TranslatableCaption.of("single.regeneration_complete"))
}, () -> player.sendMessage(TranslatableCaption.of("single.regeneration_complete"))
);
return true;
}
@ -694,9 +692,9 @@ public class Area extends SubCommand {
case "teleport":
case "visit":
case "tp":
if (!Permissions.hasPermission(player, Captions.PERMISSION_AREA_TP)) {
if (!Permissions.hasPermission(player, "plots.area.tp")) {
player.sendMessage(TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_TP.getTranslated()));
Template.of("node", "plots.area.tp"));
return false;
}
if (args.length != 2) {
@ -728,9 +726,7 @@ public class Area extends SubCommand {
return true;
case "delete":
case "remove":
player.sendMessage(
TranslatableCaption.of("single.worldcreation_location")
);
player.sendMessage(TranslatableCaption.of("single.worldcreation_location"));
return true;
}
sendUsage(player);

View File

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

View File

@ -72,7 +72,10 @@ public final class Backup extends Command {
}
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;
}
@ -142,10 +145,10 @@ public final class Backup extends Command {
Template.of("plot", "generic.generic_merged")
);
} else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
.hasPermission(player, "plots.admin.backup.other")) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ADMIN_BACKUP_OTHER.getTranslated())
Template.of("node", "plots.admin.backup.other")
);
} else {
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
@ -157,7 +160,10 @@ public final class Backup extends Command {
} else {
backupProfile.createBackup().whenComplete((backup, throwable) -> {
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();
} else {
player.sendMessage(TranslatableCaption.of("backups.backup_save_success"));
@ -190,10 +196,10 @@ public final class Backup extends Command {
Template.of("plot", "generic.generic_merged")
);
} else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
.hasPermission(player, "plots.admin.backup.other")) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_ADMIN_BACKUP_OTHER.getTranslated())
Template.of("node", "plots.admin.backup.other")
);
} else {
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")
);
} else if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
.hasPermission(player, "plots.admin.backup.other")) {
player.sendMessage(
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) {
player.sendMessage(

View File

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

View File

@ -96,7 +96,8 @@ public class Buy extends Command {
confirm.run(this, () -> {
player.sendMessage(
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);

View File

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

View File

@ -52,7 +52,13 @@ import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
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 {
private static final Logger logger =
@ -118,7 +124,7 @@ public class Claim extends SubCommand {
if (!Permissions.hasPermission(player, CaptionUtility
.format(player, Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
&& !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC) && !force) {
.hasPermission(player, "plots.admin.command.schematic") && !force) {
player.sendMessage(
TranslatableCaption.of("permission.no_schematic_permission"),
Template.of("value", schematic)
@ -175,7 +181,8 @@ public class Claim extends SubCommand {
if (mergeEvent.getEventResult() == Result.DENY) {
player.sendMessage(
TranslatableCaption.of("events.event_denied"),
Template.of("value", "Auto merge on claim"));
Template.of("value", "Auto merge on claim")
);
} else {
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;
checkTrue(force || plot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CLEAR),
.hasPermission(player, "plots.admin.command.clear"),
Captions.NO_PLOT_PERMS);
checkTrue(plot.getRunning() == 0, Captions.WAIT_FOR_TIMER);
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, () -> {
BackupManager.backup(player, plot, () -> {
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.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc;
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.util.Permissions;
import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.TranslatableComponent;
import net.kyori.adventure.text.minimessage.Template;
import java.util.HashSet;
@ -68,10 +68,10 @@ public class Cluster extends SubCommand {
switch (sub) {
case "l":
case "list": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LIST)) {
if (!Permissions.hasPermission(player, "plots.cluster.list")) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_LIST.getTranslated())
Template.of("node", "plots.cluster.list")
);
return false;
}
@ -121,10 +121,10 @@ public class Cluster extends SubCommand {
}
case "c":
case "create": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE)) {
if (!Permissions.hasPermission(player, "plots.cluster.create")) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_CREATE.getTranslated())
Template.of("node", "plots.cluster.create")
);
return false;
}
@ -180,20 +180,20 @@ public class Cluster extends SubCommand {
if (!area.contains(pos1) || !area.contains(pos2)) {
player.sendMessage(
TranslatableCaption.of("cluster.cluster_outside"),
Template.of("area", area)
Template.of("area", String.valueOf(area))
);
return false;
}
Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2);
if (!plots.isEmpty()) {
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE_OTHER)) {
.hasPermission(player, "plots.cluster.create.other")) {
UUID uuid = player.getUUID();
for (Plot plot : plots) {
if (!plot.isOwner(uuid)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_CREATE_OTHER.getTranslated())
Template.of("node", "plots.cluster.create.other")
);
return false;
}
@ -214,7 +214,7 @@ public class Cluster extends SubCommand {
if (current + cluster.getArea() > allowed) {
player.sendMessage(
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;
}
@ -240,7 +240,7 @@ public class Cluster extends SubCommand {
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_DELETE.getTranslated())
Template.of("node", "plots.cluster.delete")
);
return false;
}
@ -278,7 +278,7 @@ public class Cluster extends SubCommand {
.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE_OTHER)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_DELETE_OTHER.getTranslated()));
Template.of("node", "plots.cluster.delete.other"));
return false;
}
}
@ -291,7 +291,7 @@ public class Cluster extends SubCommand {
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE.getTranslated()));
Template.of("node", "plots.cluster.resize"));
return false;
}
if (args.length != 3) {
@ -323,15 +323,15 @@ public class Cluster extends SubCommand {
}
PlotCluster cluster = area.getCluster(player.getLocation());
if (cluster == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_pcluster"));
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
return false;
}
if (!cluster.hasHelperRights(player.getUUID())) {
if (!Permissions
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_OTHER)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission")
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE_OTHER.getTranslated()));
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.cluster.resize.other"));
return false;
}
}
@ -356,7 +356,7 @@ public class Cluster extends SubCommand {
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE_SHRINK.getTranslated())
Template.of("node", "plots.cluster.resize.shrink")
);
return false;
}
@ -367,7 +367,7 @@ public class Cluster extends SubCommand {
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE_EXPAND.getTranslated())
Template.of("node", "plots.cluster.resize.expand")
);
return false;
}
@ -385,23 +385,22 @@ public class Cluster extends SubCommand {
if (current + cluster.getArea() > allowed) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER.getTranslated() + "." + (current + cluster
.getArea()))
Template.of("node", "plots.cluster" + "." + (current + cluster.getArea()))
);
return false;
}
// resize cluster
DBFunc.resizeCluster(cluster, pos1, pos2);
player.sendMessage(TranslatableCaption.of("cluster.clister_resized"));
player.sendMessage(TranslatableCaption.of("cluster.cluster_resized"));
return true;
}
case "add":
case "inv":
case "invite": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE)) {
if (!Permissions.hasPermission(player, "plots.cluster.invite")) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_CLUSTER_INVITE.getTranslated())
Template.of("node", "plots.cluster.invite")
);
return false;
}
@ -766,7 +765,7 @@ public class Cluster extends SubCommand {
message = message.replaceAll("%name%", name);
message = message.replaceAll("%size%", size);
message = message.replaceAll("%rights%", rights);
MainUtil.sendMessage(player, message);
player.sendMessage(StaticCaption.of(message));
}
});
return true;

View File

@ -240,7 +240,7 @@ public abstract class Command {
// Send the header
header = header.replaceAll("%cur", page + 1 + "").replaceAll("%max", totalPages + 1 + "")
.replaceAll("%amount%", c.size() + "").replaceAll("%word%", "all");
MainUtil.sendMessage(player, header);
player.sendMessage(StaticCaption.of(header));
// Send the page content
List<T> subList = c.subList(page * size, max);
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.Captions;
import com.plotsquared.core.configuration.caption.LocaleHolder;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import javax.annotation.Nonnull;
@ -39,42 +40,42 @@ public enum CommandCategory implements Caption {
* Claiming CommandConfig.
* Such as: /plot claim
*/
CLAIMING(Captions.COMMAND_CATEGORY_CLAIMING),
CLAIMING(TranslatableCaption.of("category.command_category_claiming")),
/**
* Teleportation CommandConfig.
* Such as: /plot visit
*/
TELEPORT(Captions.COMMAND_CATEGORY_TELEPORT),
TELEPORT(TranslatableCaption.of("category.command_category_teleport")),
/**
* Protection.
*/
SETTINGS(Captions.COMMAND_CATEGORY_SETTINGS),
SETTINGS(TranslatableCaption.of("category.command_category_settings")),
/**
* Chat.
*/
CHAT(Captions.COMMAND_CATEGORY_CHAT),
CHAT(TranslatableCaption.of("category.command_category_chat")),
/**
* Web.
*/
SCHEMATIC(Captions.COMMAND_CATEGORY_SCHEMATIC),
SCHEMATIC(TranslatableCaption.of("category.command_category_schematic")),
/**
* Cosmetic.
*/
APPEARANCE(Captions.COMMAND_CATEGORY_APPEARANCE),
APPEARANCE(TranslatableCaption.of("category.command_category_appearance")),
/**
* Information CommandConfig.
* Such as: /plot info
*/
INFO(Captions.COMMAND_CATEGORY_INFO),
INFO(TranslatableCaption.of("category.command_category_info")),
/**
* Debug CommandConfig.
* Such as: /plot debug
*/
DEBUG(Captions.COMMAND_CATEGORY_DEBUG),
DEBUG(TranslatableCaption.of("category.command_category_debug")),
/**
* Administration commands.
*/
ADMINISTRATION(Captions.COMMAND_CATEGORY_ADMINISTRATION);
ADMINISTRATION(TranslatableCaption.of("category.command_category_administration"));
/**
* The category name (Readable).
*/

View File

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

View File

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

View File

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

View File

@ -25,7 +25,6 @@
*/
package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
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.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.world.block.BlockState;
import javafx.collections.transformation.TransformationList;
import net.kyori.adventure.text.minimessage.Template;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -28,7 +28,6 @@ package com.plotsquared.core.command;
import com.google.common.base.Charsets;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer;
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.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;

View File

@ -26,7 +26,6 @@
package com.plotsquared.core.command;
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.HybridUtils;

View File

@ -26,7 +26,6 @@
package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.events.PlotFlagAddEvent;
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"));
return;
}
player.sendMessage(StaticCaption.of(url.toString())
player.sendMessage(StaticCaption.of(url.toString()));
}
});
} 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.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -80,7 +81,10 @@ public final class FlagCommand extends Command {
}
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;
}
@ -126,10 +130,12 @@ public final class FlagCommand extends Command {
}
}
} catch (final FlagParseException e) {
MainUtil.sendMessage(player,
Captions.FLAG_PARSE_ERROR.getTranslated().replace("%flag_name%", flag.getName())
.replace("%flag_value%", e.getValue())
.replace("%error%", e.getErrorMessage()));
player.sendMessage(
TranslatableCaption.of("flag.flag_parse_error"),
Template.of("flag_name", flag.getName()),
Template.of("flag_value", e.getValue()),
Template.of("error", e.getErrorMessage())
);
return false;
} catch (final Exception e) {
return false;
@ -163,8 +169,10 @@ public final class FlagCommand extends Command {
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_SET_FLAG_OTHER)) {
MainUtil
.sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_SET_FLAG_OTHER);
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.set.flag.other")
);
return false;
}
return true;
@ -190,12 +198,15 @@ public final class FlagCommand extends Command {
GlobalFlagContainer.getInstance().getFlagMap().values());
final String best = stringComparison.getBestMatch();
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;
}
} catch (final Exception ignored) { /* Happens sometimes because of mean code */ }
if (!suggested) {
MainUtil.sendMessage(player, Captions.NOT_VALID_FLAG);
player.sendMessage(TranslatableCaption.of("flag.not_valid_flag"));
}
return null;
}
@ -289,7 +300,10 @@ public final class FlagCommand extends Command {
return;
}
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;
}
final PlotFlag<?, ?> plotFlag = getFlag(player, args[0]);
@ -313,13 +327,19 @@ public final class FlagCommand extends Command {
try {
parsed = plotFlag.parse(value);
} catch (final FlagParseException e) {
MainUtil.sendMessage(player,
Captions.FLAG_PARSE_ERROR.getTranslated().replace("%flag_name%", plotFlag.getName())
.replace("%flag_value%", e.getValue()).replace("%error%", e.getErrorMessage()));
player.sendMessage(
TranslatableCaption.of("")
);
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;
}
plot.setFlag(parsed);
MainUtil.sendMessage(player, Captions.FLAG_ADDED);
player.sendMessage(TranslatableCaption.of("flag.flag_added"));
}
@CommandDeclaration(command = "add",
@ -336,7 +356,10 @@ public final class FlagCommand extends Command {
return;
}
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;
}
final PlotFlag<?, ?> plotFlag = getFlag(player, args[0]);
@ -366,18 +389,21 @@ public final class FlagCommand extends Command {
try {
parsed = event.getFlag().parse(value);
} catch (FlagParseException e) {
MainUtil.sendMessage(player,
Captions.FLAG_PARSE_ERROR.getTranslated().replace("%flag_name%", plotFlag.getName())
.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;
}
boolean result =
player.getLocation().getPlotAbs().setFlag(localFlag.merge(parsed.getValue()));
if (!result) {
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
player.sendMessage(TranslatableCaption.of("flag.flag_not_added"));
return;
}
MainUtil.sendMessage(player, Captions.FLAG_ADDED);
player.sendMessage(TranslatableCaption.of("flag.flag_added"));
}
@CommandDeclaration(command = "remove",
@ -394,8 +420,10 @@ public final class FlagCommand extends Command {
return;
}
if (args.length != 1 && args.length != 2) {
MainUtil
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag remove <flag> [values]");
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot flag remove <flag> [values]")
);
return;
}
PlotFlag<?, ?> flag = getFlag(player, args[0]);
@ -431,23 +459,25 @@ public final class FlagCommand extends Command {
try {
parsedFlag = listFlag.parse(value);
} catch (final FlagParseException e) {
MainUtil.sendMessage(player,
Captions.FLAG_PARSE_ERROR.getTranslated().replace("%flag_name%", flag.getName())
.replace("%flag_value%", e.getValue())
.replace("%error%", e.getErrorMessage()));
player.sendMessage(
TranslatableCaption.of("flag.flag_parse_error"),
Template.of("flag_name", flag.getName()),
Template.of("flag_value", e.getValue()),
Template.of("error", e.getErrorMessage())
);
return;
}
if (((List) parsedFlag.getValue()).isEmpty()) {
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
return;
}
if (list.removeAll((List) parsedFlag.getValue())) {
if (list.isEmpty()) {
if (plot.removeFlag(flag)) {
MainUtil.sendMessage(player, Captions.FLAG_REMOVED);
player.sendMessage(TranslatableCaption.of("flag.flag_removed"));
return;
} else {
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
return;
}
} else {
@ -455,30 +485,32 @@ public final class FlagCommand extends Command {
PlotFlag plotFlag = parsedFlag.createFlagInstance(list);
PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot);
if (addEvent.getEventResult() == Result.DENY) {
sendMessage(player, Captions.EVENT_DENIED,
"Re-addition of " + plotFlag.getName());
player.sendMessage(
TranslatableCaption.of("events.event_denied"),
Template.of("value", "Re-addition of " + plotFlag.getName())
);
return;
}
if (plot.setFlag(addEvent.getFlag())) {
MainUtil.sendMessage(player, Captions.FLAG_PARTIALLY_REMOVED);
player.sendMessage(TranslatableCaption.of("flag.flag_partially_removed"));
return;
} else {
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
return;
}
}
} else {
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
return;
}
} else {
boolean result = plot.removeFlag(flag);
if (!result) {
MainUtil.sendMessage(player, Captions.FLAG_NOT_REMOVED);
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
return;
}
}
MainUtil.sendMessage(player, Captions.FLAG_REMOVED);
player.sendMessage(TranslatableCaption.of("flag.flag_removed"));
}
@CommandDeclaration(command = "list",
@ -540,12 +572,15 @@ public final class FlagCommand extends Command {
return;
}
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;
}
final PlotFlag<?, ?> plotFlag = getFlag(player, args[0]);
if (plotFlag != null) {
Captions.FLAG_INFO_HEADER.send(player);
player.sendMessage(TranslatableCaption.of("flag.flag_info_header"));
// Flag name
new PlotMessage(Captions.FLAG_INFO_NAME.getTranslated())
.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_VALUE.getTranslated()).send(player);
// 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;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.StringMan;
@ -114,7 +115,7 @@ public class Help extends Command {
Captions.HELP_INFO_ITEM.getTranslated().replaceAll("%category%", "all")
.replaceAll("%category_desc%", "Display all commands"));
builder.append("\n").append(Captions.HELP_FOOTER.getTranslated());
MainUtil.sendMessage(player, builder.toString(), false);
player.sendMessage(StaticCaption.of(builder.toString()));
return true;
}
new HelpMenu(player).setCategory(catEnum).getCommands().generateMaxPages()

View File

@ -121,9 +121,10 @@ public class Inbox extends SubCommand {
} else {
color = "";
}
sendMessage(player, Captions.INBOX_ITEM,
color + inbox.toString() + " (" + total + '/' + unread
+ ')');
player.sendMessage(
TranslatableCaption.of("comment.inbox_item"),
Template.of("value", color + inbox.toString() + " (" + total + '/' + unread + ')')
);
return;
}
}
@ -144,8 +145,10 @@ public class Inbox extends SubCommand {
}
final CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
if (inbox == null) {
sendMessage(player, Captions.INVALID_INBOX,
StringMan.join(CommentManager.inboxes.keySet(), ", "));
player.sendMessage(
TranslatableCaption.of("comment.invalid_inbox"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), ", "))
);
return false;
}
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.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.player.PlotPlayer;
@ -100,7 +101,7 @@ public class Info extends SubCommand {
.hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.getTranslated())) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", Captions.PERMISSION_AREA_INFO_FORCE.getTranslated())
Template.of("node", "plots.area.info.force")
);
return true;
}
@ -132,13 +133,11 @@ public class Info extends SubCommand {
info = getCaption(arg);
if (info == null) {
if (Settings.Ratings.USE_LIKES) {
MainUtil.sendMessage(player,
"&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
+ "&aowner&7, " + " &alikes");
player.sendMessage(StaticCaption.of("&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
+ "&aowner&7, " + " &alikes"));
} else {
MainUtil.sendMessage(player,
"&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
+ "&aowner&7, " + " &arating");
player.sendMessage(StaticCaption.of("&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
+ "&aowner&7, " + " &arating"));
}
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.TabCompletions;
import com.plotsquared.core.util.WorldUtil;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.Collection;
@ -75,15 +76,18 @@ public class Kick extends SubCommand {
}
if ((!plot.hasOwner() || !plot.isOwner(player.getUUID())) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_KICK)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
player.sendMessage(TranslatableCaption.of("permission.no_permission"));
return false;
}
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
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()) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
);
} else {
Set<PlotPlayer<?>> players = new HashSet<>();
for (UUID uuid : uuids) {
@ -104,20 +108,29 @@ public class Kick extends SubCommand {
}
players.remove(player); // Don't ever kick the calling player
if (players.isEmpty()) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
);
return;
}
for (PlotPlayer<?> player2 : players) {
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;
}
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;
}
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())) {
Location newSpawn = this.worldUtil.getSpawn(this.plotAreaManager.getAllWorlds()[0]);
if (plot.equals(newSpawn.getPlot())) {

View File

@ -27,11 +27,13 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.UUID;
@ -72,9 +74,15 @@ public class Leave extends Command {
if (plot.removeMember(uuid)) {
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 {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, 1);
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", String.valueOf(1))
);
}
}
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.Permissions;
import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@ -82,11 +83,11 @@ public class Like extends SubCommand {
.isBasePlot() && (!plot.getLikes().containsKey(uuid))) {
plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
});
MainUtil.sendMessage(player, Captions.RATE_THIS);
player.sendMessage(TranslatableCaption.of("tutorial.rate_this"));
return true;
}
}
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
return true;
}
case "purge": {
@ -100,7 +101,7 @@ public class Like extends SubCommand {
return false;
}
plot.clearRatings();
Captions.RATINGS_PURGED.send(player);
player.sendMessage(TranslatableCaption.of("ratings.ratings_purged"));
return true;
}
}
@ -111,21 +112,24 @@ public class Like extends SubCommand {
return false;
}
if (!plot.hasOwner()) {
sendMessage(player, Captions.RATING_NOT_OWNED);
player.sendMessage(TranslatableCaption.of("ratings.rating_not_owned"));
return false;
}
if (plot.isOwner(player.getUUID())) {
sendMessage(player, Captions.RATING_NOT_YOUR_OWN);
player.sendMessage(TranslatableCaption.of("ratings.rating_not_your_own"));
return false;
}
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;
}
final Runnable run = () -> {
final Boolean oldRating = plot.getLikes().get(uuid);
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;
}
final int rating;
@ -140,9 +144,15 @@ public class Like extends SubCommand {
if (event.getRating() != null) {
plot.addRating(uuid, event.getRating());
if (like) {
sendMessage(player, Captions.RATING_LIKED, plot.getId().toString());
player.sendMessage(
TranslatableCaption.of("ratings.rating_liked"),
Template.of("plot", plot.getId().toString())
);
} 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.SortingStrategy;
import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -158,9 +159,11 @@ public class ListCmd extends SubCommand {
final Consumer<PlotQuery> plotConsumer = query -> {
if (query == null) {
sendMessage(player, Captions.DID_YOU_MEAN,
new StringComparison<>(args[0], new String[] {"mine", "shared", "world", "all"})
.getBestMatch());
player.sendMessage(
TranslatableCaption.of("commandconfig.did_you_mean"),
Template.of("value", new StringComparison<>(args[0], new String[] {"mine", "shared", "world", "all"})
.getBestMatch())
);
return;
}

View File

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

View File

@ -100,7 +100,7 @@ public class Merge extends SubCommand {
return false;
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false;
}
Direction direction = null;
@ -132,10 +132,14 @@ public class Merge extends SubCommand {
}
}
if (direction == null) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot merge <" + StringMan.join(values, "|") + "> [removeroads]");
MainUtil.sendMessage(player, Captions.DIRECTION.getTranslated()
.replaceAll("%dir%", direction(location.getYaw())));
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]")
);
player.sendMessage(
TranslatableCaption.of("help.direction"),
Template.of("dir", direction(location.getYaw()))
);
return false;
}
final int size = plot.getConnectedPlots().size();
@ -153,7 +157,10 @@ public class Merge extends SubCommand {
final int maxSize = event.getMax();
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;
}
final PlotArea plotArea = plot.getArea();
@ -168,24 +175,29 @@ public class Merge extends SubCommand {
}
if (!force && !terrain && !Permissions
.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated());
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.merge.keeproad")
);
return true;
}
if (plot.autoMerge(Direction.ALL, maxSize, uuid, terrain)) {
if (this.econHandler != null && plotArea.useEconomy() && price > 0d) {
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;
}
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE);
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
return false;
}
if (!force && !plot.isOwner(uuid)) {
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;
} else {
uuid = plot.getOwnerAbs();
@ -193,7 +205,10 @@ public class Merge extends SubCommand {
}
if (!force && this.econHandler != null && plotArea.useEconomy() && price > 0d
&& 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;
}
final boolean terrain;
@ -204,26 +219,34 @@ public class Merge extends SubCommand {
}
if (!force && !terrain && !Permissions
.hasPermission(player, Captions.PERMISSION_MERGE_KEEP_ROAD)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_MERGE_KEEP_ROAD.getTranslated());
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.merge.keeproad")
);
return true;
}
if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) {
if (this.econHandler != null && plotArea.useEconomy() && price > 0d) {
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;
}
Plot adjacent = plot.getRelative(direction);
if (adjacent == null || !adjacent.hasOwner() || adjacent
.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;
}
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;
}
java.util.Set<UUID> uuids = adjacent.getOwners();
@ -236,22 +259,28 @@ public class Merge extends SubCommand {
isOnline = true;
final Direction dir = direction;
Runnable run = () -> {
MainUtil.sendMessage(accepter, Captions.MERGE_ACCEPTED);
accepter.sendMessage(TranslatableCaption.of("merge.merge_accepted"));
plot.autoMerge(dir, maxSize - size, owner, terrain);
PlotPlayer plotPlayer = PlotSquared.platform().getPlayerManager().getPlayerIfExists(player.getUUID());
if (plotPlayer == null) {
sendMessage(accepter, Captions.MERGE_NOT_VALID);
accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid"));
return;
}
if (this.econHandler != null && plotArea.useEconomy() && price > 0d) {
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;
}
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)) {
CmdConfirm.addPending(accepter, Captions.MERGE_REQUEST_CONFIRM.getTranslated()
@ -261,10 +290,10 @@ public class Merge extends SubCommand {
}
}
if (!force && !isOnline) {
MainUtil.sendMessage(player, Captions.NO_AVAILABLE_AUTOMERGE);
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
return false;
}
MainUtil.sendMessage(player, Captions.MERGE_REQUESTED);
player.sendMessage(TranslatableCaption.of("merge.merge_requested"));
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.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
@ -66,7 +67,7 @@ public class Move extends SubCommand {
}
if (!plot1.isOwner(player.getUUID()) && !Permissions
.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);
}
boolean override = false;
@ -89,27 +90,30 @@ public class Move extends SubCommand {
plot2 = area.getPlotAbs(plot1.getId());
}
if (plot1.equals(plot2)) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot copy <X;Z>");
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot copy <X;Z>")
);
return CompletableFuture.completedFuture(false);
}
if (!plot1.getArea().isCompatible(plot2.getArea()) && (!override || !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated()))) {
Captions.PLOTWORLD_INCOMPATIBLE.send(player);
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible"));
return CompletableFuture.completedFuture(false);
}
if (plot1.isMerged() || plot2.isMerged()) {
Captions.MOVE_MERGED.send(player);
player.sendMessage(TranslatableCaption.of("move.move_merged"));
return CompletableFuture.completedFuture(false);
}
return plot1.move(plot2, () -> {
}, false).thenApply(result -> {
if (result) {
MainUtil.sendMessage(player, Captions.MOVE_SUCCESS);
player.sendMessage(TranslatableCaption.of("move.move_success"));
return true;
} else {
MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED);
player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
return false;
}
});

View File

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

View File

@ -26,11 +26,13 @@
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.plot.Plot;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template;
import java.util.concurrent.CompletableFuture;
@ -50,7 +52,10 @@ public class Near extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
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);
}
}

View File

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

View File

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

View File

@ -27,8 +27,8 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.listener.PlotListener;
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.util.StringMan;
import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -96,7 +97,10 @@ public class Purge extends SubCommand {
case "a":
area = this.plotAreaManager.getPlotAreaByString(split[1]);
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;
}
break;
@ -105,7 +109,10 @@ public class Purge extends SubCommand {
try {
id = PlotId.fromString(split[1]);
} 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;
}
break;
@ -113,7 +120,10 @@ public class Purge extends SubCommand {
case "o":
owner = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(split[1], Settings.UUID.BLOCKING_TIMEOUT);
if (owner == null) {
Captions.INVALID_PLAYER.send(player, split[1]);
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", split[1])
);
return false;
}
break;
@ -121,7 +131,10 @@ public class Purge extends SubCommand {
case "s":
added = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(split[1], Settings.UUID.BLOCKING_TIMEOUT);
if (added == null) {
Captions.INVALID_PLAYER.send(player, split[1]);
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", split[1])
);
return false;
}
break;
@ -179,7 +192,7 @@ public class Purge extends SubCommand {
}
}
if (toDelete.isEmpty()) {
Captions.FOUND_NO_PLOTS.send(player);
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
return false;
}
String cmd =
@ -225,7 +238,10 @@ public class Purge extends SubCommand {
} else {
TaskManager.runTask(() -> {
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.Permissions;
import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@ -99,11 +100,11 @@ public class Rate extends SubCommand {
.isAdded(uuid)) {
p.teleportPlayer(player, TeleportCause.COMMAND, result -> {
});
MainUtil.sendMessage(player, Captions.RATE_THIS);
player.sendMessage(TranslatableCaption.of("tutorial.rate_this"));
return true;
}
}
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
return false;
}
case "purge": {
@ -117,7 +118,7 @@ public class Rate extends SubCommand {
return false;
}
plot.clearRatings();
Captions.RATINGS_PURGED.send(player);
player.sendMessage(TranslatableCaption.of("ratings.ratings_purged"));
return true;
}
}
@ -128,23 +129,25 @@ public class Rate extends SubCommand {
return false;
}
if (!plot.hasOwner()) {
sendMessage(player, Captions.RATING_NOT_OWNED);
player.sendMessage(TranslatableCaption.of("ratings.rating_not_owned"));
return false;
}
if (plot.isOwner(player.getUUID())) {
sendMessage(player, Captions.RATING_NOT_YOUR_OWN);
player.sendMessage(TranslatableCaption.of("ratings.rating_not_your_own"));
return false;
}
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;
}
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
final Runnable run = new Runnable() {
@Override public void run() {
if (plot.getRatings().containsKey(player.getUUID())) {
sendMessage(player, Captions.RATING_ALREADY_EXISTS,
plot.getId().toString());
player.sendMessage(
TranslatableCaption.of("ratings.rating_already_exists"),
Template.of("plot", plot.getId().toString())
);
return;
}
final MutableInt index = new MutableInt(0);
@ -160,15 +163,19 @@ public class Rate extends SubCommand {
.callRating(this.player, plot, new Rating(rV));
if (event.getRating() != null) {
plot.addRating(this.player.getUUID(), event.getRating());
sendMessage(this.player, Captions.RATING_APPLIED,
plot.getId().toString());
player.sendMessage(
TranslatableCaption.of("ratings.rating_applied"),
Template.of("plot", plot.getId().toString())
);
if (Permissions
.hasPermission(this.player, Captions.PERMISSION_COMMENT)) {
Command command =
MainCommand.getInstance().getCommand(Comment.class);
if (command != null) {
MainUtil.sendMessage(this.player, Captions.COMMENT_THIS,
command.getUsage());
player.sendMessage(
TranslatableCaption.of("tutorial.comment_this"),
Template.of("plot", "/plot rate")
);
}
}
}
@ -204,7 +211,7 @@ public class Rate extends SubCommand {
return true;
}
if (args.length < 1) {
sendMessage(player, Captions.RATING_NOT_VALID);
player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid"));
return true;
}
String arg = args[0];
@ -212,24 +219,30 @@ public class Rate extends SubCommand {
if (MathMan.isInteger(arg) && arg.length() < 3 && !arg.isEmpty()) {
rating = Integer.parseInt(arg);
if (rating > 10 || rating < 1) {
sendMessage(player, Captions.RATING_NOT_VALID);
player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid"));
return false;
}
} else {
sendMessage(player, Captions.RATING_NOT_VALID);
player.sendMessage(TranslatableCaption.of("ratings.rating_not_valid"));
return false;
}
final UUID uuid = player.getUUID();
final Runnable run = () -> {
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;
}
PlotRateEvent event =
this.eventDispatcher.callRating(player, plot, new Rating(rating));
if (event.getRating() != null) {
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) {

View File

@ -26,13 +26,14 @@
package com.plotsquared.core.command;
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.HybridUtils;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.plot.world.PlotAreaManager;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
@ -60,38 +61,44 @@ public class RegenAllRoads extends SubCommand {
try {
height = Integer.parseInt(args[1]);
} catch (NumberFormatException ignored) {
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0, 256)");
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot regenallroads <world> [height]");
player.sendMessage(
TranslatableCaption.of("invalid.not_valid_number"),
Template.of("value", "(0, 256)")
);
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot regenallroads <world> [height]")
);
return false;
}
} else if (args.length != 1) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot regenallroads <world> [height]");
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot regenallroads <world> [height]")
);
return false;
}
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
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;
}
String name = args[0];
PlotManager manager = area.getPlotManager();
if (!(manager instanceof HybridPlotManager)) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
return false;
}
//Set<BlockVector2> chunks = ChunkManager.manager.getChunkChunks(name);
MainUtil
.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");
player.sendMessage(TranslatableCaption.of("debugroadregen.schematic"));
//MainUtil.sendMessage(player, "&6Potential chunks to update: &7" + (chunks.size() * 1024));
//MainUtil.sendMessage(player, "&6Estimated time: &7" + chunks.size() + " seconds");
boolean result = this.hybridUtils.scheduleRoadUpdate(area, height);
if (!result) {
MainUtil.sendMessage(player,
"&cCannot schedule mass schematic update! (Is one already in progress?)");
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress"));
return false;
}
return true;

View File

@ -25,7 +25,7 @@
*/
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.plot.Plot;
import com.plotsquared.core.queue.LocalBlockQueue;
@ -52,7 +52,7 @@ public class Relight extends Command {
RunnableVal2<Command, CommandResult> whenDone) {
final Plot plot = player.getCurrentPlot();
if (plot == null) {
Captions.NOT_IN_PLOT.send(player);
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
return CompletableFuture.completedFuture(false);
}
final LocalBlockQueue queue = plot.getArea().getQueue(false);
@ -62,7 +62,7 @@ public class Relight extends Command {
}
}, () -> {
plot.refreshChunks();
Captions.SET_BLOCK_ACTION_FINISHED.send(player);
player.sendMessage(TranslatableCaption.of("setblock.set_block_action_finished"));
}, 5);
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.ConfigurationSection;
import com.plotsquared.core.configuration.MemorySection;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile;
@ -116,10 +117,10 @@ public class Reload extends SubCommand {
}
});
this.worldConfiguration.save(this.worldFile);
MainUtil.sendMessage(player, Captions.RELOADED_CONFIGS);
player.sendMessage(TranslatableCaption.of("reload.reloaded_configs"));
} catch (IOException e) {
e.printStackTrace();
MainUtil.sendMessage(player, Captions.RELOAD_FAILED);
player.sendMessage(TranslatableCaption.of("reload.reload_failed"));
}
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.PlayerManager;
import com.plotsquared.core.util.TabCompletions;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.Collection;
@ -67,22 +68,25 @@ public class Remove extends SubCommand {
return false;
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_REMOVE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return true;
}
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
int count = 0;
if (throwable instanceof TimeoutException) {
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
return;
} 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;
} else if (!uuids.isEmpty()) {
for (UUID uuid : uuids) {
@ -116,9 +120,15 @@ public class Remove extends SubCommand {
}
}
if (count == 0) {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
);
} else {
MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, count + "");
player.sendMessage(
TranslatableCaption.of("member.removed_players"),
Template.of("amount", count + "")
);
}
});
return true;

View File

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

View File

@ -29,6 +29,7 @@ import com.google.common.collect.Lists;
import com.google.inject.Inject;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.location.Location;
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.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import javax.swing.plaf.basic.BasicSliderUI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
@ -69,19 +72,27 @@ public class SchematicCmd extends SubCommand {
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
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;
}
String arg = args[0].toLowerCase();
switch (arg) {
case "paste": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_PASTE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SCHEMATIC_PASTE);
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.schematic.paste")
);
return false;
}
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;
}
Location loc = player.getLocation();
@ -91,20 +102,20 @@ public class SchematicCmd extends SubCommand {
return false;
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC_PASTE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
.hasPermission(player, "plots.admin.command.schematic.paste")) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return false;
}
if (this.running) {
MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS);
player.sendMessage(TranslatableCaption.of("error.task_in_process"));
return false;
}
if (plot.isMerged()) {
MainUtil.sendMessage(player, Captions.SCHEMATIC_PASTE_MERGED);
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_merged"));
return false;
}
final String location = args[1];
@ -119,8 +130,10 @@ public class SchematicCmd extends SubCommand {
schematic = this.schematicHandler.getSchematic(url);
} catch (Exception e) {
e.printStackTrace();
sendMessage(player, Captions.SCHEMATIC_INVALID,
"non-existent url: " + location);
player.sendMessage(
TranslatableCaption.of("schematics.schematic_invalid"),
Template.of("reason", "non-existent url: " + location)
);
SchematicCmd.this.running = false;
return;
}
@ -133,17 +146,19 @@ public class SchematicCmd extends SubCommand {
}
if (schematic == null) {
SchematicCmd.this.running = false;
sendMessage(player, Captions.SCHEMATIC_INVALID,
"non-existent or not in gzip format");
player.sendMessage(
TranslatableCaption.of("schematics.schematic_invalid"),
Template.of("reason", "non-existent or not in gzip format")
);
return;
}
this.schematicHandler.paste(schematic, plot, 0, 1, 0, false, new RunnableVal<Boolean>() {
@Override public void run(Boolean value) {
SchematicCmd.this.running = false;
if (value) {
sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS);
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
} 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 "exportall": {
if (!(player instanceof ConsolePlayer)) {
MainUtil.sendMessage(player, Captions.NOT_CONSOLE);
player.sendMessage(TranslatableCaption.of("console.not_console"));
return false;
}
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;
}
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
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;
}
Collection<Plot> plots = area.getPlots();
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;
}
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) {
MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS);
player.sendMessage(TranslatableCaption.of("error.task_in_process"));
return false;
} else {
MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED);
MainUtil.sendMessage(player,
"&3Plot&8->&3Schematic&8: &7Found &c" + plots.size() + "&7 plots...");
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_started"));
player.sendMessage(
TranslatableCaption.of("schematics.plot_to_schem"),
Template.of("amount", String.valueOf(plots.size()))
);
}
break;
}
case "export":
case "save":
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_SAVE)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SCHEMATIC_SAVE);
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.schematic.save")
);
return false;
}
if (this.running) {
MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS);
player.sendMessage(TranslatableCaption.of("error.task_in_process"));
return false;
}
Location location = player.getLocation();
@ -200,38 +230,46 @@ public class SchematicCmd extends SubCommand {
return false;
}
if (!plot.hasOwner()) {
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false;
}
if (!plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC_SAVE)) {
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
.hasPermission(player, "plots.admin.command.schematic.save")) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return false;
}
ArrayList<Plot> plots = Lists.newArrayList(plot);
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;
});
if (!result) {
MainUtil.sendMessage(player, Captions.TASK_IN_PROCESS);
player.sendMessage(TranslatableCaption.of("error.task_in_process"));
return false;
} else {
MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_STARTED);
player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_started"));
}
break;
case "list": {
if (!Permissions.hasPermission(player, Captions.PERMISSION_SCHEMATIC_LIST)) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
Captions.PERMISSION_SCHEMATIC_LIST);
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.schematic.list")
);
return false;
}
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;
default:
sendMessage(player, Captions.SCHEMATIC_MISSING_ARG);
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "Possible values: save, paste , exportall, list")
);
break;
}
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.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@ -127,7 +128,10 @@ public class Set extends SubCommand {
} else if (!blockType.contains(forbiddenType)) {
continue;
}
Captions.COMPONENT_ILLEGAL_BLOCK.send(player, forbiddenType);
player.sendMessage(
TranslatableCaption.of("invalid.component_illegal_block"),
Template.of("value", forbiddenType)
);
return true;
}
}
@ -144,14 +148,14 @@ public class Set extends SubCommand {
return false;
}
if (args.length < 2) {
MainUtil.sendMessage(player, Captions.NEED_BLOCK);
player.sendMessage(TranslatableCaption.of("need.need_block"));
return true;
}
Pattern pattern = PatternUtil.parse(player, material, false);
if (plot.getRunning() > 0) {
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
return false;
}
@ -160,7 +164,7 @@ public class Set extends SubCommand {
for (Plot current : plot.getConnectedPlots()) {
current.setComponent(component, pattern);
}
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT);
player.sendMessage(TranslatableCaption.of("working.generating_component"));
blockQueue.addEmptyTask(plot::removeRunning);
});
return true;

View File

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

View File

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

View File

@ -28,11 +28,14 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
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.generator.GeneratorWrapper;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.setup.SetupProcess;
import com.plotsquared.core.setup.SetupStep;
import com.plotsquared.core.util.SetupUtils;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@ -67,14 +70,18 @@ public class Setup extends SubCommand {
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) {
SetupProcess process = player.getMeta("setup");
if (process == null) {
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;
}
process = new SetupProcess();
@ -91,7 +98,7 @@ public class Setup extends SubCommand {
process.getCurrentStep().announce(player);
} else if ("cancel".equalsIgnoreCase(args[0])) {
player.deleteMeta("setup");
MainUtil.sendMessage(player, Captions.SETUP_CANCELLED);
player.sendMessage(TranslatableCaption.of("setup.setup_cancelled"));
} else {
process.handleInput(player, args[0]);
if (process.getCurrentStep() != null) {

View File

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

View File

@ -25,12 +25,13 @@
*/
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.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.minimessage.Template;
@CommandDeclaration(command = "target",
usage = "/plot target <<plot> | nearest>",
@ -47,11 +48,14 @@ public class Target extends SubCommand {
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
Location location = player.getLocation();
if (!location.isPlotArea()) {
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
return false;
}
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;
}
Plot target = null;
@ -65,14 +69,14 @@ public class Target extends SubCommand {
}
}
if (target == null) {
MainUtil.sendMessage(player, Captions.FOUND_NO_PLOTS);
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
return false;
}
} else if ((target = Plot.getPlotFromString(player, args[0], true)) == null) {
return false;
}
target.getCenter(player::setCompassTarget);
MainUtil.sendMessage(player, Captions.COMPASS_TARGET);
player.sendMessage(TranslatableCaption.of("compass.compass_target"));
return true;
}
}

View File

@ -28,17 +28,15 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
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.WorldFile;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.InvalidConfigurationException;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.file.YamlConfiguration;
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.plot.PlotArea;
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.util.FileBytes;
import com.plotsquared.core.util.FileUtils;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager;
@ -167,12 +164,16 @@ public class Template extends SubCommand {
if (args.length != 2 && args.length != 3) {
if (args.length == 1) {
if (args[0].equalsIgnoreCase("export")) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot template export <world>");
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template export <world>")
);
return true;
} else if (args[0].equalsIgnoreCase("import")) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot template import <world> <template>");
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template import <world> <template>")
);
return true;
}
}
@ -183,18 +184,25 @@ public class Template extends SubCommand {
switch (args[0].toLowerCase()) {
case "import": {
if (args.length != 3) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot template import <world> <template>");
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template import <world> <template>")
);
return false;
}
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;
}
boolean result = extractAllFiles(world, args[2]);
if (!result) {
MainUtil
.sendMessage(player, "&cInvalid template file: " + args[2] + ".template");
player.sendMessage(
TranslatableCaption.of("template.invalid_template"),
net.kyori.adventure.text.minimessage.Template.of("value", args[2])
);
return false;
}
File worldFile = FileUtils.getFile(PlotSquared.platform().getDirectory(),
@ -220,20 +228,22 @@ public class Template extends SubCommand {
this.setupUtils.setupWorld(builder);
this.globalBlockQueue.addEmptyTask(() -> {
MainUtil.sendMessage(player, "Done!");
player.sendMessage(TranslatableCaption.of("debugimportworlds.done"));
player.teleport(this.worldUtil.getSpawn(world), TeleportCause.COMMAND);
});
return true;
}
case "export":
if (args.length != 2) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot template export <world>");
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
net.kyori.adventure.text.minimessage.Template.of("value", "/plot template export <world>")
);
return false;
}
final PlotArea area = this.plotAreaManager.getPlotAreaByString(world);
if (area == null) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
return false;
}
final PlotManager manager = area.getPlotManager();
@ -242,10 +252,13 @@ public class Template extends SubCommand {
manager.exportTemplate();
} catch (Exception e) { // Must recover from any exception thrown a third party template manager
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;
}
MainUtil.sendMessage(player, "Done!");
player.sendMessage(TranslatableCaption.of("debugimportworlds.done"));
});
return true;
default:

View File

@ -26,9 +26,11 @@
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.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template;
@CommandDeclaration(command = "toggle",
aliases = {"attribute"},
@ -50,9 +52,15 @@ public class Toggle extends Command {
RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) {
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 {
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,
RunnableVal2<Command, CommandResult> whenDone) {
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 {
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,
RunnableVal2<Command, CommandResult> whenDone) {
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 {
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,
RunnableVal2<Command, CommandResult> whenDone) {
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 {
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,
RunnableVal2<Command, CommandResult> whenDone) {
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 {
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,
RunnableVal2<Command, CommandResult> whenDone) {
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 {
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,
RunnableVal2<Command, CommandResult> whenDone) {
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 {
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
player.sendMessage(
TranslatableCaption.of("toggle.toggle_enabled"),
Template.of("setting", command.toString())
);
}
player.refreshDebug();
}

View File

@ -27,7 +27,8 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
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.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
@ -92,16 +93,16 @@ public class Trim extends SubCommand {
if (result == null) {
return false;
}
MainUtil.sendMessage(null, "Collecting region data...");
TranslatableCaption.of("trim.trim_starting");
final List<Plot> plots = PlotQuery.newQuery().inWorld(world).asList();
if (ExpireManager.IMP != null) {
plots.removeAll(ExpireManager.IMP.getPendingExpired());
}
result.value1 = new HashSet<>(PlotSquared.platform().getRegionManager().getChunkChunks(world));
result.value2 = new HashSet<>();
MainUtil.sendMessage(null, " - MCA #: " + result.value1.size());
MainUtil.sendMessage(null, " - CHUNKS: " + (result.value1.size() * 1024) + " (max)");
MainUtil.sendMessage(null, " - TIME ESTIMATE: 12 Parsecs");
StaticCaption.of(" - MCA #: " + result.value1.size());
StaticCaption.of(" - CHUNKS: " + (result.value1.size() * 1024) + " (max)");
StaticCaption.of(" - TIME ESTIMATE: 12 Parsecs");
TaskManager.getPlatformImplementation().objectTask(plots, new RunnableVal<Plot>() {
@Override public void run(Plot plot) {
Location pos1 = plot.getCorners()[0];
@ -131,11 +132,11 @@ public class Trim extends SubCommand {
}
final String world = args[0];
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;
}
if (Trim.TASK) {
Captions.TRIM_IN_PROGRESS.send(player);
player.sendMessage(TranslatableCaption.of("trim.trim_in_progress"));
return false;
}
Trim.TASK = true;
@ -151,7 +152,7 @@ public class Trim extends SubCommand {
@Override public void run() {
if (nonViable.isEmpty()) {
Trim.TASK = false;
player.sendMessage("Trim done!");
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
logger.info("[P2] Trim done!");
return;
}
@ -201,7 +202,8 @@ public class Trim extends SubCommand {
} else {
regenTask = () -> {
Trim.TASK = false;
player.sendMessage("Trim done!");
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
logger.info("[P2] Trim done!");
};
}
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.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.Collection;
@ -79,9 +80,12 @@ public class Trust extends Command {
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
if (throwable != null) {
if (throwable instanceof TimeoutException) {
Captions.FETCHING_PLAYERS_TIMEOUT.send(player);
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
} else {
Captions.INVALID_PLAYER.send(player, args[0]);
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", args[0])
);
}
future.completeExceptionally(throwable);
return;
@ -94,17 +98,26 @@ public class Trust extends Command {
if (uuid == DBFunc.EVERYONE && !(
Permissions.hasPermission(player, Captions.PERMISSION_TRUST_EVERYONE) || Permissions
.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();
continue;
}
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();
continue;
}
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();
continue;
}

View File

@ -67,7 +67,7 @@ public class Unlink extends SubCommand {
return !sendMessage(player, Captions.PLOT_UNOWNED);
}
if (!plot.isMerged()) {
return sendMessage(player, Captions.UNLINK_IMPOSSIBLE);
player.sendMessage(TranslatableCaption.of("merge.unlink_impossible"));
}
final boolean createRoad;
if (args.length != 0) {
@ -92,14 +92,14 @@ public class Unlink extends SubCommand {
boolean force = event.getEventResult() == Result.FORCE;
if (!force && !plot.isOwner(player.getUUID()) && !Permissions
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_UNLINK)) {
return sendMessage(player, Captions.NO_PLOT_PERMS);
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
}
Runnable runnable = () -> {
if (!plot.unlinkPlot(createRoad, createRoad)) {
MainUtil.sendMessage(player, Captions.UNMERGE_CANCELLED);
player.sendMessage(TranslatableCaption.of("merge.unmerge_cancelled"));
return;
}
MainUtil.sendMessage(player, Captions.UNLINK_SUCCESS);
player.sendMessage(TranslatableCaption.of("merge.unlink_success"));
};
if (hasConfirmation(player)) {
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.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@ -187,7 +188,7 @@ public class Visit extends Command {
int finalPage1 = page;
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
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) {
player.sendMessage(TranslatableCaption.of("commandconfig.command_syntax"),
Templates.of("value", getUsage()));
@ -210,16 +211,19 @@ public class Visit extends Command {
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(args[0], (uuid, throwable) -> {
if (throwable instanceof TimeoutException) {
// 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()) {
// 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) {
// player not found, so we assume it's an alias if no page was provided
if (finalPage == Integer.MIN_VALUE) {
this.visit(player, PlotQuery.newQuery().withAlias(finalArgs[0]), player.getApplicablePlotArea(), confirm, whenDone, 1);
} else {
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, finalArgs[0]);
player.sendMessage(
TranslatableCaption.of("errors.invalid_player"),
Template.of("value", finalArgs[0])
);
}
} else {
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.command.MainCommand;
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.serialization.ConfigurationSerialization;
import com.plotsquared.core.generator.ClassicPlotManagerComponent;
@ -193,7 +194,7 @@ public class ComponentPresetManager {
for (Plot current : plot.getConnectedPlots()) {
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);
});
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.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nullable;
import java.util.HashMap;
@ -164,9 +165,11 @@ public class PlotListener {
for (UUID uuid : plot.getOwners()) {
final PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if (owner != null && !owner.getUUID().equals(player.getUUID())) {
MainUtil.sendMessage(owner, Captions.NOTIFY_ENTER.getTranslated()
.replace("%player", player.getName())
.replace("%plot", plot.getId().toString()));
player.sendMessage(
TranslatableCaption.of("notification.notify_enter"),
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")) {
player.setGameMode(gameMode);
} else {
MainUtil.sendMessage(player, StringMan
.replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}",
plot.getId(), "{gamemode}", gameMode));
player.sendMessage(
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
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")) {
player.setGameMode(guestGameMode);
} else {
MainUtil.sendMessage(player, StringMan
.replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}",
plot.getId(), "{gamemode}", guestGameMode));
player.sendMessage(
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
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")) {
player.setGameMode(pw.getGameMode());
} else {
MainUtil.sendMessage(player, StringMan
.replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}",
plot.toString(), "{gamemode}",
pw.getGameMode().getName().toLowerCase()));
player.sendMessage(
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
Template.of("gamemode", pw.getGameMode().getName().toLowerCase()),
Template.of("plot", plot.toString())
);
}
}
}
@ -332,9 +340,11 @@ public class PlotListener {
for (UUID uuid : plot.getOwners()) {
final PlotPlayer owner = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
if ((owner != null) && !owner.getUUID().equals(player.getUUID())) {
MainUtil.sendMessage(owner, Captions.NOTIFY_LEAVE.getTranslated()
.replace("%player", player.getName())
.replace("%plot", plot.getId().toString()));
player.sendMessage(
TranslatableCaption.of("notification.notify_leave"),
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.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.world.PlotAreaManager;
@ -90,7 +91,7 @@ public class WESubscriber {
mask = WEManager.getMask(plotPlayer);
if (mask.isEmpty()) {
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)) {
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.ConfigurationUtil;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.events.PlotComponentSetEvent;
@ -349,13 +350,13 @@ public class Plot {
}
}
if (message) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
}
return null;
}
if (area == null) {
if (message) {
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
}
return null;
}
@ -1076,8 +1077,7 @@ public class Plot {
regionManager.regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false,
this);
} catch (UnsupportedOperationException exception) {
MainUtil.sendMessage(null,
"Please ask md_5 to fix regenerateChunk() because it breaks plugins. We apologize for the inconvenience");
logger.info("[P2] Please ask md_5 to fix regenerateChunk() because it breaks plugins. We apologize for the inconvenience.");
return;
}
return;
@ -1856,7 +1856,7 @@ public class Plot {
updateWorldBorder();
}
setSign(player.getName());
MainUtil.sendMessage(player, Captions.CLAIMED);
player.sendMessage(TranslatableCaption.of("working.claimed"));
if (teleport && Settings.Teleport.ON_CLAIM) {
teleportPlayer(player, TeleportCause.COMMAND, result -> {
});
@ -1881,9 +1881,9 @@ public class Plot {
new RunnableVal<Boolean>() {
@Override public void run(Boolean value) {
if (value) {
MainUtil.sendMessage(player, Captions.SCHEMATIC_PASTE_SUCCESS);
player.sendMessage(TranslatableCaption.of("schematics.schematic_paste_success"));
} 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);
for (final PlotPlayer<?> player : players) {
if (isOwner(player.getUUID()) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_DEBUG_OTHER)) {
player.sendMessage(string);
player.sendMessage(StaticCaption.of(string));
}
}
} catch (final Exception ignored) {}
@ -3072,13 +3072,15 @@ public class Plot {
final Consumer<Location> locationConsumer = location -> {
if (Settings.Teleport.DELAY == 0 || Permissions
.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);
resultConsumer.accept(true);
return;
}
MainUtil
.sendMessage(player, Captions.TELEPORT_IN_SECONDS, Settings.Teleport.DELAY + "");
player.sendMessage(
TranslatableCaption.of("teleport.teleport_in_seconds"),
Template.of("amount", String.valueOf(Settings.Teleport.DELAY))
);
final String name = player.getName();
TaskManager.addToTeleportQueue(name);
TaskManager.runTaskLater(() -> {
@ -3086,7 +3088,7 @@ public class Plot {
return;
}
if (player.isOnline()) {
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT);
player.sendMessage(TranslatableCaption.of("teleport.teleported_to_plot"));
player.teleport(location, cause);
}
}, 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.KeepFlag;
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.query.PlotQuery;
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.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.TabCompletions;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -73,9 +75,13 @@ public class SettingsNodeStep implements SetupStep {
}
@Override public void announce(PlotPlayer<?> plotPlayer) {
MainUtil.sendMessage(plotPlayer, Captions.SETUP_STEP, this.getId() + 1,
this.configurationNode.getDescription(), this.configurationNode.getType().getType(),
String.valueOf(this.configurationNode.getDefaultValue()));
plotPlayer.sendMessage(
TranslatableCaption.of("setup.setup_step"),
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) {

View File

@ -29,6 +29,7 @@ import com.google.common.eventbus.EventBus;
import com.plotsquared.core.configuration.caption.CaptionUtility;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.events.PlayerAutoPlotEvent;
import com.plotsquared.core.events.PlayerClaimPlotEvent;
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.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -240,7 +242,7 @@ public class EventDispatcher {
}
if (this.worldEdit != null) {
if (player.getAttribute("worldedit")) {
MainUtil.sendMessage(player, Captions.WORLDEDIT_BYPASSED);
player.sendMessage(TranslatableCaption.of("worldedit.worldedit_bypassed"));
}
}
final Plot plot = player.getCurrentPlot();
@ -248,9 +250,7 @@ public class EventDispatcher {
.getArea() instanceof SinglePlotArea)) {
TaskManager.runTask(() -> plot.teleportPlayer(player, result -> {
}));
MainUtil.sendMessage(player,
CaptionUtility.format(player, Captions.TELEPORTED_TO_ROAD.getTranslated())
+ " (on-login) " + "(" + plot.getId().getX() + ";" + plot.getId().getY() + ")");
player.sendMessage(TranslatableCaption.of("teleport.teleported_to_road"));
}
}
@ -259,7 +259,7 @@ public class EventDispatcher {
if (Settings.Teleport.ON_DEATH && plot != null) {
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.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer;
import net.kyori.adventure.text.minimessage.Template;
import java.util.HashMap;
@ -124,7 +126,10 @@ public class Permissions {
public static boolean hasPermission(PlotPlayer player, String permission, boolean notify) {
if (!hasPermission(player, permission)) {
if (notify) {
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT, permission);
player.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", permission)
);
}
return false;
}

View File

@ -27,8 +27,11 @@ package com.plotsquared.core.util.helpmenu;
import com.plotsquared.core.command.CommandCategory;
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.util.StringMan;
import net.kyori.adventure.text.minimessage.Template;
import java.util.ArrayList;
import java.util.List;
@ -47,12 +50,15 @@ public class HelpPage {
public void render(PlotPlayer player) {
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 {
String message =
Captions.HELP_HEADER.getTranslated() + "\n" + this.header + "\n" + StringMan
.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>",
"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.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.debug_header": "<prefix> <gold>Debug Information</orange>\n",
"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.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>",
@ -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_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_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_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_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_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_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_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>",
@ -153,7 +158,6 @@
"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_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_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>",
@ -162,10 +166,11 @@
"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.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_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>",
@ -190,7 +195,6 @@
"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.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_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.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.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>",
@ -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.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_offline": "<prefix><red>The player must be online: <gray><player></gray>.</red>",
"errors.invalid_player": "<prefix><red>Player not found: </red><gray><value></gray><red>.</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.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>",
@ -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>",
"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> ",
@ -363,7 +372,6 @@
"info.plot_user_list": "<gray><user></gray>",
"info.plot_flag_list": "<gray><flag>: <value></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_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.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.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.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.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>",
@ -403,8 +411,8 @@
"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_missing_player": "<prefix><red>You need to specify a new owner. Correct usage is: </red><gray>/plot setowner <owner></gray>",
"owner.now_owner": "<prefix><dark_aqua>You are now the plot owner of <plot></dark_aqua>",
"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 <plot>.</dark_aqua>",
"signs.owner_sign_line_1": "<gold>ID: </gold><gray><id></gray>",
"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_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.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_teleport": "<gray>Teleport</gray>",
@ -483,9 +491,9 @@
"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_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_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_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>",
@ -648,5 +656,37 @@
"commands.description.help": "<gray>Get this help menu.</gray>",
"commands.description.home": "<gray>Teleport to your plot(s).</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>"
}