mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Some more work done towards json
This commit is contained in:
parent
6040e1bb5e
commit
2aa5c276c9
@ -49,7 +49,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@CommandDeclaration(command = "add",
|
@CommandDeclaration(command = "add",
|
||||||
description = "Allow a user to build in a plot while the plot owner is online.",
|
description = "Allow a user to build in a plot while the plot owner is online.",
|
||||||
usage = "/plot add <player|*>",
|
usage = "/plot add <player | *>",
|
||||||
category = CommandCategory.SETTINGS,
|
category = CommandCategory.SETTINGS,
|
||||||
permission = "plots.add",
|
permission = "plots.add",
|
||||||
requiredType = RequiredType.PLAYER)
|
requiredType = RequiredType.PLAYER)
|
||||||
|
@ -72,6 +72,7 @@ import com.sk89q.worldedit.math.BlockVector2;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import net.kyori.adventure.text.TranslatableComponent;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -346,9 +347,10 @@ public class Area extends SubCommand {
|
|||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(
|
||||||
"An error occurred while creating the world: " + area
|
TranslatableCaption.of("errors.error_create"),
|
||||||
.getWorldName());
|
Template.of("world", area.getWorldName())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (hasConfirmation(player)) {
|
if (hasConfirmation(player)) {
|
||||||
@ -386,8 +388,11 @@ public class Area extends SubCommand {
|
|||||||
for (int i = 2; i < args.length; i++) {
|
for (int i = 2; i < args.length; i++) {
|
||||||
String[] pair = args[i].split("=");
|
String[] pair = args[i].split("=");
|
||||||
if (pair.length != 2) {
|
if (pair.length != 2) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getCommandString()
|
player.sendMessage(
|
||||||
+ " create [world[:id]] [<modifier>=<value>]...");
|
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
||||||
|
Template.of("value1,", getCommandString()),
|
||||||
|
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (pair[0].toLowerCase()) {
|
switch (pair[0].toLowerCase()) {
|
||||||
@ -441,8 +446,11 @@ public class Area extends SubCommand {
|
|||||||
builder.plotAreaType(pa.getType());
|
builder.plotAreaType(pa.getType());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Captions.COMMAND_SYNTAX.send(player, getCommandString()
|
player.sendMessage(
|
||||||
+ " create [world[:id]] [<modifier>=<value>]...");
|
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
||||||
|
Template.of("value1", getCommandString()),
|
||||||
|
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -468,9 +476,10 @@ public class Area extends SubCommand {
|
|||||||
player.teleport(this.worldUtil.getSpawn(world),
|
player.teleport(this.worldUtil.getSpawn(world),
|
||||||
TeleportCause.COMMAND);
|
TeleportCause.COMMAND);
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(
|
||||||
"An error occurred while creating the world: " + pa
|
TranslatableCaption.of("errors.error_create"),
|
||||||
.getWorldName());
|
Template.of("world", pa.getWorldName())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.worldConfiguration.save(this.worldFile);
|
this.worldConfiguration.save(this.worldFile);
|
||||||
@ -487,8 +496,15 @@ public class Area extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (pa.getId() == null) {
|
if (pa.getId() == null) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, getCommandString()
|
player.sendMessage(
|
||||||
+ " create [world[:id]] [<modifier>=<value>]...");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", getCommandString + )
|
||||||
|
);
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
||||||
|
Template.of("value1", getCommandString()),
|
||||||
|
Template.of("value2", " create [world[:id]] [<modifier>=<value>]...")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.worldUtil.isWorld(pa.getWorldName())) {
|
if (this.worldUtil.isWorld(pa.getWorldName())) {
|
||||||
@ -504,9 +520,10 @@ public class Area extends SubCommand {
|
|||||||
TeleportCause.COMMAND);
|
TeleportCause.COMMAND);
|
||||||
}
|
}
|
||||||
player.setMeta("area_create_area", pa);
|
player.setMeta("area_create_area", pa);
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(
|
||||||
"$1Go to the first corner and use: $2 " + getCommandString()
|
TranslatableCaption.of("single.get_position"),
|
||||||
+ " create pos1");
|
Template.of("command", getCommandString())
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -526,7 +543,11 @@ public class Area extends SubCommand {
|
|||||||
area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Captions.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
||||||
|
Template.of("value1", getCommandString()),
|
||||||
|
Template.of("value2", " info [area]")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
@ -584,7 +605,11 @@ public class Area extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
Captions.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax_extended"),
|
||||||
|
Template.of("value1", getCommandString()),
|
||||||
|
Template.of("value2", " list [#]")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final List<PlotArea> areas = new ArrayList<>(Arrays.asList(this.plotAreaManager.getAllPlotAreas()));
|
final List<PlotArea> areas = new ArrayList<>(Arrays.asList(this.plotAreaManager.getAllPlotAreas()));
|
||||||
@ -640,12 +665,16 @@ public class Area extends SubCommand {
|
|||||||
}
|
}
|
||||||
final PlotArea area = player.getApplicablePlotArea();
|
final PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.not_in_plot_world")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (area.getType() != PlotAreaType.PARTIAL) {
|
if (area.getType() != PlotAreaType.PARTIAL) {
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(
|
||||||
"$4Stop the server and delete: " + area.getWorldName() + "/region");
|
TranslatableCaption.of("single.delete_world_region"),
|
||||||
|
Template.of("world", area.getWorldName())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.regionManager.largeRegionTask(area.getWorldName(), area.getRegion(),
|
this.regionManager.largeRegionTask(area.getWorldName(), area.getRegion(),
|
||||||
@ -655,7 +684,9 @@ public class Area extends SubCommand {
|
|||||||
.generate(null, area.getWorldName(), value.getX(), value.getZ(),
|
.generate(null, area.getWorldName(), value.getX(), value.getZ(),
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
}, () -> player.sendMessage("Regen complete"));
|
}, () -> player.sendMessage(
|
||||||
|
TranslatableCaption.of("single.regeneration_complete"))
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "goto":
|
case "goto":
|
||||||
@ -669,7 +700,10 @@ public class Area extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
Captions.COMMAND_SYNTAX.send(player, "/plot visit [area]");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot visit [area]")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
||||||
@ -694,12 +728,9 @@ public class Area extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
case "delete":
|
case "delete":
|
||||||
case "remove":
|
case "remove":
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(
|
||||||
"$1World creation settings may be stored in multiple locations:"
|
TranslatableCaption.of("single.worldcreation_location")
|
||||||
+ "\n$3 - $2Bukkit bukkit.yml" + "\n$3 - $2" + PlotSquared.platform()
|
);
|
||||||
.getPluginName() + " settings.yml"
|
|
||||||
+ "\n$3 - $2Multiverse worlds.yml (or any world management plugin)"
|
|
||||||
+ "\n$1Stop the server and delete it from these locations.");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
sendUsage(player);
|
sendUsage(player);
|
||||||
|
@ -29,6 +29,7 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.configuration.caption.Caption;
|
||||||
import com.plotsquared.core.configuration.caption.CaptionUtility;
|
import com.plotsquared.core.configuration.caption.CaptionUtility;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
@ -64,7 +65,7 @@ import java.util.Set;
|
|||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
description = "Claim the nearest plot",
|
description = "Claim the nearest plot",
|
||||||
aliases = "a",
|
aliases = "a",
|
||||||
usage = "/plot auto [length,width]")
|
usage = "/plot auto [length, width]")
|
||||||
public class Auto extends SubCommand {
|
public class Auto extends SubCommand {
|
||||||
|
|
||||||
private final PlotAreaManager plotAreaManager;
|
private final PlotAreaManager plotAreaManager;
|
||||||
@ -213,11 +214,16 @@ public class Auto extends SubCommand {
|
|||||||
size_z = Integer.parseInt(split[1]);
|
size_z = Integer.parseInt(split[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MainUtil.sendMessage(player, "Correct use /plot auto [length,width]");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", getUsage())
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (size_x < 1 || size_z < 1) {
|
if (size_x < 1 || size_z < 1) {
|
||||||
MainUtil.sendMessage(player, "Error: size<=0");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("error.plot_size")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
schematic = args[1];
|
schematic = args[1];
|
||||||
@ -261,16 +267,21 @@ public class Auto extends SubCommand {
|
|||||||
|
|
||||||
if (schematic != null && !schematic.isEmpty()) {
|
if (schematic != null && !schematic.isEmpty()) {
|
||||||
if (!plotarea.hasSchematic(schematic)) {
|
if (!plotarea.hasSchematic(schematic)) {
|
||||||
sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("schematics.schematic_invalid_named"),
|
||||||
|
Template.of("schemname", schematic),
|
||||||
|
Template.of("reason", "non-existant")
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!force && !Permissions.hasPermission(player, CaptionUtility
|
if (!force && !Permissions.hasPermission(player, CaptionUtility
|
||||||
.format(player, Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
.format(player, Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
||||||
&& !Permissions
|
&& !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, CaptionUtility
|
player.sendMessage(
|
||||||
.format(player, Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(),
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
schematic));
|
Template.of("node", Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated())
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -282,11 +293,17 @@ public class Auto extends SubCommand {
|
|||||||
cost = (size_x * size_z) * cost;
|
cost = (size_x * size_z) * cost;
|
||||||
if (cost > 0d) {
|
if (cost > 0d) {
|
||||||
if (!force && this.econHandler.getMoney(player) < cost) {
|
if (!force && this.econHandler.getMoney(player) < cost) {
|
||||||
sendMessage(player, Captions.CANNOT_AFFORD_PLOT, "" + cost);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("economy.cannot_afford_plot"),
|
||||||
|
Template.of("money", String.valueOf(cost))
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
this.econHandler.withdrawMoney(player, cost);
|
this.econHandler.withdrawMoney(player, cost);
|
||||||
sendMessage(player, Captions.REMOVED_BALANCE, cost + "");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("economy.removed_balance"),
|
||||||
|
Template.of("money", String.valueOf(cost))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO handle type 2 (partial) the same as normal worlds!
|
// TODO handle type 2 (partial) the same as normal worlds!
|
||||||
|
@ -37,6 +37,7 @@ import com.plotsquared.core.plot.Plot;
|
|||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -131,26 +132,35 @@ public final class Backup extends Command {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_UNOWNED.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_unowned")
|
||||||
|
);
|
||||||
} else if (plot.isMerged()) {
|
} else if (plot.isMerged()) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_MERGED.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_merged")
|
||||||
|
);
|
||||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||||
sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_ADMIN_BACKUP_OTHER.getTranslated())
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
||||||
if (backupProfile instanceof NullBackupProfile) {
|
if (backupProfile instanceof NullBackupProfile) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_OTHER.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_other")
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
backupProfile.createBackup().whenComplete((backup, throwable) -> {
|
backupProfile.createBackup().whenComplete((backup, throwable) -> {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
sendMessage(player, Captions.BACKUP_SAVE_FAILED, throwable.getMessage());
|
sendMessage(player, Captions.BACKUP_SAVE_FAILED, throwable.getMessage());
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
} else {
|
} else {
|
||||||
sendMessage(player, Captions.BACKUP_SAVE_SUCCESS);
|
player.sendMessage(TranslatableCaption.of("backups.backup_save_success"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -170,34 +180,50 @@ public final class Backup extends Command {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_UNOWNED.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_unowned")
|
||||||
|
);
|
||||||
} else if (plot.isMerged()) {
|
} else if (plot.isMerged()) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_MERGED.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_merged")
|
||||||
|
);
|
||||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||||
sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_ADMIN_BACKUP_OTHER.getTranslated())
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
||||||
if (backupProfile instanceof NullBackupProfile) {
|
if (backupProfile instanceof NullBackupProfile) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_OTHER.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_other")
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
backupProfile.listBackups().whenComplete((backups, throwable) -> {
|
backupProfile.listBackups().whenComplete((backups, throwable) -> {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
sendMessage(player, Captions.BACKUP_LIST_FAILED, throwable.getMessage());
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("backups.backup_list_failed"),
|
||||||
|
Template.of("reason", throwable.getMessage())
|
||||||
|
);
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
} else {
|
} else {
|
||||||
sendMessage(player, Captions.BACKUP_LIST_HEADER,
|
player.sendMessage(
|
||||||
plot.getId().toCommaSeparatedString());
|
TranslatableCaption.of("backups.backup_list_header"),
|
||||||
|
Template.of("plot", plot.getId().toCommaSeparatedString())
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < backups.size(); i++) {
|
for (int i = 0; i < backups.size(); i++) {
|
||||||
sendMessage(player, Captions.BACKUP_LIST_ENTRY,
|
player.sendMessage(
|
||||||
Integer.toString(i + 1), DateTimeFormatter.RFC_1123_DATE_TIME
|
TranslatableCaption.of("backups.backup_list_entry"),
|
||||||
.format(ZonedDateTime.ofInstant(
|
Template.of("number", Integer.toString(i + 1)),
|
||||||
|
Template.of("value", DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant(
|
||||||
Instant.ofEpochMilli(backups.get(i).getCreationTime()),
|
Instant.ofEpochMilli(backups.get(i).getCreationTime()),
|
||||||
ZoneId.systemDefault())));
|
ZoneId.systemDefault())))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -221,54 +247,81 @@ public final class Backup extends Command {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_UNOWNED.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_unowned")
|
||||||
|
);
|
||||||
} else if (plot.isMerged()) {
|
} else if (plot.isMerged()) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_MERGED.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE, "merged");
|
Template.of("plot", "generic.generic_merged")
|
||||||
|
);
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_merged")
|
||||||
|
);
|
||||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||||
sendMessage(player, Captions.NO_PERMISSION, Captions.PERMISSION_ADMIN_BACKUP_OTHER);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_ADMIN_BACKUP_OTHER.getTranslated())
|
||||||
|
);
|
||||||
} else if (args.length == 0) {
|
} else if (args.length == 0) {
|
||||||
sendMessage(player, Captions.BACKUP_LOAD_USAGE);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "Usage: /plot backup save/list/load")
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
final int number;
|
final int number;
|
||||||
try {
|
try {
|
||||||
number = Integer.parseInt(args[0]);
|
number = Integer.parseInt(args[0]);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
sendMessage(player, Captions.NOT_A_NUMBER, args[0]);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("invalid.not_a_number"),
|
||||||
|
Template.of("value", args[0])
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
final BackupProfile backupProfile = Objects.requireNonNull(this.backupManager.getProfile(plot));
|
||||||
if (backupProfile instanceof NullBackupProfile) {
|
if (backupProfile instanceof NullBackupProfile) {
|
||||||
sendMessage(player, Captions.BACKUP_IMPOSSIBLE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_OTHER.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_other")
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
backupProfile.listBackups().whenComplete((backups, throwable) -> {
|
backupProfile.listBackups().whenComplete((backups, throwable) -> {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
sendMessage(player, Captions.BACKUP_LOAD_FAILURE, throwable.getMessage());
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("backups.backup_load_failure"),
|
||||||
|
Template.of("reason", throwable.getMessage())
|
||||||
|
);
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
} else {
|
} else {
|
||||||
if (number < 1 || number > backups.size()) {
|
if (number < 1 || number > backups.size()) {
|
||||||
sendMessage(player, Captions.BACKUP_LOAD_FAILURE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_INVALID_CHOICE.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_invalid_choice")
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
final com.plotsquared.core.backup.Backup backup =
|
final com.plotsquared.core.backup.Backup backup =
|
||||||
backups.get(number - 1);
|
backups.get(number - 1);
|
||||||
if (backup == null || backup.getFile() == null || !Files
|
if (backup == null || backup.getFile() == null || !Files
|
||||||
.exists(backup.getFile())) {
|
.exists(backup.getFile())) {
|
||||||
sendMessage(player, Captions.BACKUP_LOAD_FAILURE,
|
player.sendMessage(
|
||||||
Captions.GENERIC_INVALID_CHOICE.getTranslated());
|
TranslatableCaption.of("backup_impossible"),
|
||||||
|
Template.of("plot", "generic.generic_invalid_choice")
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
CmdConfirm.addPending(player, "/plot backup load " + number,
|
CmdConfirm.addPending(player, "/plot backup load " + number,
|
||||||
() -> backupProfile.restoreBackup(backup)
|
() -> backupProfile.restoreBackup(backup)
|
||||||
.whenComplete((n, error) -> {
|
.whenComplete((n, error) -> {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
sendMessage(player, Captions.BACKUP_LOAD_FAILURE,
|
player.sendMessage(
|
||||||
error.getMessage());
|
TranslatableCaption.of("backups.backup_load_failure"),
|
||||||
|
Template.of("reason", error.getMessage())
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
sendMessage(player, Captions.BACKUP_LOAD_SUCCESS);
|
player.sendMessage(TranslatableCaption.of("backup_load_success"));
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -96,27 +96,33 @@ public class Claim extends SubCommand {
|
|||||||
grants = Ints.fromByteArray(player.getPersistentMeta("grantedPlots"));
|
grants = Ints.fromByteArray(player.getPersistentMeta("grantedPlots"));
|
||||||
if (grants <= 0) {
|
if (grants <= 0) {
|
||||||
player.removePersistentMeta("grantedPlots");
|
player.removePersistentMeta("grantedPlots");
|
||||||
return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
|
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
|
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_plots"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!plot.canClaim(player)) {
|
if (!plot.canClaim(player)) {
|
||||||
return sendMessage(player, Captions.PLOT_IS_CLAIMED);
|
player.sendMessage(TranslatableCaption.of("working.plot_is_claimed"));
|
||||||
}
|
}
|
||||||
final PlotArea area = plot.getArea();
|
final PlotArea area = plot.getArea();
|
||||||
if (schematic != null && !schematic.isEmpty()) {
|
if (schematic != null && !schematic.isEmpty()) {
|
||||||
if (area.isSchematicClaimSpecify()) {
|
if (area.isSchematicClaimSpecify()) {
|
||||||
if (!area.hasSchematic(schematic)) {
|
if (!area.hasSchematic(schematic)) {
|
||||||
return sendMessage(player, Captions.SCHEMATIC_INVALID,
|
player.sendMessage(
|
||||||
"non-existent: " + schematic);
|
TranslatableCaption.of("schematics.schematic_invalid_named"),
|
||||||
|
Template.of("schemname", schematic),
|
||||||
|
Template.of("reason", "non-existant")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(player, CaptionUtility
|
if (!Permissions.hasPermission(player, CaptionUtility
|
||||||
.format(player, Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
.format(player, Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
||||||
&& !Permissions
|
&& !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC) && !force) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC) && !force) {
|
||||||
return sendMessage(player, Captions.NO_SCHEMATIC_PERMISSION, schematic);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_schematic_permission"),
|
||||||
|
Template.of("value", schematic)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,10 +131,16 @@ public class Claim extends SubCommand {
|
|||||||
double cost = costExr.evaluate((double) currentPlots);
|
double cost = costExr.evaluate((double) currentPlots);
|
||||||
if (cost > 0d) {
|
if (cost > 0d) {
|
||||||
if (this.econHandler.getMoney(player) < cost) {
|
if (this.econHandler.getMoney(player) < cost) {
|
||||||
return sendMessage(player, Captions.CANNOT_AFFORD_PLOT, "" + cost);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("economy.cannot_afford_plot"),
|
||||||
|
Template.of("money", String.valueOf(cost))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
this.econHandler.withdrawMoney(player, cost);
|
this.econHandler.withdrawMoney(player, cost);
|
||||||
sendMessage(player, Captions.REMOVED_BALANCE, cost + "");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("economy.removed_balance"),
|
||||||
|
Template.of("money", String.valueOf(cost))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (grants > 0) {
|
if (grants > 0) {
|
||||||
@ -137,7 +149,11 @@ public class Claim extends SubCommand {
|
|||||||
} else {
|
} else {
|
||||||
player.setPersistentMeta("grantedPlots", Ints.toByteArray(grants - 1));
|
player.setPersistentMeta("grantedPlots", Ints.toByteArray(grants - 1));
|
||||||
}
|
}
|
||||||
sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "1", (grants - 1));
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("economy.removed_granted_plot"),
|
||||||
|
Template.of("usedGrants", String.valueOf((grants -1))),
|
||||||
|
Template.of("remainingGrants", String.valueOf(grants))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
int border = area.getBorder();
|
int border = area.getBorder();
|
||||||
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
|
if (border != Integer.MAX_VALUE && plot.getDistanceFromOrigin() > border && !force) {
|
||||||
@ -151,7 +167,7 @@ public class Claim extends SubCommand {
|
|||||||
if (!plot.claim(player, true, finalSchematic, false)) {
|
if (!plot.claim(player, true, finalSchematic, false)) {
|
||||||
logger.info(Captions.PREFIX.getTranslated() + String
|
logger.info(Captions.PREFIX.getTranslated() + String
|
||||||
.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
|
.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
|
||||||
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||||
plot.setOwnerAbs(null);
|
plot.setOwnerAbs(null);
|
||||||
} else if (area.isAutoMerge()) {
|
} else if (area.isAutoMerge()) {
|
||||||
PlotMergeEvent mergeEvent = Claim.this.eventDispatcher
|
PlotMergeEvent mergeEvent = Claim.this.eventDispatcher
|
||||||
@ -173,7 +189,7 @@ public class Claim extends SubCommand {
|
|||||||
logger.info(Captions.PREFIX.getTranslated() + String
|
logger.info(Captions.PREFIX.getTranslated() + String
|
||||||
.format("Failed to add plot %s to the database",
|
.format("Failed to add plot %s to the database",
|
||||||
plot.getId().toCommaSeparatedString()));
|
plot.getId().toCommaSeparatedString()));
|
||||||
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||||
plot.setOwnerAbs(null);
|
plot.setOwnerAbs(null);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.command;
|
|||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
import com.plotsquared.core.database.DBFunc;
|
||||||
import com.plotsquared.core.events.TeleportCause;
|
import com.plotsquared.core.events.TeleportCause;
|
||||||
import com.plotsquared.core.location.BlockLoc;
|
import com.plotsquared.core.location.BlockLoc;
|
||||||
@ -39,6 +40,8 @@ import com.plotsquared.core.plot.PlotCluster;
|
|||||||
import com.plotsquared.core.plot.PlotId;
|
import com.plotsquared.core.plot.PlotId;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
|
import net.kyori.adventure.text.TranslatableComponent;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -58,7 +61,7 @@ public class Cluster extends SubCommand {
|
|||||||
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
// return arguments
|
// return arguments
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_AVAILABLE_ARGS);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_available_args"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String sub = args[0].toLowerCase();
|
String sub = args[0].toLowerCase();
|
||||||
@ -66,33 +69,52 @@ public class Cluster extends SubCommand {
|
|||||||
case "l":
|
case "l":
|
||||||
case "list": {
|
case "list": {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LIST)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LIST)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_LIST);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_LIST.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster list");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster list")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<PlotCluster> clusters = area.getClusters();
|
Set<PlotCluster> clusters = area.getClusters();
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_LIST_HEADING, clusters.size() + "");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("cluster.cluster_list_heading"),
|
||||||
|
Template.of("amount", clusters.size() + "")
|
||||||
|
);
|
||||||
for (PlotCluster cluster : clusters) {
|
for (PlotCluster cluster : clusters) {
|
||||||
// Ignore unmanaged clusters
|
// Ignore unmanaged clusters
|
||||||
String name = "'" + cluster.getName() + "' : " + cluster.toString();
|
String name = "'" + cluster.getName() + "' : " + cluster.toString();
|
||||||
if (player.getUUID().equals(cluster.owner)) {
|
if (player.getUUID().equals(cluster.owner)) {
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, "&a" + name);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("cluster.cluster_list_element_owner"),
|
||||||
|
Template.of("cluster", name)
|
||||||
|
);
|
||||||
} else if (cluster.helpers.contains(player.getUUID())) {
|
} else if (cluster.helpers.contains(player.getUUID())) {
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, "&3" + name);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("cluster.cluster_list_element_helpers"),
|
||||||
|
Template.of("cluster", name)
|
||||||
|
);
|
||||||
} else if (cluster.invited.contains(player.getUUID())) {
|
} else if (cluster.invited.contains(player.getUUID())) {
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, "&9" + name);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("cluster.cluster_list_element_invited"),
|
||||||
|
Template.of("cluster", name)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MainUtil
|
player.sendMessage(
|
||||||
.sendMessage(player, Captions.CLUSTER_LIST_ELEMENT, cluster.toString());
|
TranslatableCaption.of("cluster.cluster_list_element"),
|
||||||
|
Template.of("cluster", cluster.toString())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -100,25 +122,29 @@ public class Cluster extends SubCommand {
|
|||||||
case "c":
|
case "c":
|
||||||
case "create": {
|
case "create": {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_CREATE)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_CREATE);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_CREATE.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 4) {
|
if (args.length != 4) {
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
player.sendMessage(
|
||||||
"/plot cluster create <name> <id-bot> <id-top>");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster create <name> <id-bot> <id-top>")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int currentClusters = Settings.Limit.GLOBAL ?
|
int currentClusters = Settings.Limit.GLOBAL ?
|
||||||
player.getClusterCount() :
|
player.getClusterCount() :
|
||||||
player.getPlotCount(player.getLocation().getWorldName());
|
player.getPlotCount(player.getLocation().getWorldName());
|
||||||
if (currentClusters >= player.getAllowedPlots()) {
|
if (currentClusters >= player.getAllowedPlots()) {
|
||||||
return sendMessage(player, Captions.CANT_CLAIM_MORE_CLUSTERS);
|
player.sendMessage(TranslatableCaption.of("permission.cant_claim_more_clusters"));
|
||||||
}
|
}
|
||||||
PlotId pos1;
|
PlotId pos1;
|
||||||
PlotId pos2;
|
PlotId pos2;
|
||||||
@ -127,13 +153,13 @@ public class Cluster extends SubCommand {
|
|||||||
pos1 = PlotId.fromString(args[2]);
|
pos1 = PlotId.fromString(args[2]);
|
||||||
pos2 = PlotId.fromString(args[3]);
|
pos2 = PlotId.fromString(args[3]);
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check if name is taken
|
// check if name is taken
|
||||||
String name = args[1];
|
String name = args[1];
|
||||||
if (area.getCluster(name) != null) {
|
if (area.getCluster(name) != null) {
|
||||||
MainUtil.sendMessage(player, Captions.ALIAS_IS_TAKEN);
|
player.sendMessage(TranslatableCaption.of("alias.alias_is_taken"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (pos2.getX() < pos1.getX() || pos2.getY() < pos1.getY()) {
|
if (pos2.getX() < pos1.getX() || pos2.getY() < pos1.getY()) {
|
||||||
@ -144,12 +170,18 @@ public class Cluster extends SubCommand {
|
|||||||
//check if overlap
|
//check if overlap
|
||||||
PlotCluster cluster = area.getFirstIntersectingCluster(pos1, pos2);
|
PlotCluster cluster = area.getFirstIntersectingCluster(pos1, pos2);
|
||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_INTERSECTION, cluster.getName());
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("cluster.cluster_intersection"),
|
||||||
|
Template.of("cluster", cluster.getName())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Check if it occupies existing plots
|
// Check if it occupies existing plots
|
||||||
if (!area.contains(pos1) || !area.contains(pos2)) {
|
if (!area.contains(pos1) || !area.contains(pos2)) {
|
||||||
Captions.CLUSTER_OUTSIDE.send(player, area);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("cluster.cluster_outside"),
|
||||||
|
Template.of("area", area)
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2);
|
Set<Plot> plots = area.getPlotSelectionOwned(pos1, pos2);
|
||||||
@ -159,8 +191,10 @@ public class Cluster extends SubCommand {
|
|||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
for (Plot plot : plots) {
|
for (Plot plot : plots) {
|
||||||
if (!plot.isOwner(uuid)) {
|
if (!plot.isOwner(uuid)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_CREATE_OTHER);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_CREATE_OTHER.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,8 +212,10 @@ public class Cluster extends SubCommand {
|
|||||||
.hasPermissionRange(player, Captions.PERMISSION_CLUSTER_SIZE,
|
.hasPermissionRange(player, Captions.PERMISSION_CLUSTER_SIZE,
|
||||||
Settings.Limit.MAX_PLOTS);
|
Settings.Limit.MAX_PLOTS);
|
||||||
if (current + cluster.getArea() > allowed) {
|
if (current + cluster.getArea() > allowed) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()));
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_SIZE.getTranslated() + "." + (current + cluster.getArea()))
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// create cluster
|
// create cluster
|
||||||
@ -195,63 +231,74 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_ADDED);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_added"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "disband":
|
case "disband":
|
||||||
case "del":
|
case "del":
|
||||||
case "delete": {
|
case "delete": {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_DELETE);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_DELETE.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1 && args.length != 2) {
|
if (args.length != 1 && args.length != 2) {
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
player.sendMessage(
|
||||||
"/plot cluster delete [name]");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster delete [name]")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotCluster cluster;
|
PlotCluster cluster;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
cluster = area.getCluster(args[1]);
|
cluster = area.getCluster(args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
||||||
|
Template.of("cluster", args[1])
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster = area.getCluster(player.getLocation());
|
cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
player.sendMessage(TranslatableCaption.of("cluster.not_in_cluster"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cluster.owner.equals(player.getUUID())) {
|
if (!cluster.owner.equals(player.getUUID())) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_DELETE_OTHER)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_DELETE_OTHER);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_DELETE_OTHER.getTranslated()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBFunc.delete(cluster);
|
DBFunc.delete(cluster);
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_DELETED);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_deleted"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "res":
|
case "res":
|
||||||
case "resize": {
|
case "resize": {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_RESIZE);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE.getTranslated()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
player.sendMessage(
|
||||||
"/plot cluster resize <pos1> <pos2>");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster delete [name]")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotId pos1;
|
PlotId pos1;
|
||||||
@ -261,7 +308,7 @@ public class Cluster extends SubCommand {
|
|||||||
pos1 = PlotId.fromString(args[2]);
|
pos1 = PlotId.fromString(args[2]);
|
||||||
pos2 = PlotId.fromString(args[3]);
|
pos2 = PlotId.fromString(args[3]);
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (pos2.getX() < pos1.getX() || pos2.getY() < pos1.getY()) {
|
if (pos2.getX() < pos1.getX() || pos2.getY() < pos1.getY()) {
|
||||||
@ -271,27 +318,30 @@ public class Cluster extends SubCommand {
|
|||||||
// check if in cluster
|
// check if in cluster
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_pcluster"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_OTHER)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_RESIZE_OTHER);
|
TranslatableCaption.of("permission.no_permission")
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE_OTHER.getTranslated()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//check if overlap
|
//check if overlap
|
||||||
PlotCluster intersect = area.getFirstIntersectingCluster(pos1, pos2);
|
PlotCluster intersect = area.getFirstIntersectingCluster(pos1, pos2);
|
||||||
if (intersect != null) {
|
if (intersect != null) {
|
||||||
MainUtil
|
player.sendMessage(
|
||||||
.sendMessage(player, Captions.CLUSTER_INTERSECTION, intersect.getName());
|
TranslatableCaption.of("cluster.cluster_intersection"),
|
||||||
|
Template.of("cluster", intersect.getName())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<Plot> existing = area.getPlotSelectionOwned(cluster.getP1(), cluster.getP2());
|
Set<Plot> existing = area.getPlotSelectionOwned(cluster.getP1(), cluster.getP2());
|
||||||
@ -304,8 +354,10 @@ public class Cluster extends SubCommand {
|
|||||||
if (!removed.isEmpty()) {
|
if (!removed.isEmpty()) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_SHRINK)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_RESIZE_SHRINK);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE_SHRINK.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,8 +365,10 @@ public class Cluster extends SubCommand {
|
|||||||
if (!newPlots.isEmpty()) {
|
if (!newPlots.isEmpty()) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_RESIZE_EXPAND)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_RESIZE_EXPAND);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_RESIZE_EXPAND.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -329,44 +383,52 @@ public class Cluster extends SubCommand {
|
|||||||
int allowed = Permissions.hasPermissionRange(player, Captions.PERMISSION_CLUSTER,
|
int allowed = Permissions.hasPermissionRange(player, Captions.PERMISSION_CLUSTER,
|
||||||
Settings.Limit.MAX_PLOTS);
|
Settings.Limit.MAX_PLOTS);
|
||||||
if (current + cluster.getArea() > allowed) {
|
if (current + cluster.getArea() > allowed) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER.getTranslated() + "." + (current + cluster
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
.getArea()));
|
Template.of("node", Captions.PERMISSION_CLUSTER.getTranslated() + "." + (current + cluster
|
||||||
|
.getArea()))
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// resize cluster
|
// resize cluster
|
||||||
DBFunc.resizeCluster(cluster, pos1, pos2);
|
DBFunc.resizeCluster(cluster, pos1, pos2);
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_RESIZED);
|
player.sendMessage(TranslatableCaption.of("cluster.clister_resized"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "add":
|
case "add":
|
||||||
case "inv":
|
case "inv":
|
||||||
case "invite": {
|
case "invite": {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_INVITE);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_INVITE.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
player.sendMessage(
|
||||||
"/plot cluster invite <player>");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster invite <player>")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check if in cluster
|
// check if in cluster
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_INVITE_OTHER)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_INVITE_OTHER);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_INVITE_OTHER.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,23 +436,27 @@ public class Cluster extends SubCommand {
|
|||||||
PlotSquared.get().getImpromptuUUIDPipeline()
|
PlotSquared.get().getImpromptuUUIDPipeline()
|
||||||
.getSingle(args[1], (uuid, throwable) -> {
|
.getSingle(args[1], (uuid, throwable) -> {
|
||||||
if (throwable instanceof TimeoutException) {
|
if (throwable instanceof TimeoutException) {
|
||||||
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
|
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||||
} else if (throwable != null) {
|
} else if (throwable != null) {
|
||||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[1]);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.invalid_player"),
|
||||||
|
Template.of("value", args[1])
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
if (!cluster.isAdded(uuid)) {
|
if (!cluster.isAdded(uuid)) {
|
||||||
// add the user if not added
|
// add the user if not added
|
||||||
cluster.invited.add(uuid);
|
cluster.invited.add(uuid);
|
||||||
DBFunc.setInvited(cluster, uuid);
|
DBFunc.setInvited(cluster, uuid);
|
||||||
|
|
||||||
final PlotPlayer otherPlayer =
|
final PlotPlayer otherPlayer =
|
||||||
PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
|
PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
|
||||||
if (otherPlayer != null) {
|
if (otherPlayer != null) {
|
||||||
MainUtil.sendMessage(otherPlayer, Captions.CLUSTER_INVITED,
|
player.sendMessage(
|
||||||
cluster.getName());
|
TranslatableCaption.of("cluster.cluster_invited"),
|
||||||
|
Template.of("cluster", cluster.getName())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_ADDED_USER);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_added_user"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
@ -399,29 +465,35 @@ public class Cluster extends SubCommand {
|
|||||||
case "remove":
|
case "remove":
|
||||||
case "kick": {
|
case "kick": {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_KICK)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_KICK)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_KICK);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_KICK.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
player.sendMessage(
|
||||||
"/plot cluster kick <player>");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster kick <player>")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_CLUSTER_KICK_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_KICK_OTHER)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_KICK_OTHER);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_KICK_OTHER.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -429,15 +501,20 @@ public class Cluster extends SubCommand {
|
|||||||
PlotSquared.get().getImpromptuUUIDPipeline()
|
PlotSquared.get().getImpromptuUUIDPipeline()
|
||||||
.getSingle(args[1], (uuid, throwable) -> {
|
.getSingle(args[1], (uuid, throwable) -> {
|
||||||
if (throwable instanceof TimeoutException) {
|
if (throwable instanceof TimeoutException) {
|
||||||
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
|
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||||
} else if (throwable != null) {
|
} else if (throwable != null) {
|
||||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[1]);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.invalid_player"),
|
||||||
|
Template.of("value", args[1])
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// Can't kick if the player is yourself, the owner, or not added to the cluster
|
// Can't kick if the player is yourself, the owner, or not added to the cluster
|
||||||
if (uuid.equals(player.getUUID()) || uuid.equals(cluster.owner)
|
if (uuid.equals(player.getUUID()) || uuid.equals(cluster.owner)
|
||||||
|| !cluster.isAdded(uuid)) {
|
|| !cluster.isAdded(uuid)) {
|
||||||
MainUtil.sendMessage(player, Captions.CANNOT_KICK_PLAYER,
|
player.sendMessage(
|
||||||
cluster.getName());
|
TranslatableCaption.of("cluster.cannot_kick_player"),
|
||||||
|
Template.of("value", cluster.getName())
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
if (cluster.helpers.contains(uuid)) {
|
if (cluster.helpers.contains(uuid)) {
|
||||||
cluster.helpers.remove(uuid);
|
cluster.helpers.remove(uuid);
|
||||||
@ -449,8 +526,10 @@ public class Cluster extends SubCommand {
|
|||||||
final PlotPlayer player2 =
|
final PlotPlayer player2 =
|
||||||
PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
|
PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid);
|
||||||
if (player2 != null) {
|
if (player2 != null) {
|
||||||
MainUtil.sendMessage(player2, Captions.CLUSTER_REMOVED,
|
player.sendMessage(
|
||||||
cluster.getName());
|
TranslatableCaption.of("cluster.cluster_removed"),
|
||||||
|
Template.of("cluster", cluster.getName())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
for (final Plot plot : PlotQuery.newQuery().inWorld(player2.getLocation()
|
for (final Plot plot : PlotQuery.newQuery().inWorld(player2.getLocation()
|
||||||
.getWorldName()).ownedBy(uuid)) {
|
.getWorldName()).ownedBy(uuid)) {
|
||||||
@ -459,7 +538,7 @@ public class Cluster extends SubCommand {
|
|||||||
plot.unclaim();
|
plot.unclaim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player2, Captions.CLUSTER_KICKED_USER);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_kicked_user"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -468,40 +547,47 @@ public class Cluster extends SubCommand {
|
|||||||
case "quit":
|
case "quit":
|
||||||
case "leave": {
|
case "leave": {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LEAVE)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_LEAVE)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_LEAVE);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_LEAVE.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1 && args.length != 2) {
|
if (args.length != 1 && args.length != 2) {
|
||||||
MainUtil
|
player.sendMessage(
|
||||||
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster leave [name]");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster leave [name]")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
}
|
}
|
||||||
PlotCluster cluster;
|
PlotCluster cluster;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
cluster = area.getCluster(args[1]);
|
cluster = area.getCluster(args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
||||||
|
Template.of("cluster", args[1])
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cluster = area.getCluster(player.getLocation());
|
cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
if (!cluster.isAdded(uuid)) {
|
if (!cluster.isAdded(uuid)) {
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_NOT_ADDED);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_not_added"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (uuid.equals(cluster.owner)) {
|
if (uuid.equals(cluster.owner)) {
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_CANNOT_LEAVE);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_cannot_leave"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (cluster.helpers.contains(uuid)) {
|
if (cluster.helpers.contains(uuid)) {
|
||||||
@ -510,7 +596,10 @@ public class Cluster extends SubCommand {
|
|||||||
}
|
}
|
||||||
cluster.invited.remove(uuid);
|
cluster.invited.remove(uuid);
|
||||||
DBFunc.removeInvited(cluster, uuid);
|
DBFunc.removeInvited(cluster, uuid);
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_REMOVED, cluster.getName());
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("cluster.cluster_removed"),
|
||||||
|
Template.of("cluster", cluster.getName())
|
||||||
|
);
|
||||||
for (final Plot plot : PlotQuery.newQuery().inWorld(player.getLocation().getWorldName())
|
for (final Plot plot : PlotQuery.newQuery().inWorld(player.getLocation().getWorldName())
|
||||||
.ownedBy(uuid)) {
|
.ownedBy(uuid)) {
|
||||||
PlotCluster current = plot.getCluster();
|
PlotCluster current = plot.getCluster();
|
||||||
@ -525,43 +614,52 @@ public class Cluster extends SubCommand {
|
|||||||
case "helper":
|
case "helper":
|
||||||
case "helpers": {
|
case "helpers": {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_HELPERS)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_HELPERS)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_HELPERS);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_HELPERS.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
player.sendMessage(
|
||||||
"/plot cluster helpers <add|remove> <player>");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster helpers <add | remove> <player>")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotSquared.get().getImpromptuUUIDPipeline()
|
PlotSquared.get().getImpromptuUUIDPipeline()
|
||||||
.getSingle(args[2], (uuid, throwable) -> {
|
.getSingle(args[2], (uuid, throwable) -> {
|
||||||
if (throwable instanceof TimeoutException) {
|
if (throwable instanceof TimeoutException) {
|
||||||
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
|
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||||
} else if (throwable != null) {
|
} else if (throwable != null) {
|
||||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[2]);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.invalid_player"),
|
||||||
|
Template.of("value", args[2])
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
if (args[1].equalsIgnoreCase("add")) {
|
if (args[1].equalsIgnoreCase("add")) {
|
||||||
cluster.helpers.add(uuid);
|
cluster.helpers.add(uuid);
|
||||||
DBFunc.setHelper(cluster, uuid);
|
DBFunc.setHelper(cluster, uuid);
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_ADDED_HELPER);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_added_helper"));
|
||||||
} else if (args[1].equalsIgnoreCase("remove")) {
|
} else if (args[1].equalsIgnoreCase("remove")) {
|
||||||
cluster.helpers.remove(uuid);
|
cluster.helpers.remove(uuid);
|
||||||
DBFunc.removeHelper(cluster, uuid);
|
DBFunc.removeHelper(cluster, uuid);
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_REMOVED_HELPER);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_removed_helper"));
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
player.sendMessage(
|
||||||
"/plot cluster helpers <add|remove> <player>");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster helpers <add | remove> <player>")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -571,65 +669,77 @@ public class Cluster extends SubCommand {
|
|||||||
case "home":
|
case "home":
|
||||||
case "tp": {
|
case "tp": {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_TP);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_TP.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
MainUtil
|
player.sendMessage(
|
||||||
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster tp <name>");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster tp <name>")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(args[1]);
|
PlotCluster cluster = area.getCluster(args[1]);
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("cluster.invalid_cluster"),
|
||||||
|
Template.of("cluster", args[1])
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
if (!cluster.isAdded(uuid)) {
|
if (!cluster.isAdded(uuid)) {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP_OTHER)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_TP_OTHER)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_TP_OTHER);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_TP_OTHER.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cluster.getHome(home -> player.teleport(home, TeleportCause.COMMAND));
|
cluster.getHome(home -> player.teleport(home, TeleportCause.COMMAND));
|
||||||
return MainUtil.sendMessage(player, Captions.CLUSTER_TELEPORTING);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_teleporting"));
|
||||||
}
|
}
|
||||||
case "i":
|
case "i":
|
||||||
case "info":
|
case "info":
|
||||||
case "show":
|
case "show":
|
||||||
case "information": {
|
case "information": {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INFO)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_INFO)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_INFO);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_TP.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1 && args.length != 2) {
|
if (args.length != 1 && args.length != 2) {
|
||||||
MainUtil
|
player.sendMessage(
|
||||||
.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster info [name]");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
return false;
|
Template.of("value", "/plot cluster info [name]")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
}
|
}
|
||||||
PlotCluster cluster;
|
PlotCluster cluster;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
cluster = area.getCluster(args[1]);
|
cluster = area.getCluster(args[1]);
|
||||||
if (cluster == null) {
|
player.sendMessage(
|
||||||
MainUtil.sendMessage(player, Captions.INVALID_CLUSTER, args[1]);
|
TranslatableCaption.of("cluster.invalid_cluster"),
|
||||||
return false;
|
Template.of("cluster", args[1])
|
||||||
}
|
);
|
||||||
} else {
|
} else {
|
||||||
cluster = area.getCluster(player.getLocation());
|
cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -638,7 +748,7 @@ public class Cluster extends SubCommand {
|
|||||||
PlotSquared.get().getImpromptuUUIDPipeline()
|
PlotSquared.get().getImpromptuUUIDPipeline()
|
||||||
.getSingle(cluster.owner, (username, throwable) -> {
|
.getSingle(cluster.owner, (username, throwable) -> {
|
||||||
if (throwable instanceof TimeoutException) {
|
if (throwable instanceof TimeoutException) {
|
||||||
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
|
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||||
} else {
|
} else {
|
||||||
final String owner;
|
final String owner;
|
||||||
if (username == null) {
|
if (username == null) {
|
||||||
@ -665,28 +775,35 @@ public class Cluster extends SubCommand {
|
|||||||
case "setspawn":
|
case "setspawn":
|
||||||
case "sethome":
|
case "sethome":
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_SETHOME);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_SETHOME.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1 && args.length != 2) {
|
if (args.length != 1 && args.length != 2) {
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, "/plot cluster sethome");
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot cluster sethome")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = player.getApplicablePlotArea();
|
PlotArea area = player.getApplicablePlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_IN_PLOT_WORLD.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
}
|
}
|
||||||
PlotCluster cluster = area.getCluster(player.getLocation());
|
PlotCluster cluster = area.getCluster(player.getLocation());
|
||||||
if (cluster == null) {
|
if (cluster == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_IN_CLUSTER);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cluster.hasHelperRights(player.getUUID())) {
|
if (!cluster.hasHelperRights(player.getUUID())) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME_OTHER)) {
|
.hasPermission(player, Captions.PERMISSION_CLUSTER_SETHOME_OTHER)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_CLUSTER_SETHOME_OTHER);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_CLUSTER_SETHOME_OTHER.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -696,9 +813,9 @@ public class Cluster extends SubCommand {
|
|||||||
cluster.settings.setPosition(blockloc);
|
cluster.settings.setPosition(blockloc);
|
||||||
DBFunc.setPosition(cluster,
|
DBFunc.setPosition(cluster,
|
||||||
relative.getX() + "," + relative.getY() + "," + relative.getZ());
|
relative.getX() + "," + relative.getY() + "," + relative.getZ());
|
||||||
return MainUtil.sendMessage(player, Captions.POSITION_SET);
|
player.sendMessage(TranslatableCaption.of("position.position_set"));
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, Captions.CLUSTER_AVAILABLE_ARGS);
|
player.sendMessage(TranslatableCaption.of("cluster.cluster_available_args"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
@ -35,6 +36,7 @@ import com.plotsquared.core.util.MathMan;
|
|||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import com.plotsquared.core.util.task.TaskTime;
|
import com.plotsquared.core.util.task.TaskTime;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -67,27 +69,32 @@ public class Condense extends SubCommand {
|
|||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
if (args.length != 2 && args.length != 3) {
|
if (args.length != 2 && args.length != 3) {
|
||||||
sendUsage(player);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot condense <area> <start|stop|info> [radius]")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
|
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
|
||||||
if (area == null || !this.worldUtil.isWorld(area.getWorldName())) {
|
if (area == null || !this.worldUtil.isWorld(area.getWorldName())) {
|
||||||
MainUtil.sendMessage(player, "INVALID AREA");
|
player.sendMessage(TranslatableCaption.of("invalid.invalid_area"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (args[1].toLowerCase()) {
|
switch (args[1].toLowerCase()) {
|
||||||
case "start": {
|
case "start": {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(
|
||||||
"/plot condense " + area.toString() + " start <radius>");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot condense" + area.toString() + " start <radius>")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Condense.TASK) {
|
if (Condense.TASK) {
|
||||||
MainUtil.sendMessage(player, "TASK ALREADY STARTED");
|
player.sendMessage(TranslatableCaption.of("condense.task_already_started"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!MathMan.isInteger(args[2])) {
|
if (!MathMan.isInteger(args[2])) {
|
||||||
MainUtil.sendMessage(player, "INVALID RADIUS");
|
player.sendMessage(TranslatableCaption.of("condense.invalid_radius"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int radius = Integer.parseInt(args[2]);
|
int radius = Integer.parseInt(args[2]);
|
||||||
@ -131,7 +138,7 @@ public class Condense extends SubCommand {
|
|||||||
int size = allPlots.size();
|
int size = allPlots.size();
|
||||||
int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1);
|
int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1);
|
||||||
if (radius < minimumRadius) {
|
if (radius < minimumRadius) {
|
||||||
MainUtil.sendMessage(player, "RADIUS TOO SMALL");
|
player.sendMessage(TranslatableCaption.of("condense.radius_too_small"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<PlotId> toMove = new ArrayList<>(getPlots(allPlots, radius));
|
List<PlotId> toMove = new ArrayList<>(getPlots(allPlots, radius));
|
||||||
@ -145,20 +152,19 @@ public class Condense extends SubCommand {
|
|||||||
start = start.getNextId();
|
start = start.getNextId();
|
||||||
}
|
}
|
||||||
if (free.isEmpty() || toMove.isEmpty()) {
|
if (free.isEmpty() || toMove.isEmpty()) {
|
||||||
MainUtil.sendMessage(player, "NO FREE PLOTS FOUND");
|
player.sendMessage(TranslatableCaption.of("condense.no_free_plots_found"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, "TASK STARTED...");
|
player.sendMessage(TranslatableCaption.of("condense.task_started"));
|
||||||
Condense.TASK = true;
|
Condense.TASK = true;
|
||||||
Runnable run = new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
if (!Condense.TASK) {
|
if (!Condense.TASK) {
|
||||||
MainUtil.sendMessage(player, "TASK CANCELLED.");
|
player.sendMessage(TranslatableCaption.of("condense.task_cancelled"));
|
||||||
}
|
}
|
||||||
if (allPlots.isEmpty()) {
|
if (allPlots.isEmpty()) {
|
||||||
Condense.TASK = false;
|
Condense.TASK = false;
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(TranslatableCaption.of("condense.task_complete"));
|
||||||
"TASK COMPLETE. PLEASE VERIFY THAT NO NEW PLOTS HAVE BEEN CLAIMED DURING TASK.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Runnable task = this;
|
final Runnable task = this;
|
||||||
@ -175,8 +181,11 @@ public class Condense extends SubCommand {
|
|||||||
try {
|
try {
|
||||||
result.set(origin.move(possible, () -> {
|
result.set(origin.move(possible, () -> {
|
||||||
if (result.get()) {
|
if (result.get()) {
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(
|
||||||
"Moving: " + origin + " -> " + possible);
|
TranslatableCaption.of("condense.moving"),
|
||||||
|
Template.of("origin", String.valueOf(origin)),
|
||||||
|
Template.of("possible", String.valueOf(possible))
|
||||||
|
);
|
||||||
TaskManager.runTaskLater(task, TaskTime.ticks(1L));
|
TaskManager.runTaskLater(task, TaskTime.ticks(1L));
|
||||||
}
|
}
|
||||||
}, false).get());
|
}, false).get());
|
||||||
@ -189,11 +198,14 @@ public class Condense extends SubCommand {
|
|||||||
}
|
}
|
||||||
if (free.isEmpty()) {
|
if (free.isEmpty()) {
|
||||||
Condense.TASK = false;
|
Condense.TASK = false;
|
||||||
MainUtil.sendMessage(player, "TASK FAILED. NO FREE PLOTS FOUND!");
|
player.sendMessage(TranslatableCaption.of("condense.task_failed"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (i >= free.size()) {
|
if (i >= free.size()) {
|
||||||
MainUtil.sendMessage(player, "SKIPPING COMPLEX PLOT: " + origin);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("condense.skipping"),
|
||||||
|
Template.of("plot", String.valueOf(origin))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -202,20 +214,22 @@ public class Condense extends SubCommand {
|
|||||||
}
|
}
|
||||||
case "stop":
|
case "stop":
|
||||||
if (!Condense.TASK) {
|
if (!Condense.TASK) {
|
||||||
MainUtil.sendMessage(player, "TASK ALREADY STOPPED");
|
player.sendMessage(TranslatableCaption.of("condense.task_already_stopped"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Condense.TASK = false;
|
Condense.TASK = false;
|
||||||
MainUtil.sendMessage(player, "TASK STOPPED");
|
player.sendMessage(TranslatableCaption.of("condense.task_stopped"));
|
||||||
return true;
|
return true;
|
||||||
case "info":
|
case "info":
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(
|
||||||
"/plot condense " + area.toString() + " info <radius>");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot condense " + area.toString() + " info <radius>")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!MathMan.isInteger(args[2])) {
|
if (!MathMan.isInteger(args[2])) {
|
||||||
MainUtil.sendMessage(player, "INVALID RADIUS");
|
player.sendMessage(TranslatableCaption.of("condense.invalid_radius"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int radius = Integer.parseInt(args[2]);
|
int radius = Integer.parseInt(args[2]);
|
||||||
@ -223,24 +237,37 @@ public class Condense extends SubCommand {
|
|||||||
int size = plots.size();
|
int size = plots.size();
|
||||||
int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1);
|
int minimumRadius = (int) Math.ceil(Math.sqrt(size) / 2 + 1);
|
||||||
if (radius < minimumRadius) {
|
if (radius < minimumRadius) {
|
||||||
MainUtil.sendMessage(player, "RADIUS TOO SMALL");
|
player.sendMessage(TranslatableCaption.of("condense.radius_too_small"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int maxMove = getPlots(plots, minimumRadius).size();
|
int maxMove = getPlots(plots, minimumRadius).size();
|
||||||
int userMove = getPlots(plots, radius).size();
|
int userMove = getPlots(plots, radius).size();
|
||||||
MainUtil.sendMessage(player, "=== DEFAULT EVAL ===");
|
player.sendMessage(TranslatableCaption.of("condense.default_eval"));
|
||||||
MainUtil.sendMessage(player, "MINIMUM RADIUS: " + minimumRadius);
|
player.sendMessage(
|
||||||
MainUtil.sendMessage(player, "MAXIMUM MOVES: " + maxMove);
|
TranslatableCaption.of("condense.minimum_radius"),
|
||||||
MainUtil.sendMessage(player, "=== INPUT EVAL ===");
|
Template.of("minimumRadius", String.valueOf(minimumRadius))
|
||||||
MainUtil.sendMessage(player, "INPUT RADIUS: " + radius);
|
);
|
||||||
MainUtil.sendMessage(player, "ESTIMATED MOVES: " + userMove);
|
player.sendMessage(
|
||||||
MainUtil.sendMessage(player,
|
TranslatableCaption.of("condense.minimum_radius"),
|
||||||
"ESTIMATED TIME: No idea, times will drastically change based on the system performance and load");
|
Template.of("maxMove", String.valueOf(maxMove))
|
||||||
MainUtil.sendMessage(player, "&e - Radius is measured in plot width");
|
);
|
||||||
|
player.sendMessage(TranslatableCaption.of("condense.input_eval"));
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("condense.input_radius"),
|
||||||
|
Template.of("radius", String.valueOf(radius))
|
||||||
|
);
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("condense.estimated_moves"),
|
||||||
|
Template.of("userMove", String.valueOf(userMove))
|
||||||
|
);
|
||||||
|
player.sendMessage(TranslatableCaption.of("condense.eta"));
|
||||||
|
player.sendMessage(TranslatableCaption.of("condense.radius_measured"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(
|
||||||
"/plot condense " + area.getWorldName() + " <start|stop|info> [radius]");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value","/plot condense " + area.getWorldName() + " <start|stop|info> [radius]")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,22 +62,27 @@ public class Continue extends SubCommand {
|
|||||||
}
|
}
|
||||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_CONTINUE)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.NO_PLOT_PERMS.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!DoneFlag.isDone(plot)) {
|
if (!DoneFlag.isDone(plot)) {
|
||||||
MainUtil.sendMessage(player, Captions.DONE_NOT_DONE);
|
player.sendMessage(TranslatableCaption.of("done.done_not_done"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int size = plot.getConnectedPlots().size();
|
int size = plot.getConnectedPlots().size();
|
||||||
if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots()
|
if (Settings.Done.COUNTS_TOWARDS_LIMIT && (player.getAllowedPlots()
|
||||||
< player.getPlotCount() + size)) {
|
< player.getPlotCount() + size)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
player.sendMessage(
|
||||||
Captions.PERMISSION_ADMIN_COMMAND_CONTINUE);
|
TranslatableCaption.of("permission.no_permission"),
|
||||||
|
Template.of("node", Captions.PERMISSION_ADMIN_COMMAND_CONTINUE.getTranslated())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.getRunning() > 0) {
|
if (plot.getRunning() > 0) {
|
||||||
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(DoneFlag.class);
|
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(DoneFlag.class);
|
||||||
@ -90,7 +95,7 @@ public class Continue extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.removeFlag(event.getFlag());
|
plot.removeFlag(event.getFlag());
|
||||||
MainUtil.sendMessage(player, Captions.DONE_REMOVED);
|
player.sendMessage(TranslatableCaption.of("done.done_removed"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import com.plotsquared.core.location.Location;
|
|||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.Permissions;
|
import com.plotsquared.core.util.Permissions;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
@CommandDeclaration(command = "copy",
|
@CommandDeclaration(command = "copy",
|
||||||
permission = "plots.copy",
|
permission = "plots.copy",
|
||||||
@ -50,11 +51,14 @@ public class Copy extends SubCommand {
|
|||||||
}
|
}
|
||||||
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
if (!plot1.isOwner(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
|
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
sendUsage(player);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot copy <X;Z>")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Plot plot2 = Plot.getPlotFromString(player, args[0], true);
|
Plot plot2 = Plot.getPlotFromString(player, args[0], true);
|
||||||
@ -62,18 +66,21 @@ public class Copy extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot1.equals(plot2)) {
|
if (plot1.equals(plot2)) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_ID);
|
player.sendMessage(TranslatableCaption.of("invalid.not_valid_plot_id"));
|
||||||
sendUsage(player);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot copy <X;Z>")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
if (!plot1.getArea().isCompatible(plot2.getArea())) {
|
||||||
Captions.PLOTWORLD_INCOMPATIBLE.send(player);
|
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot1.copy(plot2, () -> MainUtil.sendMessage(player, Captions.COPY_SUCCESS))) {
|
if (plot1.copy(plot2, () -> player.sendMessage(TranslatableCaption.of("move.copy_success")))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, Captions.REQUIRES_UNOWNED);
|
player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,10 +59,10 @@ public class CreateRoadSchematic extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(location.getPlotArea() instanceof HybridPlotWorld)) {
|
if (!(location.getPlotArea() instanceof HybridPlotWorld)) {
|
||||||
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
}
|
}
|
||||||
this.hybridUtils.setupRoadSchematic(plot);
|
this.hybridUtils.setupRoadSchematic(plot);
|
||||||
MainUtil.sendMessage(player, Captions.SCHEMATIC_ROAD_CREATED);
|
player.sendMessage(TranslatableCaption.of("schematics.schematic_road_created"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
import com.plotsquared.core.database.DBFunc;
|
||||||
import com.plotsquared.core.database.Database;
|
import com.plotsquared.core.database.Database;
|
||||||
@ -45,6 +47,8 @@ import com.plotsquared.core.util.EventDispatcher;
|
|||||||
import com.plotsquared.core.util.FileUtils;
|
import com.plotsquared.core.util.FileUtils;
|
||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
import sun.net.TransferProtocolClient;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -84,14 +88,13 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
try {
|
try {
|
||||||
ArrayList<Plot> ps = new ArrayList<>(plots);
|
ArrayList<Plot> ps = new ArrayList<>(plots);
|
||||||
MainUtil.sendMessage(player, "&6Starting...");
|
player.sendMessage(TranslatableCaption.of("database.starting_conversion"));
|
||||||
manager.createPlotsAndData(ps, () -> {
|
manager.createPlotsAndData(ps, () -> {
|
||||||
MainUtil.sendMessage(player, "&6Database conversion finished!");
|
player.sendMessage(TranslatableCaption.of("database.conversion_done"));
|
||||||
manager.close();
|
manager.close();
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MainUtil
|
player.sendMessage(TranslatableCaption.of("database.conversion_failed"));
|
||||||
.sendMessage(player, "Failed to insert plot objects, see stacktrace for info");
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -99,7 +102,10 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
sendUsage(player);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot database [area] <sqlite|mysql|import>")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<Plot> plots;
|
List<Plot> plots;
|
||||||
@ -111,8 +117,11 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
plots = PlotSquared.get().sortPlotsByTemp(PlotQuery.newQuery().allPlots().asList());
|
plots = PlotSquared.get().sortPlotsByTemp(PlotQuery.newQuery().allPlots().asList());
|
||||||
}
|
}
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
sendUsage(player);
|
player.sendMessage(
|
||||||
MainUtil.sendMessage(player, "[arg] indicates an optional argument");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot database [area] <sqlite|mysql|import>")
|
||||||
|
);
|
||||||
|
player.sendMessage(TranslatableCaption.of("database.arg"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -121,17 +130,22 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "import":
|
case "import":
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
MainUtil
|
player.sendMessage(
|
||||||
.sendMessage(player, "/plot database import <sqlite file> [prefix]");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot database import <sqlite file> [prefix]")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
File file = FileUtils.getFile(PlotSquared.platform().getDirectory(),
|
File file = FileUtils.getFile(PlotSquared.platform().getDirectory(),
|
||||||
args[1].endsWith(".db") ? args[1] : args[1] + ".db");
|
args[1].endsWith(".db") ? args[1] : args[1] + ".db");
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
MainUtil.sendMessage(player, "&6Database does not exist: " + file);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("database.does_not_exist"),
|
||||||
|
Template.of("value", String.valueOf(file))
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, "&6Starting...");
|
player.sendMessage(TranslatableCaption.of("database.starting_conversion"));
|
||||||
implementation = new SQLite(file);
|
implementation = new SQLite(file);
|
||||||
SQLManager manager = new SQLManager(implementation, args.length == 3 ? args[2] : "",
|
SQLManager manager = new SQLManager(implementation, args.length == 3 ? args[2] : "",
|
||||||
this.eventDispatcher, this.plotListener, this.worldConfiguration);
|
this.eventDispatcher, this.plotListener, this.worldConfiguration);
|
||||||
@ -164,8 +178,7 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(StaticCaption.of("Skipping duplicate plot: " + plot + " | id=" + plot.temp));
|
||||||
"Skipping duplicate plot: " + plot + " | id=" + plot.temp);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plot.setArea(pa);
|
plot.setArea(pa);
|
||||||
@ -178,12 +191,11 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBFunc.createPlotsAndData(plots,
|
DBFunc.createPlotsAndData(plots,
|
||||||
() -> MainUtil.sendMessage(player, "&6Database conversion finished!"));
|
() -> player.sendMessage(TranslatableCaption.of("database.conversion_done")));
|
||||||
return true;
|
return true;
|
||||||
case "mysql":
|
case "mysql":
|
||||||
if (args.length < 6) {
|
if (args.length < 6) {
|
||||||
return MainUtil.sendMessage(player,
|
player.sendMessage(StaticCaption.of("/plot database mysql [host] [port] [username] [password] [database] {prefix}"));
|
||||||
"/plot database mysql [host] [port] [username] [password] [database] {prefix}");
|
|
||||||
}
|
}
|
||||||
String host = args[1];
|
String host = args[1];
|
||||||
String port = args[2];
|
String port = args[2];
|
||||||
@ -197,36 +209,33 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
case "sqlite":
|
case "sqlite":
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
return MainUtil.sendMessage(player, "/plot database sqlite [file]");
|
player.sendMessage(StaticCaption.of("/plot database sqlite [file]"));
|
||||||
}
|
}
|
||||||
File sqliteFile =
|
File sqliteFile =
|
||||||
FileUtils.getFile(PlotSquared.platform().getDirectory(), args[1] + ".db");
|
FileUtils.getFile(PlotSquared.platform().getDirectory(), args[1] + ".db");
|
||||||
implementation = new SQLite(sqliteFile);
|
implementation = new SQLite(sqliteFile);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return MainUtil.sendMessage(player, "/plot database [sqlite/mysql]");
|
player.sendMessage(StaticCaption.of("/plot database [sqlite/mysql]"));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
SQLManager manager = new SQLManager(implementation, prefix, this.eventDispatcher, this.plotListener, this.worldConfiguration);
|
SQLManager manager = new SQLManager(implementation, prefix, this.eventDispatcher, this.plotListener, this.worldConfiguration);
|
||||||
DatabaseCommand.insertPlots(manager, plots, player);
|
DatabaseCommand.insertPlots(manager, plots, player);
|
||||||
return true;
|
return true;
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
MainUtil.sendMessage(player, "$1Failed to save plots, read stacktrace for info");
|
player.sendMessage(TranslatableCaption.of("database.failed_to_save_plots"));
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(StaticCaption.of(("=== Begin of stacktrace. ===")));
|
||||||
"&d==== Here is an ugly stacktrace, if you are interested in those things ===");
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
MainUtil.sendMessage(player, "&d==== End of stacktrace ====");
|
player.sendMessage(StaticCaption.of(("=== End of stacktrace. ===")));
|
||||||
MainUtil
|
player.sendMessage(TranslatableCaption.of("database.invalid_args"));
|
||||||
.sendMessage(player, "$1Please make sure you are using the correct arguments!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
MainUtil.sendMessage(player, "$1Failed to open connection, read stacktrace for info");
|
player.sendMessage(TranslatableCaption.of("database.failed_to_open"));
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(StaticCaption.of(("=== Begin of stacktrace. ===")));
|
||||||
"&d==== Here is an ugly stacktrace, if you are interested in those things ===");
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
MainUtil.sendMessage(player, "&d==== End of stacktrace ====");
|
player.sendMessage(StaticCaption.of(("=== End of stacktrace. ===")));
|
||||||
MainUtil.sendMessage(player, "$1Please make sure you are using the correct arguments!");
|
player.sendMessage(TranslatableCaption.of("database.invalid_args"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -46,10 +47,10 @@ public class DebugAllowUnsafe extends SubCommand {
|
|||||||
|
|
||||||
if (unsafeAllowed.contains(player.getUUID())) {
|
if (unsafeAllowed.contains(player.getUUID())) {
|
||||||
unsafeAllowed.remove(player.getUUID());
|
unsafeAllowed.remove(player.getUUID());
|
||||||
sendMessage(player, Captions.DEBUGALLOWUNSAFE_OFF);
|
player.sendMessage(TranslatableCaption.of("unsafe.debugallowunsafe_off"));
|
||||||
} else {
|
} else {
|
||||||
unsafeAllowed.add(player.getUUID());
|
unsafeAllowed.add(player.getUUID());
|
||||||
sendMessage(player, Captions.DEBUGALLOWUNSAFE_ON);
|
player.sendMessage(TranslatableCaption.of("unsafe.debugallowunsafe_on"));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,11 @@ package com.plotsquared.core.command;
|
|||||||
|
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.internal.cglib.transform.$ClassTransformer;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
import com.plotsquared.core.database.DBFunc;
|
||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||||
@ -63,6 +65,8 @@ import com.plotsquared.core.util.task.RunnableVal3;
|
|||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
import javafx.collections.transformation.TransformationList;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -92,7 +96,6 @@ public class DebugExec extends SubCommand {
|
|||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger("P2/" + DebugExec.class.getSimpleName());
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + DebugExec.class.getSimpleName());
|
||||||
|
|
||||||
|
|
||||||
private final PlotAreaManager plotAreaManager;
|
private final PlotAreaManager plotAreaManager;
|
||||||
private final EventDispatcher eventDispatcher;
|
private final EventDispatcher eventDispatcher;
|
||||||
private final WorldEdit worldEdit;
|
private final WorldEdit worldEdit;
|
||||||
@ -162,7 +165,6 @@ public class DebugExec extends SubCommand {
|
|||||||
this.scope = context.getBindings(ScriptContext.ENGINE_SCOPE);
|
this.scope = context.getBindings(ScriptContext.ENGINE_SCOPE);
|
||||||
|
|
||||||
// stuff
|
// stuff
|
||||||
this.scope.put("MainUtil", new MainUtil());
|
|
||||||
this.scope.put("Settings", new Settings());
|
this.scope.put("Settings", new Settings());
|
||||||
this.scope.put("StringMan", new StringMan());
|
this.scope.put("StringMan", new StringMan());
|
||||||
this.scope.put("MathMan", new MathMan());
|
this.scope.put("MathMan", new MathMan());
|
||||||
@ -219,42 +221,45 @@ public class DebugExec extends SubCommand {
|
|||||||
}
|
}
|
||||||
PlotAnalysis analysis = plot.getComplexity(null);
|
PlotAnalysis analysis = plot.getComplexity(null);
|
||||||
if (analysis != null) {
|
if (analysis != null) {
|
||||||
MainUtil.sendMessage(player, "Changes/column: " + analysis.changes / 1.0);
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("debugexec.changes_column"),
|
||||||
|
Template.of("value", analysis.changes / 1.0)
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(player, "$1Starting task...");
|
player.sendMessage(TranslatableCaption.of("debugexec.starting_task"));
|
||||||
this.hybridUtils.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
|
this.hybridUtils.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
|
||||||
@Override public void run(PlotAnalysis value) {
|
@Override public void run(PlotAnalysis value) {
|
||||||
MainUtil.sendMessage(player,
|
player.sendMessage(StaticCaption.of("&6Done: &7Use &6/plot debugexec analyze &7for more information."));
|
||||||
"$1Done: $2Use $3/plot debugexec analyze$2 for more information");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "calibrate-analysis":
|
case "calibrate-analysis":
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
player.sendMessage(
|
||||||
"/plot debugexec analyze <threshold>");
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
MainUtil.sendMessage(player,
|
Template.of("value", "/plot debugexec analyze <threshold>")
|
||||||
"$1<threshold> $2= $1The percentage of plots you want to clear (100 clears 100% of plots so no point calibrating "
|
);
|
||||||
+ "it)");
|
player.sendMessage(TranslatableCaption.of("debugexec.threshold_default"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
double threshold;
|
double threshold;
|
||||||
try {
|
try {
|
||||||
threshold = Integer.parseInt(args[1]) / 100d;
|
threshold = Integer.parseInt(args[1]) / 100d;
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
MainUtil.sendMessage(player, "$2Invalid threshold: " + args[1]);
|
player.sendMessage(
|
||||||
MainUtil.sendMessage(player,
|
TranslatableCaption.of("debugexec.invalid_threshold"),
|
||||||
"$1<threshold> $2= $1The percentage of plots you want to clear as a number between 0 - 100");
|
Template.of("value", args[1])
|
||||||
|
);
|
||||||
|
player.sendMessage(TranslatableCaption.of("debugexec.threshold_default_double"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotAnalysis.calcOptimalModifiers(() -> MainUtil
|
PlotAnalysis.calcOptimalModifiers(() -> player.sendMessage(TranslatableCaption.of("debugexec.calibration_done")), threshold);
|
||||||
.sendMessage(player, "$1Thank you for calibrating plot expiry"), threshold);
|
|
||||||
return true;
|
return true;
|
||||||
case "stop-expire":
|
case "stop-expire":
|
||||||
if (ExpireManager.IMP == null || !ExpireManager.IMP.cancelTask()) {
|
if (ExpireManager.IMP == null || !ExpireManager.IMP.cancelTask()) {
|
||||||
return MainUtil.sendMessage(player, "Task already halted");
|
player.sendMessage(TranslatableCaption.of("debugexec.task_halted"));
|
||||||
}
|
}
|
||||||
return MainUtil.sendMessage(player, "Cancelled task.");
|
return MainUtil.sendMessage(player, "Cancelled task.");
|
||||||
case "remove-flag":
|
case "remove-flag":
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
"move.move_success": "<prefix><dark_aqua>Successfully moved plot.</dark_aqua>",
|
"move.move_success": "<prefix><dark_aqua>Successfully moved plot.</dark_aqua>",
|
||||||
"move.move_merged": "<prefix><gray>Merged plots may not be moved. Please unmerge the plot before performing the move.</gray>",
|
"move.move_merged": "<prefix><gray>Merged plots may not be moved. Please unmerge the plot before performing the move.</gray>",
|
||||||
"move.copy_success": "<prefix><dark_aqua>Successfully copied plot.</dark_aqua>",
|
"move.copy_success": "<prefix><dark_aqua>Successfully copied plot.</dark_aqua>",
|
||||||
"move.reqiores_unowned": "<prefix><gray>The location specified is already occupied.</gray>",
|
"move.requires_unowned": "<prefix><gray>The location specified is already occupied.</gray>",
|
||||||
|
|
||||||
"debug.requires_unmerged": "<prefix><red>The plot cannot be merged.</red>",
|
"debug.requires_unmerged": "<prefix><red>The plot cannot be merged.</red>",
|
||||||
"debug.degub_header": "<prefix> <gold>Debug Information</orange>\n",
|
"debug.debug_header": "<prefix> <gold>Debug Information</orange>\n",
|
||||||
"debug.debug_section": "<gray>>></gray> <gold><bold>&l<val></bold></gold>",
|
"debug.debug_section": "<gray>>></gray> <gold><bold>&l<val></bold></gold>",
|
||||||
"debug.debug_line": "<gray>>></gray> <gold><var></gold><gray>:</gray><gold> <val></gold>\n",
|
"debug.debug_line": "<gray>>></gray> <gold><var></gold><gray>:</gray><gold> <val></gold>\n",
|
||||||
"debug.plot_debug": "<gray>[<gold>Plot </gold><gray>Debug] (</gray><gold><plot></gold><gray>): <message></gray>",
|
"debug.plot_debug": "<gray>[<gold>Plot </gold><gray>Debug] (</gray><gold><plot></gold><gray>): <message></gray>",
|
||||||
@ -31,13 +31,16 @@
|
|||||||
"cluster.cluster_available_args": "<prefix><gold>The following sub commands are available: </gold><dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>",
|
"cluster.cluster_available_args": "<prefix><gold>The following sub commands are available: </gold><dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>",
|
||||||
"cluster.cluster_list_heading": "<prefix><gray>There are </gray><gold><amount></gold><gray> clusters in this world.</gray>",
|
"cluster.cluster_list_heading": "<prefix><gray>There are </gray><gold><amount></gold><gray> clusters in this world.</gray>",
|
||||||
"cluster.cluster_list_element": "<prefix><gray> - </gray><gold><cluster></gold>\n",
|
"cluster.cluster_list_element": "<prefix><gray> - </gray><gold><cluster></gold>\n",
|
||||||
|
"cluster.cluster_list_element_owner": "<prefix><gray> - </gray><green><cluster></green>\n",
|
||||||
|
"cluster.cluster_list_element_helpers": "<prefix><gray> - </gray><dark_aqua><cluster></dark_aqua>\n",
|
||||||
|
"cluster.cluster_list_element_invited": "<prefix><gray> - </gray><blue><cluster></blue>\n",
|
||||||
"cluster.cluster_intersection": "<prefix><gray>The proposed area overlaps with: <cluster></gray>",
|
"cluster.cluster_intersection": "<prefix><gray>The proposed area overlaps with: <cluster></gray>",
|
||||||
"cluster.cluster_outside": "<prefix><gray>The proposed area is outside the plot area: <area></gray>",
|
"cluster.cluster_outside": "<prefix><gray>The proposed area is outside the plot area: <area></gray>",
|
||||||
"cluster.cluster_added": "<prefix><dark_aqua>Successfully created the cluster.</dark_aqua>",
|
"cluster.cluster_added": "<prefix><dark_aqua>Successfully created the cluster.</dark_aqua>",
|
||||||
"cluster.cluster_deleted": "<prefix><dark_aqua>Successfully deleted the cluster.</ark_aqua>",
|
"cluster.cluster_deleted": "<prefix><dark_aqua>Successfully deleted the cluster.</ark_aqua>",
|
||||||
"cluster.cluster_resized": "<prefix><dark_aqua>Successfully resized the cluster.</dark_aqua>",
|
"cluster.cluster_resized": "<prefix><dark_aqua>Successfully resized the cluster.</dark_aqua>",
|
||||||
"cluter.cluster_added_user": "<prefix><dark_aqua>Successfully added user to the cluster.</dark_aqua>",
|
"cluster.cluster_added_user": "<prefix><dark_aqua>Successfully added user to the cluster.</dark_aqua>",
|
||||||
"cluster.cannot_kick_player": "<prefix><red>You cannot kick that player.</red>",
|
"cluster.cannot_kick_player": "<prefix><red>You cannot kick that player: </red><gray><name></gray>",
|
||||||
"cluster.cluster_invited": "<prefix><gold>You have been invited to the following cluster: </gold><gray><cluster>.</gray>",
|
"cluster.cluster_invited": "<prefix><gold>You have been invited to the following cluster: </gold><gray><cluster>.</gray>",
|
||||||
"cluster.cluster_removed": "<prefix><gold>You have been removed from cluster: </gold><gray><cluster>.</gray>",
|
"cluster.cluster_removed": "<prefix><gold>You have been removed from cluster: </gold><gray><cluster>.</gray>",
|
||||||
"cluster.cluster_kicked_user": "<prefix><dark_aqua>Successfully kicked the user from the cluster.</dark_aqua>",
|
"cluster.cluster_kicked_user": "<prefix><dark_aqua>Successfully kicked the user from the cluster.</dark_aqua>",
|
||||||
@ -152,6 +155,7 @@
|
|||||||
"schematics.schematic_too_large": "<prefix><red>The plot is too large for this action!</red>",
|
"schematics.schematic_too_large": "<prefix><red>The plot is too large for this action!</red>",
|
||||||
"schematics.schematic_missing_arg": "<prefix><gray>You need to specify an argument. Possible values: </gray><gold>save</gold><gray>, </gray><gold>paste </gold><gray>, </gray><gold>exportall</gold><gray>, </gray><gold>list</gold>",
|
"schematics.schematic_missing_arg": "<prefix><gray>You need to specify an argument. Possible values: </gray><gold>save</gold><gray>, </gray><gold>paste </gold><gray>, </gray><gold>exportall</gold><gray>, </gray><gold>list</gold>",
|
||||||
"schematics.schematic_invalid": "<prefix><red>That is not a valid schematic. Reason: </red><gray><reason>.</gray>",
|
"schematics.schematic_invalid": "<prefix><red>That is not a valid schematic. Reason: </red><gray><reason>.</gray>",
|
||||||
|
"schematics.schematic_invalid_named": "<prefix><red><schemname> is not a valid schematic. Reason: </red><gray><reason>.</gray>",
|
||||||
"schematics.schematic_paste_merged": "<prefix><red>Schematics cannot be pasted onto merged plots. Please unmerge the plot before performing the paste.</red>",
|
"schematics.schematic_paste_merged": "<prefix><red>Schematics cannot be pasted onto merged plots. Please unmerge the plot before performing the paste.</red>",
|
||||||
"schematics.schematic_paste_failed": "<prefix><red>Failed to paste the schematic.</red>",
|
"schematics.schematic_paste_failed": "<prefix><red>Failed to paste the schematic.</red>",
|
||||||
"schematics.schematic_paste_success": "<prefix><dark_aqua>The schematic pasted successfully.</dark_aqua>",
|
"schematics.schematic_paste_success": "<prefix><dark_aqua>The schematic pasted successfully.</dark_aqua>",
|
||||||
@ -211,8 +215,9 @@
|
|||||||
"commandconfig.not_valid_subcommand": "<prefix><gray>That is not a valid subcommand.</gray>",
|
"commandconfig.not_valid_subcommand": "<prefix><gray>That is not a valid subcommand.</gray>",
|
||||||
"commandconfig.did_you_mean": "<prefix><gray>Did you mean: <gold><value></gold></gray>",
|
"commandconfig.did_you_mean": "<prefix><gray>Did you mean: <gold><value></gold></gray>",
|
||||||
"commandconfig.subcommand_set_options_header": "<prefix><gray>Possible Values: <values>",
|
"commandconfig.subcommand_set_options_header": "<prefix><gray>Possible Values: <values>",
|
||||||
"commandconfig.command_syntax": "<prefix><gold>Usage: <gray><value></gray></gold>",
|
"commandconfig.command_syntax": "<prefix><gold>Usage: </gold><gray><value></gray>",
|
||||||
"commandconfig.flag_tutorial_usage": "<prefix><gold>Have an admin set the flag: <gray><flag></gray></gold>",
|
"commandconfig.command_syntax_extended": "<prefix><gold>Usage: </gold><gray><value1> <value2></gray>",
|
||||||
|
"commandconfig.flag_tutorial_usage": "<prefix><gold>Have an admin set the flag: </gold><gray><flag></gray>",
|
||||||
|
|
||||||
"invalid.component_illegal_block": "<prefix><red>You are not allowed to generate a component containing the block <gray><value></gray></red>",
|
"invalid.component_illegal_block": "<prefix><red>You are not allowed to generate a component containing the block <gray><value></gray></red>",
|
||||||
"invalid.not_valid_block": "<prefix><red>That's not a valid block: <gray><value></gray></red>",
|
"invalid.not_valid_block": "<prefix><red>That's not a valid block: <gray><value></gray></red>",
|
||||||
@ -224,6 +229,46 @@
|
|||||||
"invalid.number_not_positive": "<prefix><red>That's not a positive number: <gray><value></gray></red>",
|
"invalid.number_not_positive": "<prefix><red>That's not a positive number: <gray><value></gray></red>",
|
||||||
"invalid.not_a_number": "<prefix><red><gray><value></gray> is not a valid number.</red>",
|
"invalid.not_a_number": "<prefix><red><gray><value></gray> is not a valid number.</red>",
|
||||||
|
|
||||||
|
"condense.invalid_area": "<prefix><red>Invalid area.</red>",
|
||||||
|
"condense.task_already_started": "<prefix><red>Task already started.</red>",
|
||||||
|
"condense.invalid_radius": "<prefix><red>Invalid radius.</red>",
|
||||||
|
"condense.radius_too_small": "<prefix><red>Radius too small.</red>",
|
||||||
|
"condense.no_free_plots_found": "<prefix><red>No free plots found.</red>",
|
||||||
|
"condense.task_started": "<prefix><gold>Task started...</gold>",
|
||||||
|
"condense.task_cancelled": "<prefix><gold>Task cancelled.</gold>",
|
||||||
|
"condense.task_complete": "<prefix><gold>Task complete. Please verify that no new plots have been claimed during the task.</gold>",
|
||||||
|
"condense.moving": "<gold>Moving: </gold><gray><origin></gray><gold> -> </gold><green><possible></green>",
|
||||||
|
"condense.task_failed": "<prefix><red>Task failed. No free plots found.</red>",
|
||||||
|
"condense.skipping": "<prefix><red>Skipping complex plot: </red><gold><plot></gold><red>.</red>",
|
||||||
|
"condense.task_already_stopped": "<prefix><gold>Task already stopped.</gold>",
|
||||||
|
"condense.task_stopped": "<prefix><gold>Task already stopped.</gold>",
|
||||||
|
"condense.default_eval": "<dark_gray><strikethrough>=== <reset> <gold>DEFAULT EVAL </gold><dark_gray><strikethrough>===</dark_gray>",
|
||||||
|
"condense.minimum_radius": "<gold><Minimum radius: </gold><gray><minimumRadius></gray>",
|
||||||
|
"condense.maximum_moved": "<gold>Maximum moved: </gold><gray><maximumMoves></gray>",
|
||||||
|
"condense.input_eval": "<dark_gray><strikethrough>=== <reset> <gold>INPUT EVAL </gold><dark_gray><strikethrough>===</dark_gray>",
|
||||||
|
"condense.input_radius": "<gold>Input radius: </gold><gray><radius></gray>",
|
||||||
|
"condense.estimated_moves": "<gold>Estimated moves: </gold><gray><userMove></gray>",
|
||||||
|
"condense.eta": "<prefix><gold>Estimated time: No idea, times will drastically change based on the system performance and load.</gold>",
|
||||||
|
"condense.radius_measured": "<yellow> - Radius is measured in plot width.</yellow>",
|
||||||
|
|
||||||
|
"database.starting_conversion": "<prefix><gold>Starting...</gold>",
|
||||||
|
"database.conversion_done": "<prefix><gold>Database conversion finished.<gold>",
|
||||||
|
"database.conversion_failed": "<prefix><red>Failed to insert plot objects, see stacktrace for info.</red>",
|
||||||
|
"database.arg": "<prefix><gray>[arg] indicates an optional argument.</gray>",
|
||||||
|
"database.does_not_exist": "<prefix><red>Database does not exist: </red><gray><value></gray><red>.</red>",
|
||||||
|
"database.failed_to_save_plots": "<prefix><red>Failed to save plots, read stacktrace for info.</red>",
|
||||||
|
"database.invalid_args": "<prefix><red>Please make sure you are using the correct arguments.</red>",
|
||||||
|
"database.failed_to_open": "<prefix><red>Failed to open connection, read stacktrace for info.</red>",
|
||||||
|
|
||||||
|
"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>",
|
||||||
|
"debugexec.invalid_threshold": "<prefix><red>Invalid threshold: </red><gray><value></gray>",
|
||||||
|
"debugexec.threshold_default_double": "<prefix><gray>$1<threshold> $2= $1The percentage of plots you want to clear as a number between 0 - 100.</gray>",
|
||||||
|
"debugexec.calibration_done": "<prefix><gold>Thank you for calibrating plot expiry.</gold>",
|
||||||
|
"debugexec.task_halted": "<prefix><gray>Task already halted.</gray>",
|
||||||
|
|
||||||
|
|
||||||
"errors.invalid_player": "<prefix><red>Player not found: <gray><value></gray>.</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_offline": "<prefix><red>The player must be online: <gray><player></gray>.</red>",
|
||||||
@ -243,6 +288,7 @@
|
|||||||
"errors.player_no_plots": "<prefix><gray>That player does not own any plots.</gray>",
|
"errors.player_no_plots": "<prefix><gray>That player does not own any plots.</gray>",
|
||||||
"errors.wait_for_timer": "<prefix><gray>A set block timer is bound to either the current plot or you. Please wait for it to finish.</gray>",
|
"errors.wait_for_timer": "<prefix><gray>A set block timer is bound to either the current plot or you. Please wait for it to finish.</gray>",
|
||||||
"errors.tile_entity_cap_reached": "<prefix><red>The total number of tile entities in this chunk may not exceed <gold><amount></gold>.</red>",
|
"errors.tile_entity_cap_reached": "<prefix><red>The total number of tile entities in this chunk may not exceed <gold><amount></gold>.</red>",
|
||||||
|
"error.plot_size": "<prefix><red>Error: size <= 0.</red>",
|
||||||
|
|
||||||
"debugpaste.debug_report_created": "<prefix><gold>Uploaded a full debug to: <gray><url></gray>",
|
"debugpaste.debug_report_created": "<prefix><gold>Uploaded a full debug to: <gray><url></gray>",
|
||||||
|
|
||||||
@ -279,10 +325,10 @@
|
|||||||
"info.everyone": "<gray>Everyone</gray>",
|
"info.everyone": "<gray>Everyone</gray>",
|
||||||
"info.plot_unowned": "<prefix><gray>The current plot must have an owner to perform this action.</gray>",
|
"info.plot_unowned": "<prefix><gray>The current plot must have an owner to perform this action.</gray>",
|
||||||
"info.plot_info_unclaimed": "<prefix><gray>Plot <gold><plot></gold> is not yet claimed.</gray>",
|
"info.plot_info_unclaimed": "<prefix><gray>Plot <gold><plot></gold> is not yet claimed.</gray>",
|
||||||
"info.plot_info_header": "<dark_gray><strikethrough>---------<reset> <gold>INFO </gold><dark_gray><strikethrough>---------</dark_gray>",
|
"info.plot_info_header": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------</dark_gray>",
|
||||||
"info.plot_info_hidden": "<prefix><gray>You cannot view the information about this plot.</gray>",
|
"info.plot_info_hidden": "<prefix><gray>You cannot view the information about this plot.</gray>",
|
||||||
"info.plot_info_format": "<gold>ID: <gray><id></gray>\nArea: <gray><area></gray>\nAlias:<gray><alias></gray>\nOwner:<gray><owner></gray>\nBiome: <gray><biome></gray>\nCan Build: <gray><build></gray>\nRating: <gray><rating></gray>\nSeen: <gray><seen></gray>\nTrusted:<gray><trusted></gray>\nMembers:<gray><members></gray>\nDenied:<gray><denied></gray>\nFlags:<gray><flags></gray>\nDescription: <gray><desc></gray></gold>",
|
"info.plot_info_format": "<gold>ID: <gray><id></gray>\nArea: <gray><area></gray>\nAlias:<gray><alias></gray>\nOwner:<gray><owner></gray>\nBiome: <gray><biome></gray>\nCan Build: <gray><build></gray>\nRating: <gray><rating></gray>\nSeen: <gray><seen></gray>\nTrusted:<gray><trusted></gray>\nMembers:<gray><members></gray>\nDenied:<gray><denied></gray>\nFlags:<gray><flags></gray>\nDescription: <gray><desc></gray></gold>",
|
||||||
"info.plot_info_footer": "<dark_gray><strikethrough>---------<reset> <gold>INFO </gold><dark_gray><strikethrough>---------<reset>",
|
"info.plot_info_footer": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------<reset>",
|
||||||
"info.plot_info_trusted": "<gold>Trusted:</gold><gray><trusted></gray>",
|
"info.plot_info_trusted": "<gold>Trusted:</gold><gray><trusted></gray>",
|
||||||
"info.plot_info_members": "<gold>Members:</gold><gray><members></gray>",
|
"info.plot_info_members": "<gold>Members:</gold><gray><members></gray>",
|
||||||
"info.plot_info_denied": "<gold>Denied:</gold><gray><denied></gray>",
|
"info.plot_info_denied": "<gold>Denied:</gold><gray><denied></gray>",
|
||||||
@ -299,7 +345,7 @@
|
|||||||
"info.plot_flag_list": "<gray><flag>: <value></gray>",
|
"info.plot_flag_list": "<gray><flag>: <value></gray>",
|
||||||
"info.plot_no_description": "<prefix><gray>No description set.</gray>",
|
"info.plot_no_description": "<prefix><gray>No description set.</gray>",
|
||||||
"info.info_syntax_console": "<prefix><gray>/plot info X;Z</gray>",
|
"info.info_syntax_console": "<prefix><gray>/plot info X;Z</gray>",
|
||||||
"info.plot_caps_header": "<dark_gray><strikethrough>---------<reset> <gold>CAPS </gold><dark_gray><strikethrough>---------<reset>",
|
"info.plot_caps_header": "<dark_gray><strikethrough>--------- <reset><gold>CAPS </gold><dark_gray><strikethrough>---------<reset>",
|
||||||
"info.plot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>",
|
"info.plot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>",
|
||||||
|
|
||||||
"working.generating_component": "<prefix><gold>Started generating component from your settings.</gold>",
|
"working.generating_component": "<prefix><gold>Started generating component from your settings.</gold>",
|
||||||
@ -400,6 +446,10 @@
|
|||||||
"single.single_area_failed_to_save": "<prefix><red>Error! Failed to save the area schematic.</red>",
|
"single.single_area_failed_to_save": "<prefix><red>Error! Failed to save the area schematic.</red>",
|
||||||
"single.single_area_could_not_make_directories": "<prefix><red>Error! Failed to create the schematic directory.</red>",
|
"single.single_area_could_not_make_directories": "<prefix><red>Error! Failed to create the schematic directory.</red>",
|
||||||
"single.single_area_created": "<prefix><gold>The area was created successfully!</gold>",
|
"single.single_area_created": "<prefix><gold>The area was created successfully!</gold>",
|
||||||
|
"single.get_position": "<prefix><gold>Go to the first corner and use: <gray><command> to create position 1.</gold>",
|
||||||
|
"single.delete_world_region": "<prefix><red>Stop the server and delete: <world>/region.</red>",
|
||||||
|
"single.regeneration_complete": "<prefix><gold>Regeneration complete.</gold>",
|
||||||
|
"single.worldcreation_location": "<prefix><gold>World creation settings may be stored in multiple locations:</gold>\n<dark_gray> - </dark_gray><gray>bukkit.yml in your server's root folder.</gray>\n<dark_gray> - </dark_gray><gray>PlotSquared's settings.yml</gray>\n<dark_gray> - </dark_gray><gray>Hyperverse's worlds.yml (or any world management plugin)</gray>\n<dark_gray> - </dark_gray><red>Stop the server and delete it from these locations.</red>",
|
||||||
|
|
||||||
"legacyconfig.legacy_config_found": "<prefix><green>A legacy configuration file was detected. Conversion will be attempted.</green>",
|
"legacyconfig.legacy_config_found": "<prefix><green>A legacy configuration file was detected. Conversion will be attempted.</green>",
|
||||||
"legacyconfig.legacy_config_backup": "<prefix><gold>A copy of worlds.yml has been saved in the file worlds.yml.old</gold>.",
|
"legacyconfig.legacy_config_backup": "<prefix><gold>A copy of worlds.yml has been saved in the file worlds.yml.old</gold>.",
|
||||||
@ -523,7 +573,7 @@
|
|||||||
"flags.flag_description_keep_inventory": "<gray>Prevents players from dropping their items when they die inside of the plot.</gray>",
|
"flags.flag_description_keep_inventory": "<gray>Prevents players from dropping their items when they die inside of the plot.</gray>",
|
||||||
"flags.flag_description_prevent_creative_copy": "<gray>Prevents people from copying item NBT data in the plot unless they're added as members.</gray>",
|
"flags.flag_description_prevent_creative_copy": "<gray>Prevents people from copying item NBT data in the plot unless they're added as members.</gray>",
|
||||||
|
|
||||||
"flags.flag_error_boolean": "<prefix><red>Flag value must be a boolean (true|false)</red>",
|
"flags.flag_error_boolean": "<prefix><red>Flag value must be a boolean (true | false)</red>",
|
||||||
"flags.flag_error_enum": "<prefix><red>Must be one of: <list></red>",
|
"flags.flag_error_enum": "<prefix><red>Must be one of: <list></red>",
|
||||||
"flags.flag_error_gamemode": "<prefix><red>Flag value must be a gamemode: 'survival', 'creative', 'adventure' or 'spectator.</red>",
|
"flags.flag_error_gamemode": "<prefix><red>Flag value must be a gamemode: 'survival', 'creative', 'adventure' or 'spectator.</red>",
|
||||||
"flags.flag_error_integer": "<prefix><red>Flag value must be a whole number.</red>",
|
"flags.flag_error_integer": "<prefix><red>Flag value must be a whole number.</red>",
|
||||||
@ -537,5 +587,31 @@
|
|||||||
"flags.flag_error_string": "<prefix><red>Flag value must be alphanumeric. Some special characters are allowed.</red>",
|
"flags.flag_error_string": "<prefix><red>Flag value must be alphanumeric. Some special characters are allowed.</red>",
|
||||||
"flags.flag_error_stringlist": "<prefix><red>Flag value must be a string list.</red>",
|
"flags.flag_error_stringlist": "<prefix><red>Flag value must be a string list.</red>",
|
||||||
"flags.flag_error_weather": "<prefix><red>Flag must be a weather: 'rain' or 'sun'.</red>",
|
"flags.flag_error_weather": "<prefix><red>Flag must be a weather: 'rain' or 'sun'.</red>",
|
||||||
"flags.flag_error_music": "<prefix><red>Flag value must be a valid music disc ID.</red>"
|
"flags.flag_error_music": "<prefix><red>Flag value must be a valid music disc ID.</red>",
|
||||||
|
|
||||||
|
"commands.description.add": "<gray>Allow a user to build in a plot while the plot owner is online.</gray>",
|
||||||
|
"commands.description.alias": "<gray>Set the plot alias.</gray>",
|
||||||
|
"commands.description.area": "<gray>Create a new plot area.</gray>",
|
||||||
|
"commands.description.auto": "<gray>Claim the nearest plot.</gray>",
|
||||||
|
"commands.description.backup": "<gray>Manage plot backups.</gray>",
|
||||||
|
"commands.description.backup.save": "<gray>Create a plot backup.</gray>",
|
||||||
|
"commands.description.backup.list": "<gray>List available plot backups.</gray>",
|
||||||
|
"commands.description.backup.load": "<gray>Restore a plot backup</gray>",
|
||||||
|
"commands.description.biome": "<gray>Set the plot biome.</gray>",
|
||||||
|
"commands.description.buy": "<gray>Buy the plot you are standing on.</gray>",
|
||||||
|
"commands.description.caps": "<gray>Show plot entity caps.</gray>",
|
||||||
|
"commands.description.chat": "<gray>Toggles plot chat on or off.</gray>",
|
||||||
|
"commands.description.claim": "<gray>Claim the current plot you are standing on.</gray>",
|
||||||
|
"commands.description.clear": "<gray>Clear the plot you stand on.</gray>",
|
||||||
|
"commands.description.cluster": "<gray>Manage a plot cluster.</gray>",
|
||||||
|
"commands.description.comment": "<gray>Comment on a plot.</gray>",
|
||||||
|
"commands.description.condense": "<gray>Condense a plotworld.</gray>",
|
||||||
|
"commands.description.confirm": "<gray>Confirm an action.</gray>",
|
||||||
|
"commands.description.done": "<gray>Continue a plot that was previously marked as done.</gray>",
|
||||||
|
"commands.description.copy": "<gray>Copy a plot.</gray>",
|
||||||
|
"commands.description.createroadschematic": "<gray>Add a road schematic to your world using the roads around your current plot.</gray>",
|
||||||
|
"commands.description.database": "<gray>Convert/Backup Storage.</gray>",
|
||||||
|
"commands.description.debug": "<gray>Show debug information.</gray>",
|
||||||
|
"commands.description.debugallowunsafe": "<gray>Allow unsafe actions until toggled off.</gray>",
|
||||||
|
"commands.description.debugexec": "<gray>Multi-purpose debug command.</gray>"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user