mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
More json stuff
This commit is contained in:
parent
47d9895077
commit
fabb9b6fd7
@ -177,7 +177,11 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.sendMessage(StaticCaption.of("Skipping duplicate plot: " + plot + " | id=" + plot.temp));
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("database.skipping_duplicated_plot"),
|
||||||
|
Template.of("plot", String.valueOf(plot)),
|
||||||
|
Template.of("id", String.valueOf(plot.temp))
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plot.setArea(pa);
|
plot.setArea(pa);
|
||||||
@ -224,17 +228,17 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
player.sendMessage(TranslatableCaption.of("database.failed_to_save_plots"));
|
player.sendMessage(TranslatableCaption.of("database.failed_to_save_plots"));
|
||||||
player.sendMessage(StaticCaption.of(("=== Begin of stacktrace. ===")));
|
player.sendMessage(TranslatableCaption.of(("errors.stacktrace_begin")));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage(StaticCaption.of(("=== End of stacktrace. ===")));
|
player.sendMessage(TranslatableCaption.of(("errors.stacktrace_end")));
|
||||||
player.sendMessage(TranslatableCaption.of("database.invalid_args"));
|
player.sendMessage(TranslatableCaption.of("database.invalid_args"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
player.sendMessage(TranslatableCaption.of("database.failed_to_open"));
|
player.sendMessage(TranslatableCaption.of("database.failed_to_open"));
|
||||||
player.sendMessage(StaticCaption.of(("=== Begin of stacktrace. ===")));
|
player.sendMessage(TranslatableCaption.of(("errors.stacktrace_begin")));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage(StaticCaption.of(("=== End of stacktrace. ===")));
|
player.sendMessage(TranslatableCaption.of(("errors.stacktrace_end")));
|
||||||
player.sendMessage(TranslatableCaption.of("database.invalid_args"));
|
player.sendMessage(TranslatableCaption.of("database.invalid_args"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,10 @@ public class Debug extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||||
|
if (args.length == 0 ) {
|
||||||
|
player.sendMessage(StaticCaption.of("commandconfig.command_syntax"),
|
||||||
|
Template.of("value", "/plot debug <loadedchunks | debug-players | logging | entitytypes | msg>"));
|
||||||
|
}
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if ("player".equalsIgnoreCase(args[0])) {
|
if ("player".equalsIgnoreCase(args[0])) {
|
||||||
for (Map.Entry<String, Object> meta : player.getMeta().entrySet()) {
|
for (Map.Entry<String, Object> meta : player.getMeta().entrySet()) {
|
||||||
|
@ -230,7 +230,10 @@ public class DebugExec extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("debugexec.starting_task"));
|
player.sendMessage(TranslatableCaption.of("debugexec.starting_task"));
|
||||||
this.hybridUtils.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
|
this.hybridUtils.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
|
||||||
@Override public void run(PlotAnalysis value) {
|
@Override public void run(PlotAnalysis value) {
|
||||||
player.sendMessage(StaticCaption.of("&6Done: &7Use &6/plot debugexec analyze &7for more information."));
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("debugexec.analyze_done"),
|
||||||
|
Template.of("command", "/plot debugexec analyze")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
@ -422,7 +425,7 @@ public class DebugExec extends SubCommand {
|
|||||||
message.set(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
|
message.set(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
|
||||||
.parse(TranslatableCaption.of("debugexec.script_list_item").getComponent(player), numTemplate, nameTemplate))));
|
.parse(TranslatableCaption.of("debugexec.script_list_item").getComponent(player), numTemplate, nameTemplate))));
|
||||||
}
|
}
|
||||||
}, "/plot debugexec list-scripts", StaticCaption.of("List of scripts"));
|
}, "/plot debugexec list-scripts", TranslatableCaption.of("scripts.script_list"));
|
||||||
return true;
|
return true;
|
||||||
case "all":
|
case "all":
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
@ -458,12 +461,12 @@ public class DebugExec extends SubCommand {
|
|||||||
} catch (ScriptException e) {
|
} catch (ScriptException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logger.info("[P2] > {}ms -> {}", System.currentTimeMillis() - start, result);
|
logger.info("[P2] {}ms -> {}", System.currentTimeMillis() - start, result);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
Object result = this.engine.eval(script, this.scope);
|
Object result = this.engine.eval(script, this.scope);
|
||||||
logger.info("[P2] > {}ms -> {}", System.currentTimeMillis() - start, result);
|
logger.info("[P2] {}ms -> {}", System.currentTimeMillis() - start, result);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (ScriptException e) {
|
} catch (ScriptException e) {
|
||||||
|
@ -146,25 +146,30 @@ public class DebugPaste extends SubCommand {
|
|||||||
final File logFile =
|
final File logFile =
|
||||||
new File(PlotSquared.platform().getDirectory(), "../../logs/latest.log");
|
new File(PlotSquared.platform().getDirectory(), "../../logs/latest.log");
|
||||||
if (Files.size(logFile.toPath()) > 14_000_000) {
|
if (Files.size(logFile.toPath()) > 14_000_000) {
|
||||||
throw new IOException("Too big...");
|
throw new IOException("The latest.log is larger than 14MB. Please reboot your server and submit a new paste.");
|
||||||
}
|
}
|
||||||
incendoPaster
|
incendoPaster
|
||||||
.addFile(new IncendoPaster.PasteFile("latest.log", readFile(logFile)));
|
.addFile(new IncendoPaster.PasteFile("latest.log", readFile(logFile)));
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
player.sendMessage(StaticCaption.of("&clatest.log is too big to be pasted, please reboot your server and submit a new paste."));
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("debugpaste.latest_log"),
|
||||||
|
Template.of("file", "latest.log"),
|
||||||
|
Template.of("size", "14MB"));
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
player.sendMessage(StaticCaption.of("<red>Skipping settings.yml because it's empty.</red>"));
|
player.sendMessage(TranslatableCaption.of("debugpaste.empty_file"),
|
||||||
|
Template.of("file", "settings.yml"));
|
||||||
}
|
}
|
||||||
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) {
|
||||||
player.sendMessage(StaticCaption.of("<red>Skipping worlds.yml because it's empty.</red>"));
|
player.sendMessage(TranslatableCaption.of("debugpaste.empty_file"),
|
||||||
|
Template.of("file", "worlds.yml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -173,7 +178,8 @@ 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) {
|
||||||
player.sendMessage(StaticCaption.of("<red>Skipping Multiverse world's.yml because Multiverse is not in use.</red>"));
|
player.sendMessage(TranslatableCaption.of("debugpaste.skip_multiverse"),
|
||||||
|
Template.of("file", "worlds.yml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -57,7 +57,7 @@ public class Music extends SubCommand {
|
|||||||
private static final Collection<String> DISCS = Arrays
|
private static final Collection<String> DISCS = Arrays
|
||||||
.asList("music_disc_13", "music_disc_cat", "music_disc_blocks", "music_disc_chirp",
|
.asList("music_disc_13", "music_disc_cat", "music_disc_blocks", "music_disc_chirp",
|
||||||
"music_disc_far", "music_disc_mall", "music_disc_mellohi", "music_disc_stal",
|
"music_disc_far", "music_disc_mall", "music_disc_mellohi", "music_disc_stal",
|
||||||
"music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait");
|
"music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait", "music_disc_pigstep");
|
||||||
|
|
||||||
private final InventoryUtil inventoryUtil;
|
private final InventoryUtil inventoryUtil;
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ public class Music extends SubCommand {
|
|||||||
// Always add the cancel button
|
// Always add the cancel button
|
||||||
// if (player.getMeta("music") != null) {
|
// if (player.getMeta("music") != null) {
|
||||||
String name = "<gold>Cancel music</gold>";
|
String name = "<gold>Cancel music</gold>";
|
||||||
String[] lore = {"<red>Click to cancel!<reset>"};
|
String[] lore = {"<red>Click to remove the music!<reset>"};
|
||||||
inv.setItem(index, new PlotItemStack("bedrock", 1, name, lore));
|
inv.setItem(index, new PlotItemStack("bedrock", 1, name, lore));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ public class ComponentPresetManager {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
final List<ComponentPreset> defaultPreset = Collections.singletonList(
|
final List<ComponentPreset> defaultPreset = Collections.singletonList(
|
||||||
new ComponentPreset(ClassicPlotManagerComponent.FLOOR, "##wool", 0, "", "&6D&ai&cs&ec&bo &2F&3l&do&9o&4r",
|
new ComponentPreset(ClassicPlotManagerComponent.FLOOR, "##wool", 0, "", "<gold>D</gold><green>i</green><red>s</red><yellow>c</yellow><aqua>o</aqua><dark_green> F</dark_green><dark_aqua>l</dark_aqua><light_purple>o</light_purple><blue>o</blue><dark_red>r</dark_red>",
|
||||||
Arrays.asList("<gold>Spice up your plot floor</gold>"), ItemTypes.YELLOW_WOOL));
|
Arrays.asList("<gold>Spice up your plot floor</gold>"), ItemTypes.YELLOW_WOOL));
|
||||||
yamlConfiguration.set("presets", defaultPreset.stream().map(ComponentPreset::serialize).collect(Collectors.toList()));
|
yamlConfiguration.set("presets", defaultPreset.stream().map(ComponentPreset::serialize).collect(Collectors.toList()));
|
||||||
try {
|
try {
|
||||||
|
@ -264,6 +264,7 @@
|
|||||||
"database.failed_to_save_plots": "<prefix><red>Failed to save plots, read stacktrace for info.</red>",
|
"database.failed_to_save_plots": "<prefix><red>Failed to save plots, read stacktrace for info.</red>",
|
||||||
"database.invalid_args": "<prefix><red>Please make sure you are using the correct arguments.</red>",
|
"database.invalid_args": "<prefix><red>Please make sure you are using the correct arguments.</red>",
|
||||||
"database.failed_to_open": "<prefix><red>Failed to open connection, read stacktrace for info.</red>",
|
"database.failed_to_open": "<prefix><red>Failed to open connection, read stacktrace for info.</red>",
|
||||||
|
"database.skipping_duplicated_plot": "<prefix><red>Skipping duplicate plot: </red><gray><plot></gray><red> | ID: </red><gray><id></gray>",
|
||||||
|
|
||||||
"template.invalid_template": "<prefix><red>Invalid template file: </red><gray><value>.template</gray>",
|
"template.invalid_template": "<prefix><red>Invalid template file: </red><gray><value>.template</gray>",
|
||||||
"template.template_failed": "<prefix><red>Failed: </red><gray><value></gray>",
|
"template.template_failed": "<prefix><red>Failed: </red><gray><value></gray>",
|
||||||
@ -272,7 +273,7 @@
|
|||||||
"debugexec.starting_task": "<prefix><gold>Starting task...</gold>",
|
"debugexec.starting_task": "<prefix><gold>Starting task...</gold>",
|
||||||
"debugexec.threshold_default": "<prefix><gray>`threshold` = The percentage of plots you want to clear (100 clears 100% of plots so no point calibrating it.</gray>",
|
"debugexec.threshold_default": "<prefix><gray>`threshold` = The percentage of plots you want to clear (100 clears 100% of plots so no point calibrating it.</gray>",
|
||||||
"debugexec.invalid_threshold": "<prefix><red>Invalid threshold: </red><gray><value></gray>",
|
"debugexec.invalid_threshold": "<prefix><red>Invalid threshold: </red><gray><value></gray>",
|
||||||
"debugexec.threshold_default_double": "<prefix><gray>$1<threshold> $2= $1The percentage of plots you want to clear as a number between 0 - 100.</gray>",
|
"debugexec.threshold_default_double": "<prefix><gray><gold><threshold> </gold><gray>= </gray><gold>The percentage of plots you want to clear as a number between 0 - 100.</gold>",
|
||||||
"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.cancelling_task": "<prefix><red>Task cancelled.</red>",
|
||||||
@ -283,6 +284,7 @@
|
|||||||
"debugexec.expiry_started": "<prefix><gold>Started plot expiry task.</gold>",
|
"debugexec.expiry_started": "<prefix><gold>Started plot expiry task.</gold>",
|
||||||
"debugexec.expiry_already_started": "<prefix><gold>Plot expiry task already started.</gold>",
|
"debugexec.expiry_already_started": "<prefix><gold>Plot expiry task already started.</gold>",
|
||||||
"debugexec.script_list_item": "<dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray><gold> <name></gold>",
|
"debugexec.script_list_item": "<dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray><gold> <name></gold>",
|
||||||
|
"debugexec.analyze_done": "<prefix><gold>Done. Use </gold><gray><command></gray><gold> for more information. ",
|
||||||
|
|
||||||
"expiry.expired_options_clicky": "<gold><num> <are_or_is> expired: </gold><click:run_command:<list_cmd>><hover:show_text:<list_cmd>><gray><plot></gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_del>><hover:show_text:<cmd_del>><gray>Delete this (<cmd_del>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_keep_1d>><hover:show_text:<cmd_keep_1d>><gray>Remind later (<cmd_keep_1d>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_keep>><hover:show_text:<cmd_keep>><gray>Keep this (<cmd_keep>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_no_show_expir>><hover:show_text:<cmd_no_show_expir>><gray>Don't show me this (<cmd_no_show_expir>)</gray></hover></click>",
|
"expiry.expired_options_clicky": "<gold><num> <are_or_is> expired: </gold><click:run_command:<list_cmd>><hover:show_text:<list_cmd>><gray><plot></gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_del>><hover:show_text:<cmd_del>><gray>Delete this (<cmd_del>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_keep_1d>><hover:show_text:<cmd_keep_1d>><gray>Remind later (<cmd_keep_1d>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_keep>><hover:show_text:<cmd_keep>><gray>Keep this (<cmd_keep>)</gray></hover></click>\n<dark_gray> - </dark_gray><click:run_command:<cmd_no_show_expir>><hover:show_text:<cmd_no_show_expir>><gray>Don't show me this (<cmd_no_show_expir>)</gray></hover></click>",
|
||||||
|
|
||||||
@ -317,7 +319,12 @@
|
|||||||
"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>",
|
"error.command_went_wrong": "<prefix><red>Something went wrong when executing that command.</red>",
|
||||||
"errors.not_implemented": "<prefix><red>Not implemented.</red>",
|
"errors.not_implemented": "<prefix><red>Not implemented.</red>",
|
||||||
|
"errors.stacktrace_begin": "<red>=== Begin of stacktrace ===</red>",
|
||||||
|
"errors.stacktrace_end": "<red>=== End of stacktrace ===</red>",
|
||||||
|
|
||||||
|
"debugpaste.latest_log": "<red><file> is larger than <size>. Please reboot the server and submit a new paste.",
|
||||||
|
"debugpaste.empty_file": "<red>Skipping <file> because it's empty.",
|
||||||
|
"debugpaste.skip_multiverse": "<red>Skipping Multiverse <file> because it's not in use.",
|
||||||
"debugpaste.debug_report_created": "<prefix><gold>Uploaded a full debug to: </gold><gray><click:open_url:<url>><url></click></gray>",
|
"debugpaste.debug_report_created": "<prefix><gold>Uploaded a full debug to: </gold><gray><click:open_url:<url>><url></click></gray>",
|
||||||
"debugpaste.creation_failed": "<prefix><red>Failed to create the debugpaste: </red><gray><value></gray>",
|
"debugpaste.creation_failed": "<prefix><red>Failed to create the debugpaste: </red><gray><value></gray>",
|
||||||
|
|
||||||
@ -352,6 +359,8 @@
|
|||||||
|
|
||||||
"near.plot_near": "<prefix><gold>Players: <gray><list></gray></gold>",
|
"near.plot_near": "<prefix><gold>Players: <gray><list></gray></gold>",
|
||||||
|
|
||||||
|
"scripts.script_list": "<dark_gray><strikethrough>--------- <reset><gold>SCRIPTS </gold><dark_gray><strikethrough>---------</dark_gray><reset>",
|
||||||
|
|
||||||
"info.none": "<gray>None</gray>",
|
"info.none": "<gray>None</gray>",
|
||||||
"info.now": "<gray>Now</gray>",
|
"info.now": "<gray>Now</gray>",
|
||||||
"info.never": "<gray>Never</gray>",
|
"info.never": "<gray>Never</gray>",
|
||||||
@ -521,7 +530,7 @@
|
|||||||
"flag.flag_partially_removed": "<prefix><dark_aqua>Successfully removed flag value(s).</dark_aqua>",
|
"flag.flag_partially_removed": "<prefix><dark_aqua>Successfully removed flag value(s).</dark_aqua>",
|
||||||
"flag.flag_added": "<prefix><dark_aqua>The flag has been added successfully.</dark_aqua>",
|
"flag.flag_added": "<prefix><dark_aqua>The flag has been added successfully.</dark_aqua>",
|
||||||
"flag.flag_list_see_info": "<prefix><gray>Click to view information about the flag.</gray>",
|
"flag.flag_list_see_info": "<prefix><gray>Click to view information about the flag.</gray>",
|
||||||
"flag.flag_parse_error": "<red>Failed to parse flag </red><gray><flag_name><red>, value </red><gray><flag_value></gray><red>: <error></red>",
|
"flag.flag_parse_error": "<red>Failed to parse flag </red><gray><flag_name></gray><red>, value </red><gray><flag_value></gray><red>Error: <error></red>",
|
||||||
"flag.flag_info_header": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
|
"flag.flag_info_header": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
|
||||||
"flag.flag_info_footer": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
|
"flag.flag_info_footer": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",
|
||||||
"flag.flag_list_categories": "<gold><category>: </gold>",
|
"flag.flag_list_categories": "<gold><category>: </gold>",
|
||||||
|
Loading…
Reference in New Issue
Block a user