mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
More work
This commit is contained in:
parent
2aa5c276c9
commit
8d04728ebc
@ -223,7 +223,7 @@ public class DebugExec extends SubCommand {
|
||||
if (analysis != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugexec.changes_column"),
|
||||
Template.of("value", analysis.changes / 1.0)
|
||||
Template.of("value", String.valueOf(analysis.changes / 1.0))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -261,11 +261,13 @@ public class DebugExec extends SubCommand {
|
||||
if (ExpireManager.IMP == null || !ExpireManager.IMP.cancelTask()) {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.task_halted"));
|
||||
}
|
||||
return MainUtil.sendMessage(player, "Cancelled task.");
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.task_cancelled"));
|
||||
case "remove-flag":
|
||||
if (args.length != 2) {
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||
"/plot debugexec remove-flag <flag>");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot debugexec remove-flag <flag>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
String flag = args[1];
|
||||
@ -280,16 +282,24 @@ public class DebugExec extends SubCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
return MainUtil.sendMessage(player, "Cleared flag: " + flag);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugexec.cleared_flag"),
|
||||
Template.of("value", flag)
|
||||
);
|
||||
case "start-rgar": {
|
||||
if (args.length != 2) {
|
||||
MainUtil.sendMessage(player,
|
||||
"&cInvalid syntax: /plot debugexec start-rgar <world>");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Invalid syntax: /plot debugexec start-rgar <world>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
||||
if (area == null) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD, args[1]);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.not_valid_plot_world"),
|
||||
Template.of("value", args[1])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
boolean result;
|
||||
@ -299,36 +309,33 @@ public class DebugExec extends SubCommand {
|
||||
result = this.hybridUtils.scheduleRoadUpdate(area, 0);
|
||||
}
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player,
|
||||
"&cCannot schedule mass schematic update! (Is one already in progress?)");
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "stop-rgar":
|
||||
if (!HybridUtils.UPDATE) {
|
||||
MainUtil.sendMessage(player, "&cTask not running!");
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.task_not_running"));
|
||||
return false;
|
||||
}
|
||||
HybridUtils.UPDATE = false;
|
||||
MainUtil.sendMessage(player, "&cCancelling task... (Please wait)");
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.cancelling_task"));
|
||||
return true;
|
||||
case "start-expire":
|
||||
if (ExpireManager.IMP == null) {
|
||||
ExpireManager.IMP = new ExpireManager(this.eventDispatcher);
|
||||
}
|
||||
if (ExpireManager.IMP.runAutomatedTask()) {
|
||||
return MainUtil.sendMessage(player, "Started plot expiry task");
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.expiry_started"));
|
||||
} else {
|
||||
return MainUtil.sendMessage(player, "Plot expiry task already started");
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.expiry_already_started"));
|
||||
}
|
||||
case "h":
|
||||
case "he":
|
||||
case "?":
|
||||
case "help":
|
||||
MainUtil.sendMessage(player,
|
||||
"Possible sub commands: /plot debugexec <" + StringMan
|
||||
.join(allowed_params, "|") + ">");
|
||||
player.sendMessage(StaticCaption.of("Possible sub commands: /plot debugexec <" + StringMan.join(allowed_params, "|") + ">"));
|
||||
return false;
|
||||
case "addcmd":
|
||||
try {
|
||||
@ -348,7 +355,7 @@ public class DebugExec extends SubCommand {
|
||||
DebugExec.this.engine.eval(cmd, DebugExec.this.scope);
|
||||
} catch (ScriptException e) {
|
||||
e.printStackTrace();
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_WENT_WRONG);
|
||||
player.sendMessage(TranslatableCaption.of("error.command_went_wrong"));
|
||||
}
|
||||
return CompletableFuture.completedFuture(true);
|
||||
}
|
||||
@ -356,8 +363,10 @@ public class DebugExec extends SubCommand {
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||
"/plot debugexec addcmd <file>");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot debugexec addcmd <file>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
case "runasync":
|
||||
@ -397,8 +406,10 @@ public class DebugExec extends SubCommand {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Captions.COMMAND_SYNTAX
|
||||
.send(player, "/plot debugexec list-scripts [#]");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot debugexec list-scripts [#]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -415,8 +426,10 @@ public class DebugExec extends SubCommand {
|
||||
return true;
|
||||
case "allcmd":
|
||||
if (args.length < 3) {
|
||||
Captions.COMMAND_SYNTAX
|
||||
.send(player, "/plot debugexec allcmd <condition> <command>");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot debugexec allcmd <condition> <command>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
@ -440,7 +453,7 @@ public class DebugExec extends SubCommand {
|
||||
} else {
|
||||
player.setMeta(PlotPlayer.META_LAST_PLOT, plot);
|
||||
}
|
||||
player.sendMessage("&c> " + (System.currentTimeMillis() - start));
|
||||
player.sendMessage(StaticCaption.of("&c> " + (System.currentTimeMillis() - start)));
|
||||
return true;
|
||||
}
|
||||
init();
|
||||
@ -455,8 +468,10 @@ public class DebugExec extends SubCommand {
|
||||
break;
|
||||
case "all":
|
||||
if (args.length < 3) {
|
||||
Captions.COMMAND_SYNTAX
|
||||
.send(player, "/plot debugexec all <condition> <code>");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot debugexec all <condition> <code>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
script =
|
||||
@ -469,7 +484,7 @@ public class DebugExec extends SubCommand {
|
||||
script = StringMan.join(args, " ");
|
||||
}
|
||||
if (!(player instanceof ConsolePlayer)) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_CONSOLE);
|
||||
player.sendMessage(TranslatableCaption.of("console.not_console"));
|
||||
return false;
|
||||
}
|
||||
init();
|
||||
|
@ -29,6 +29,7 @@ import com.google.common.base.Charsets;
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
@ -66,15 +67,14 @@ public class DebugImportWorlds extends Command {
|
||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||
// UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8))
|
||||
if (!(this.plotAreaManager instanceof SinglePlotAreaManager)) {
|
||||
player.sendMessage("Must be a single plot area!");
|
||||
player.sendMessage(TranslatableCaption.of("debugimportworlds.single_plot_area"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
SinglePlotArea area = ((SinglePlotAreaManager) this.plotAreaManager).getArea();
|
||||
PlotId id = PlotId.of(0, 0);
|
||||
File container = PlotSquared.platform().getWorldContainer();
|
||||
if (container.equals(new File("."))) {
|
||||
player.sendMessage(
|
||||
"World container must be configured to be a separate directory to your base files!");
|
||||
player.sendMessage(TranslatableCaption.of("debugimportworlds.world_container"));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
for (File folder : container.listFiles()) {
|
||||
@ -84,7 +84,7 @@ public class DebugImportWorlds extends Command {
|
||||
if (name.length() > 16) {
|
||||
uuid = UUID.fromString(name);
|
||||
} else {
|
||||
Captions.FETCHING_PLAYER.send(player);
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_player"));
|
||||
uuid = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(name, 60000L);
|
||||
}
|
||||
if (uuid == null) {
|
||||
@ -100,7 +100,7 @@ public class DebugImportWorlds extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
player.sendMessage("Done!");
|
||||
player.sendMessage(TranslatableCaption.of("players.done"));
|
||||
return CompletableFuture.completedFuture(true);
|
||||
}
|
||||
}
|
||||
|
@ -31,12 +31,15 @@ import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.inject.annotations.ConfigFile;
|
||||
import com.plotsquared.core.inject.annotations.WorldFile;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.PremiumVerification;
|
||||
import com.plotsquared.core.util.net.IncendoPaster;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.BufferedReader;
|
||||
@ -54,7 +57,7 @@ import java.util.stream.Collectors;
|
||||
@CommandDeclaration(command = "debugpaste",
|
||||
aliases = "dp",
|
||||
usage = "/plot debugpaste",
|
||||
description = "Upload settings.yml, worlds.yml, PlotSquared.use_THIS.yml your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste",
|
||||
description = "Upload settings.yml, worlds.yml, your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste",
|
||||
permission = "plots.debugpaste",
|
||||
category = CommandCategory.DEBUG,
|
||||
confirmation = true,
|
||||
@ -147,28 +150,20 @@ public class DebugPaste extends SubCommand {
|
||||
incendoPaster
|
||||
.addFile(new IncendoPaster.PasteFile("latest.log", readFile(logFile)));
|
||||
} catch (IOException ignored) {
|
||||
MainUtil
|
||||
.sendMessage(player, "&clatest.log is too big to be pasted, will ignore");
|
||||
player.sendMessage(StaticCaption.of("&clatest.log is too big to be pasted, please reboot your server and submit a new paste."));
|
||||
}
|
||||
|
||||
try {
|
||||
incendoPaster.addFile(new IncendoPaster.PasteFile("settings.yml",
|
||||
readFile(this.configFile)));
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
MainUtil.sendMessage(player, "&cSkipping settings.yml because it's empty");
|
||||
player.sendMessage(StaticCaption.of("&cSkipping settings.yml because it's empty."));
|
||||
}
|
||||
try {
|
||||
incendoPaster.addFile(new IncendoPaster.PasteFile("worlds.yml",
|
||||
readFile(this.worldfile)));
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
MainUtil.sendMessage(player, "&cSkipping worlds.yml because it's empty");
|
||||
}
|
||||
try {
|
||||
incendoPaster.addFile(new IncendoPaster.PasteFile("PlotSquared.use_THIS.yml",
|
||||
readFile(PlotSquared.get().translationFile)));
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
MainUtil.sendMessage(player,
|
||||
"&cSkipping PlotSquared.use_THIS.yml because it's empty");
|
||||
player.sendMessage(StaticCaption.of("&cSkipping worlds.yml because it's empty."));
|
||||
}
|
||||
|
||||
try {
|
||||
@ -177,8 +172,7 @@ public class DebugPaste extends SubCommand {
|
||||
incendoPaster.addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml",
|
||||
readFile(MultiverseWorlds)));
|
||||
} catch (final IOException ignored) {
|
||||
MainUtil.sendMessage(player,
|
||||
"&cSkipping Multiverse worlds.yml because the plugin is not in use");
|
||||
player.sendMessage(StaticCaption.of("&cSkipping Multiverse world's.yml because Multiverse is not in use."));
|
||||
}
|
||||
|
||||
try {
|
||||
@ -191,16 +185,22 @@ public class DebugPaste extends SubCommand {
|
||||
final String link =
|
||||
String.format("https://athion.net/ISPaster/paste/view/%s", pasteId);
|
||||
player.sendMessage(
|
||||
Captions.DEBUG_REPORT_CREATED.getTranslated().replace("%url%", link));
|
||||
TranslatableCaption.of("debugpaste.debug_report_created"),
|
||||
Template.of("url", link)
|
||||
);
|
||||
} else {
|
||||
final String responseMessage = jsonObject.get("response").getAsString();
|
||||
MainUtil.sendMessage(player, String
|
||||
.format("&cFailed to create the debug paste: %s", responseMessage));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugpaste.creation_failed"),
|
||||
Template.of("value", responseMessage)
|
||||
);
|
||||
}
|
||||
} catch (final Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
MainUtil.sendMessage(player,
|
||||
"&cFailed to create the debug paste: " + throwable.getMessage());
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugpaste.creation_failed"),
|
||||
Template.of("value", throwable.getMessage())
|
||||
);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.generator.HybridPlotManager;
|
||||
import com.plotsquared.core.generator.HybridUtils;
|
||||
import com.plotsquared.core.location.Location;
|
||||
@ -34,6 +35,7 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
@ -46,7 +48,7 @@ import java.util.Arrays;
|
||||
permission = "plots.debugroadregen")
|
||||
public class DebugRoadRegen extends SubCommand {
|
||||
|
||||
public static final String USAGE = "/plot debugroadregen <plot|region [height]>";
|
||||
public static final String USAGE = "/plot debugroadregen <plot | region [height]>";
|
||||
|
||||
private final HybridUtils hybridUtils;
|
||||
|
||||
@ -56,7 +58,10 @@ public class DebugRoadRegen extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
if (args.length < 1) {
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", DebugRoadRegen.USAGE)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
String kind = args[0].toLowerCase();
|
||||
@ -66,7 +71,10 @@ public class DebugRoadRegen extends SubCommand {
|
||||
case "region":
|
||||
return regenRegion(player, Arrays.copyOfRange(args, 1, args.length));
|
||||
default:
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", DebugRoadRegen.USAGE)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -75,21 +83,26 @@ public class DebugRoadRegen extends SubCommand {
|
||||
Location location = player.getLocation();
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
}
|
||||
Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
Captions.NOT_IN_PLOT.send(player);
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
} else if (plot.isMerged()) {
|
||||
Captions.REQUIRES_UNMERGED.send(player);
|
||||
player.sendMessage(TranslatableCaption.of("debug.requires_unmerged"));
|
||||
} else {
|
||||
PlotManager manager = area.getPlotManager();
|
||||
manager.createRoadEast(plot);
|
||||
manager.createRoadSouth(plot);
|
||||
manager.createRoadSouthEast(plot);
|
||||
MainUtil.sendMessage(player, "&6Regenerating plot south/east roads: " + plot.getId()
|
||||
+ "\n&6 - Result: &aSuccess");
|
||||
MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugroadregen.regen_done"),
|
||||
Template.of("value", String.valueOf(plot.getId()))
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugroadregen.regen_all"),
|
||||
Template.of("value", "/plot regenallroads")
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -100,35 +113,40 @@ public class DebugRoadRegen extends SubCommand {
|
||||
try {
|
||||
height = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException ignored) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_VALID_NUMBER, "(0, 256)");
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.not_valid_number"),
|
||||
Template.of("value", "0, 256")
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", DebugRoadRegen.USAGE)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
} else if (args.length != 0) {
|
||||
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, DebugRoadRegen.USAGE);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", DebugRoadRegen.USAGE)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
Location location = player.getLocation();
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
return sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
}
|
||||
Plot plot = player.getCurrentPlot();
|
||||
PlotManager manager = area.getPlotManager();
|
||||
if (!(manager instanceof HybridPlotManager)) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
|
||||
return true;
|
||||
}
|
||||
MainUtil
|
||||
.sendMessage(player, "&cIf no schematic is set, the following will not do anything");
|
||||
MainUtil.sendMessage(player,
|
||||
"&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
|
||||
MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads");
|
||||
player.sendMessage(TranslatableCaption.of("debugroadregen.schematic"));
|
||||
player.sendMessage(TranslatableCaption.of("debugroadregen.regenallroads"));
|
||||
boolean result = this.hybridUtils.scheduleSingleRegionRoadUpdate(plot, height);
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player,
|
||||
"&cCannot schedule mass schematic update! (Is one already in progress?)");
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
@ -42,9 +43,9 @@ public class DebugSaveTest extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
final List<Plot> plots = PlotQuery.newQuery().allPlots().asList();
|
||||
MainUtil.sendMessage(player, "&6Starting `DEBUGSAVETEST`");
|
||||
player.sendMessage(TranslatableCaption.of("debugsavetest.starting"));
|
||||
DBFunc.createPlotsAndData(plots,
|
||||
() -> MainUtil.sendMessage(player, "&6Database sync finished!"));
|
||||
() -> player.sendMessage(TranslatableCaption.of("debugsavetest.done")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class Delete extends SubCommand {
|
||||
player.getPlotCount(location.getWorldName());
|
||||
Runnable run = () -> {
|
||||
if (plot.getRunning() > 0) {
|
||||
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
return;
|
||||
}
|
||||
final long start = System.currentTimeMillis();
|
||||
@ -105,16 +105,21 @@ public class Delete extends SubCommand {
|
||||
double value = plots.size() * valueExr.evaluate((double) currentPlots);
|
||||
if (value > 0d) {
|
||||
this.econHandler.depositMoney(player, value);
|
||||
sendMessage(player, Captions.ADDED_BALANCE, String.valueOf(value));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("economy.added_balance"),
|
||||
Template.of("money", String.valueOf(value))
|
||||
);
|
||||
}
|
||||
}
|
||||
MainUtil.sendMessage(player, Captions.DELETING_DONE,
|
||||
System.currentTimeMillis() - start);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("working.deleting_done"),
|
||||
Template.of("amount", String.valueOf(System.currentTimeMillis() - start))
|
||||
);
|
||||
});
|
||||
if (result) {
|
||||
plot.addRunning();
|
||||
} else {
|
||||
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
}
|
||||
};
|
||||
if (hasConfirmation(player)) {
|
||||
|
@ -40,6 +40,7 @@ import com.plotsquared.core.util.PlayerManager;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
@ -50,7 +51,7 @@ import java.util.concurrent.TimeoutException;
|
||||
@CommandDeclaration(command = "deny",
|
||||
aliases = {"d", "ban"},
|
||||
description = "Deny a user from entering a plot",
|
||||
usage = "/plot deny <player|*>",
|
||||
usage = "/plot deny <player | *>",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
public class Deny extends SubCommand {
|
||||
@ -77,31 +78,40 @@ public class Deny extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
} else if (throwable != null || uuids.isEmpty()) {
|
||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
);
|
||||
} else {
|
||||
for (UUID uuid : uuids) {
|
||||
if (uuid == DBFunc.EVERYONE && !(
|
||||
Permissions.hasPermission(player, Captions.PERMISSION_DENY_EVERYONE) || Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DENY))) {
|
||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, PlayerManager.getName(uuid));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", args[0])
|
||||
);
|
||||
} else if (plot.isOwner(uuid)) {
|
||||
MainUtil.sendMessage(player, Captions.CANT_REMOVE_OWNER, PlayerManager.getName(uuid));
|
||||
player.sendMessage(TranslatableCaption.of("deny.cant_remove_owner"));
|
||||
return;
|
||||
} else if (plot.getDenied().contains(uuid)) {
|
||||
MainUtil.sendMessage(player, Captions.ALREADY_ADDED, PlayerManager.getName(uuid));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("member.already_added"),
|
||||
Template.of("player", PlayerManager.getName(uuid))
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
if (uuid != DBFunc.EVERYONE) {
|
||||
@ -123,7 +133,7 @@ public class Deny extends SubCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
MainUtil.sendMessage(player, Captions.DENIED_ADDED);
|
||||
player.sendMessage(TranslatableCaption.of("deny.denied_added"));
|
||||
}
|
||||
});
|
||||
|
||||
@ -149,12 +159,12 @@ public class Deny extends SubCommand {
|
||||
}
|
||||
Location location = player.getLocation();
|
||||
Location spawn = this.worldUtil.getSpawn(location.getWorldName());
|
||||
MainUtil.sendMessage(player, Captions.YOU_GOT_DENIED);
|
||||
player.sendMessage(TranslatableCaption.of("deny.you_got_denied"));
|
||||
if (plot.equals(spawn.getPlot())) {
|
||||
Location newSpawn = this.worldUtil.getSpawn(this.plotAreaManager.getAllWorlds()[0]);
|
||||
if (plot.equals(newSpawn.getPlot())) {
|
||||
// Kick from server if you can't be teleported to spawn
|
||||
player.kick(Captions.YOU_GOT_DENIED.getTranslated());
|
||||
player.sendMessage(TranslatableCaption.of("deny.you_got_denied"));
|
||||
} else {
|
||||
player.teleport(newSpawn);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class Desc extends SetCommand {
|
||||
return false;
|
||||
}
|
||||
plot.removeFlag(event.getFlag());
|
||||
MainUtil.sendMessage(player, Captions.DESC_UNSET);
|
||||
player.sendMessage(TranslatableCaption.of("desc.desc_unset"));
|
||||
return true;
|
||||
}
|
||||
PlotFlagAddEvent event = this.eventDispatcher.callFlagAdd(plot.getFlagContainer().getFlag(DescriptionFlag.class).createFlagInstance(desc), plot);
|
||||
@ -76,10 +76,10 @@ public class Desc extends SetCommand {
|
||||
}
|
||||
boolean result = plot.setFlag(event.getFlag());
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, Captions.FLAG_NOT_ADDED);
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_not_added"));
|
||||
return false;
|
||||
}
|
||||
MainUtil.sendMessage(player, Captions.DESC_SET);
|
||||
player.sendMessage(TranslatableCaption.of("desc.desc_set"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -81,19 +81,19 @@ public class Done extends SubCommand {
|
||||
boolean force = event.getEventResult() == Result.FORCE;
|
||||
if (!force && !plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DONE)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (DoneFlag.isDone(plot)) {
|
||||
MainUtil.sendMessage(player, Captions.DONE_ALREADY_DONE);
|
||||
player.sendMessage(TranslatableCaption.of("done.done_already_done"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getRunning() > 0) {
|
||||
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
MainUtil.sendMessage(player, Captions.GENERATING_LINK);
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_lin"));
|
||||
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
|
||||
if (ExpireManager.IMP == null || doneRequirements == null) {
|
||||
finish(plot, player, true);
|
||||
@ -111,9 +111,9 @@ public class Done extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void finish(Plot plot, PlotPlayer pp, boolean success) {
|
||||
private void finish(Plot plot, PlotPlayer player, boolean success) {
|
||||
if (!success) {
|
||||
MainUtil.sendMessage(pp, Captions.DONE_INSUFFICIENT_COMPLEXITY);
|
||||
player.sendMessage(TranslatableCaption.of("done.done_insufficient_complexity"));
|
||||
return;
|
||||
}
|
||||
long flagValue = System.currentTimeMillis() / 1000;
|
||||
@ -121,10 +121,10 @@ public class Done extends SubCommand {
|
||||
.createFlagInstance(Long.toString(flagValue));
|
||||
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
sendMessage(pp, Captions.EVENT_DENIED, "Done flag addition");
|
||||
player.sendMessage(TranslatableCaption.of("events.event_denied"));
|
||||
return;
|
||||
}
|
||||
plot.setFlag(plotFlag);
|
||||
MainUtil.sendMessage(pp, Captions.DONE_SUCCESS);
|
||||
player.sendMessage(TranslatableCaption.of("done.done_success"));
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ package com.plotsquared.core.command;
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
@ -39,6 +40,7 @@ import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.net.URL;
|
||||
@ -75,27 +77,27 @@ public class Download extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
MainUtil.sendMessage(player, Captions.PLOT_UNOWNED);
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if ((Settings.Done.REQUIRED_FOR_DOWNLOAD && (!DoneFlag.isDone(plot))) && !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_DOWNLOAD)) {
|
||||
MainUtil.sendMessage(player, Captions.DONE_NOT_DONE);
|
||||
player.sendMessage(TranslatableCaption.of("done.done_not_done"));
|
||||
return false;
|
||||
}
|
||||
if ((!plot.isOwner(player.getUUID())) && !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN.getTranslated())) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getRunning() > 0) {
|
||||
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||
return false;
|
||||
}
|
||||
if (args.length == 0 || (args.length == 1 && StringMan
|
||||
.isEqualIgnoreCaseToAny(args[0], "sch", "schem", "schematic"))) {
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
Captions.SCHEMATIC_TOO_LARGE.send(player);
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
@ -105,10 +107,11 @@ public class Download extends SubCommand {
|
||||
schematicHandler.upload(value, null, null, new RunnableVal<URL>() {
|
||||
@Override public void run(URL url) {
|
||||
if (url == null) {
|
||||
MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED);
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_link_failed"));
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(player, url.toString());
|
||||
player.sendMessage(StaticCaption.of(url.toString())
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -116,27 +119,30 @@ public class Download extends SubCommand {
|
||||
} else if (args.length == 1 && StringMan
|
||||
.isEqualIgnoreCaseToAny(args[0], "mcr", "world", "mca")) {
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_DOWNLOAD_WORLD)) {
|
||||
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_DOWNLOAD_WORLD);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Captions.PERMISSION_DOWNLOAD_WORLD.getTranslated())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
MainUtil.sendMessage(player, Captions.MCA_FILE_SIZE);
|
||||
player.sendMessage(TranslatableCaption.of("schematics.mca_file_size"));
|
||||
plot.addRunning();
|
||||
this.worldUtil.saveWorld(world);
|
||||
this.worldUtil.upload(plot, null, null, new RunnableVal<URL>() {
|
||||
@Override public void run(URL url) {
|
||||
plot.removeRunning();
|
||||
if (url == null) {
|
||||
MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED);
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_link_failed"));
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(player, url.toString());
|
||||
player.sendMessage(StaticCaption.of(url.toString())
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sendUsage(player);
|
||||
return false;
|
||||
}
|
||||
MainUtil.sendMessage(player, Captions.GENERATING_LINK);
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_link"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import com.google.common.primitives.Ints;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.caption.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
@ -36,6 +37,7 @@ import com.plotsquared.core.util.PlayerManager;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@ -74,9 +76,12 @@ public class Grant extends Command {
|
||||
}
|
||||
PlayerManager.getUUIDsFromString(args[1], (uuids, throwable) -> {
|
||||
if (throwable instanceof TimeoutException) {
|
||||
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
|
||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||
} else if (throwable != null || uuids.size() != 1) {
|
||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.invalid_player"),
|
||||
Template.of("value", String.valueOf(uuids))
|
||||
);
|
||||
} else {
|
||||
final UUID uuid = uuids.toArray(new UUID[0])[0];
|
||||
final Consumer<byte[]> result = array -> {
|
||||
@ -87,7 +92,10 @@ public class Grant extends Command {
|
||||
} else {
|
||||
granted = Ints.fromByteArray(array);
|
||||
}
|
||||
Captions.GRANTED_PLOTS.send(player, granted);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("grants.granted_plots"),
|
||||
Template.of("amount", String.valueOf(granted))
|
||||
);
|
||||
} else { // add
|
||||
int amount;
|
||||
if (array == null) {
|
||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
@ -40,6 +41,7 @@ import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.query.SortingStrategy;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
@ -69,11 +71,14 @@ public class HomeCommand extends Command {
|
||||
final RunnableVal2<Command, CommandResult> whenDone) {
|
||||
List<Plot> plots = query.asList();
|
||||
if (plots.isEmpty()) {
|
||||
Captions.FOUND_NO_PLOTS.send(player);
|
||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||
return;
|
||||
} else if (plots.size() < page) {
|
||||
MainUtil.sendMessage(player,
|
||||
String.format(Captions.NUMBER_NOT_IN_RANGE.getTranslated(), "1", plots.size()));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.number_not_in_range"),
|
||||
Template.of("min", "1"),
|
||||
Template.of("max", String.valueOf(plots.size()))
|
||||
);
|
||||
return;
|
||||
}
|
||||
Plot plot = plots.get(page - 1);
|
||||
@ -101,7 +106,10 @@ public class HomeCommand extends Command {
|
||||
// /plot home <area> <page>
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_VISIT_OWNED) && !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_HOME)) {
|
||||
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_VISIT_OWNED);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Captions.PERMISSION_VISIT_OWNED.getTranslated())
|
||||
);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
if (args.length > 2) {
|
||||
@ -119,7 +127,10 @@ public class HomeCommand extends Command {
|
||||
try {
|
||||
page = Integer.parseInt(identifier);
|
||||
} catch (NumberFormatException ignored) {
|
||||
Captions.NOT_A_NUMBER.send(player, identifier);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.not_a_number"),
|
||||
Template.of("value", identifier)
|
||||
);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
query.withSortingStrategy(SortingStrategy.SORT_BY_CREATION);
|
||||
@ -151,7 +162,10 @@ public class HomeCommand extends Command {
|
||||
try {
|
||||
page = Integer.parseInt(identifier);
|
||||
} catch (NumberFormatException ignored) {
|
||||
Captions.NOT_A_NUMBER.send(player, identifier);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.not_a_number"),
|
||||
Template.of("value", identifier)
|
||||
);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
query.withSortingStrategy(SortingStrategy.SORT_BY_CREATION);
|
||||
|
@ -26,6 +26,7 @@
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
@ -34,6 +35,7 @@ import com.plotsquared.core.plot.comment.CommentManager;
|
||||
import com.plotsquared.core.plot.comment.PlotComment;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -47,7 +49,7 @@ public class Inbox extends SubCommand {
|
||||
|
||||
public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) {
|
||||
if (oldComments == null || oldComments.isEmpty()) {
|
||||
MainUtil.sendMessage(player, Captions.INBOX_EMPTY);
|
||||
player.sendMessage(TranslatableCaption.of("comment.inbox_empty"));
|
||||
return;
|
||||
}
|
||||
PlotComment[] comments = oldComments.toArray(new PlotComment[0]);
|
||||
@ -83,7 +85,7 @@ public class Inbox extends SubCommand {
|
||||
.append(comment.id).append("&8][&6").append(comment.senderName).append("&8]")
|
||||
.append(color).append(comment.comment).append('\n');
|
||||
}
|
||||
MainUtil.sendMessage(player, string.toString());
|
||||
player.sendMessage(StaticCaption.of(string.toString()));
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
@ -93,7 +95,7 @@ public class Inbox extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
sendMessage(player, Captions.PLOT_UNOWNED);
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
@ -125,10 +127,16 @@ public class Inbox extends SubCommand {
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendMessage(player, Captions.INBOX_ITEM, inbox.toString());
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.inbox_item"),
|
||||
Template.of("value", inbox.toString())
|
||||
);
|
||||
}
|
||||
})) {
|
||||
sendMessage(player, Captions.INBOX_ITEM, inbox.toString());
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.inbox_item"),
|
||||
Template.of("value", inbox.toString())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -146,41 +154,54 @@ public class Inbox extends SubCommand {
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "delete":
|
||||
if (!inbox.canModify(plot, player)) {
|
||||
sendMessage(player, Captions.NO_PERM_INBOX_MODIFY);
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify"));
|
||||
return false;
|
||||
}
|
||||
if (args.length != 3) {
|
||||
sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||
"/plot inbox " + inbox.toString() + " delete <index>");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot inbox " + inbox.toString() + " delete <index>")
|
||||
);
|
||||
}
|
||||
final int index;
|
||||
try {
|
||||
index = Integer.parseInt(args[2]);
|
||||
if (index < 1) {
|
||||
sendMessage(player, Captions.NOT_VALID_INBOX_INDEX, index + "");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.not_valid_inbox_index"),
|
||||
Template.of("number", index + "")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
} catch (NumberFormatException ignored) {
|
||||
sendMessage(player, Captions.COMMAND_SYNTAX,
|
||||
"/plot inbox " + inbox.toString() + " delete <index>");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot inbox " + inbox.toString() + " delete <index>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
|
||||
@Override public void run(List<PlotComment> value) {
|
||||
if (index > value.size()) {
|
||||
sendMessage(player, Captions.NOT_VALID_INBOX_INDEX, index + "");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.not_valid_inbox_index"),
|
||||
Template.of("number", index + "")
|
||||
);
|
||||
return;
|
||||
}
|
||||
PlotComment comment = value.get(index - 1);
|
||||
inbox.removeComment(plot, comment);
|
||||
boolean success = plot.removeComment(comment);
|
||||
if (success) {
|
||||
MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS,
|
||||
comment.comment);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_removed_success"),
|
||||
Template.of("value", comment.comment)
|
||||
);
|
||||
} else {
|
||||
MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_FAILURE,
|
||||
comment.comment);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_removed_failure"));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -191,14 +212,17 @@ public class Inbox extends SubCommand {
|
||||
return true;
|
||||
case "clear":
|
||||
if (!inbox.canModify(plot, player)) {
|
||||
sendMessage(player, Captions.NO_PERM_INBOX_MODIFY);
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify"));
|
||||
}
|
||||
inbox.clearInbox(plot);
|
||||
List<PlotComment> comments = plot.getComments(inbox.toString());
|
||||
if (!comments.isEmpty()) {
|
||||
plot.removeComments(comments);
|
||||
}
|
||||
MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS, "*");
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_removed_success"),
|
||||
Template.of("value", "*")
|
||||
);
|
||||
return true;
|
||||
default:
|
||||
try {
|
||||
@ -212,7 +236,7 @@ public class Inbox extends SubCommand {
|
||||
page = 1;
|
||||
}
|
||||
if (!inbox.canRead(plot, player)) {
|
||||
sendMessage(player, Captions.NO_PERM_INBOX);
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox"));
|
||||
return false;
|
||||
}
|
||||
if (!inbox.getComments(plot, new RunnableVal<List<PlotComment>>() {
|
||||
@ -220,7 +244,7 @@ public class Inbox extends SubCommand {
|
||||
displayComments(player, value, page);
|
||||
}
|
||||
})) {
|
||||
sendMessage(player, Captions.PLOT_UNOWNED);
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -27,10 +27,12 @@ package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.flag.implementations.HideInfoFlag;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
@CommandDeclaration(command = "info",
|
||||
aliases = "i",
|
||||
@ -77,7 +79,7 @@ public class Info extends SubCommand {
|
||||
plot = player.getCurrentPlot();
|
||||
}
|
||||
if (plot == null) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_IN_PLOT.getTranslated());
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -96,7 +98,10 @@ public class Info extends SubCommand {
|
||||
if (argument.equalsIgnoreCase("-f")) {
|
||||
if (!player
|
||||
.hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.getTranslated())) {
|
||||
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_AREA_INFO_FORCE);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
Template.of("node", Captions.PERMISSION_AREA_INFO_FORCE.getTranslated())
|
||||
);
|
||||
return true;
|
||||
}
|
||||
allowed = true;
|
||||
@ -104,7 +109,7 @@ public class Info extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (!allowed) {
|
||||
Captions.PLOT_INFO_HIDDEN.send(player);
|
||||
player.sendMessage(TranslatableCaption.of("info.plot_info_hidden"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -115,8 +120,10 @@ public class Info extends SubCommand {
|
||||
boolean trustedEveryone = plot.getMembers().contains(DBFunc.EVERYONE);
|
||||
// Unclaimed?
|
||||
if (!hasOwner && !containsEveryone && !trustedEveryone) {
|
||||
MainUtil.sendMessage(player, Captions.PLOT_INFO_UNCLAIMED,
|
||||
plot.getId().getX() + ";" + plot.getId().getY());
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("info.plot_info_unclaimed"),
|
||||
Template.of("plot", plot.getId().getX() + ";" + plot.getId().getY())
|
||||
);
|
||||
return true;
|
||||
}
|
||||
String info = Captions.PLOT_INFO_FORMAT.getTranslated();
|
||||
|
@ -77,7 +77,7 @@
|
||||
"comment.no_perm_inbox": "<prefix><red>You do not have permission for that inbox.</red>",
|
||||
"comment.no_perm_inbox_modify": "<prefix><red>You do not have permission to modify that inbox.</red>",
|
||||
"comment.no_plot_inbox": "<prefix><red>You must stand in or supply a plot argument</red>",
|
||||
"comment.comment_removed_success": "<prefix><dark_aqua>Successfully deleted comment/s:n</dark_aqua><gray> - </gray><dark_gray><value></dark_gray>",
|
||||
"comment.comment_removed_success": "<prefix><dark_aqua>Successfully deleted comment(s)\n</dark_aqua><gray> - </gray><dark_gray><value></dark_gray>",
|
||||
"comment.comment_removed_failure": "<prefix><red>Failed to delete comment!</red>",
|
||||
"comment.comment_added": "<prefix><dark_aqua>A comment has been left.</dark_aqua>",
|
||||
"comment.inbox_empty": "<prefix><gray>No comments.</gray>",
|
||||
@ -160,7 +160,6 @@
|
||||
"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_list": "<prefix><dark_aqua>Saved Schematics: </dark_aqua><gold><list></gold>",
|
||||
"schematics.schematic_road_created": "<prefix><gold>Saved new road schematic. To test the schematic, fly to a few other plots and run /plot debugroadregen.</gold>",
|
||||
"schematics.mca_file_size": "<prefix><gold>Note: The `.mca` files are 512x512.</gold>",
|
||||
"schematics.schematic_exportall_started": "<prefix><gold>Starting export...</gold>",
|
||||
"schematics.schematic_exportall_world_args": "<prefix><gold>Need world argument. Use </gold><dark_gray>/plot sch exportall area</dark_gray>",
|
||||
@ -267,10 +266,25 @@
|
||||
"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>",
|
||||
"debugexec.cancelling_task": "<prefix><red>Task cancelled.</red>",
|
||||
"debugexec.task_cancelled": "<prefix><gold>Task cancelled.</gold>",
|
||||
"debugexec.cleared_flag": "<prefix><gold>Cleared flag: </gold><dark_aqua><value></dark_aqua>",
|
||||
"debugexec.mass_schematic_update_in_progress": "<prefix><red>Cannot schedule mass schematic update. (Is one already in progress?)</red>",
|
||||
"debugexec.task_not_running": "<prefix><gray>Task not running.</gray>",
|
||||
"debugexec.expiry_started": "<prefix><gold>Started plot expiry task.</gold>",
|
||||
"debugexec.expiry_already_started": "<prefix><gold>Plot expiry task already started.</gold>",
|
||||
|
||||
"debugimportworlds.single_plot_area": "<prefix><red>Must be a single plot area.</red>",
|
||||
"debugimportworlds.world_container": "<prefix><red>World container must be configured to be a separate directory to your base files.</red>",
|
||||
"debugimportworlds.done": "<prefix><gold>Done!</gold>",
|
||||
|
||||
"debugroadregen.regen_done": "<prefix><gold>Regenerating plot south/east roads: </gold><gray><value></gray>\n<gold> - Result: </gold><green>Success!</green",
|
||||
"debugroadregen.regen_all": "<prefix><green>To regen all roads: </green><gold><value></gold>",
|
||||
"schematics.schematic_road_created": "<prefix><gold>Saved new road schematic. To test the schematic, fly to a few other plots and run /plot debugroadregen.</gold>",
|
||||
"debugroadregen.schematic": "<prefix><red>If no schematic is set, the following will not do anything.</red>\n<gray> - To set a schematic, stand in a plot and use </gray><red>/plot createroadschematic</red>",
|
||||
"debugroadregen.regenallroads": "<prefix><red>To regenerate all roads: /plot regenallroads</red>",
|
||||
|
||||
"errors.invalid_player": "<prefix><red>Player not found: <gray><value></gray>.</red>",
|
||||
|
||||
"errors.invalid_player_offline": "<prefix><red>The player must be online: <gray><player></gray>.</red>",
|
||||
"errors.invalid_command_flag": "<prefix><red>Invalid command flag: </red><value></gray>",
|
||||
"errors.error": "<prefix><red>An error occurred: </gray><value></gray></red>",
|
||||
@ -289,8 +303,13 @@
|
||||
"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>",
|
||||
"error.plot_size": "<prefix><red>Error: size <= 0.</red>",
|
||||
"error.command_went_wrong": "<prefix><red>Something went wrong when executing that command...</red>",
|
||||
|
||||
"debugpaste.debug_report_created": "<prefix><gold>Uploaded a full debug to: <gray><url></gray>",
|
||||
"debugpaste.creation_failed": "<prefix><red>Failed to create the debugpaste: </red><gray><value></gray>",
|
||||
|
||||
"debugsavetest.starting": "<prefix><gold>Starting debugsavetest.</gold>",
|
||||
"debugsavetest.done": "<prefix><gold>Database sync finished..</gold>",
|
||||
|
||||
"purge.purge_success": "<prefix><dark_aqua>Successfully purged <amount> plots.</dark_aqua>",
|
||||
|
||||
@ -326,7 +345,7 @@
|
||||
"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_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><red>You cannot view the information about this plot.</red>",
|
||||
"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_trusted": "<gold>Trusted:</gold><gray><trusted></gray>",
|
||||
@ -607,11 +626,27 @@
|
||||
"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>"
|
||||
"commands.description.debugexec": "<gray>Multi-purpose debug command.</gray>",
|
||||
"commands.description.debugimportworlds": "<gray>Import worlds by player name.</gray>",
|
||||
"commands.description.debugloadtest": "<gray>This debug command will force the reload of all plots in the database.</gray>",
|
||||
"commands.description.debugpaste": "<gray>Upload settings.yml, worlds.yml, your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste</gray>",
|
||||
"commands.description.debugroadregen": "<gray>Regenerate roads in the plot or region the user is, based on the road schematic.</gray>",
|
||||
"commands.description.debugsavetest": "<gray>This command will force the recreation of all plots in the database.</gray>",
|
||||
"commands.description.delete": "<gray>Delete the plot you stand on.</gray>",
|
||||
"commands.description.deny": "<gray>Deny a user from entering a plot.</gray>",
|
||||
"commands.description.desc": "<gray>Set the plot description.</gray>",
|
||||
"commands.description.dislike": "<gray>Dislike the plot.</gray>",
|
||||
"commands.description.done": "<gray>Continue a plot that was previously marked as done.</gray>",
|
||||
"commands.description.download": "<gray>Download your plot.</gray>",
|
||||
"commands.description.flags": "<gray>Manage plot flags.</gray>",
|
||||
"commands.description.grant": "<gray>Manage plot grants.</gray>",
|
||||
"commands.description.help": "<gray>Get this help menu.</gray>",
|
||||
"commands.description.home": "<gray>Teleport to your plot(s).</gray>",
|
||||
"commands.description.inbox": "<gray>Review the comments for a plot.</gray>",
|
||||
"commands.description.info": "<gray>Display information about the plot.</gray>"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user