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