Remove old translation setup and move commands to templates

This commit is contained in:
N0tMyFaultOG 2020-08-13 21:11:07 +02:00
parent 2b17f730d4
commit c9fae6a070
12 changed files with 43 additions and 38 deletions

View File

@ -218,14 +218,6 @@ public class PlotSquared {
copyFile("town.template", Settings.Paths.TEMPLATES);
copyFile("bridge.template", Settings.Paths.TEMPLATES);
copyFile("skyblock.template", Settings.Paths.TEMPLATES);
copyFile("de-DE.yml", Settings.Paths.TRANSLATIONS);
copyFile("es-ES.yml", Settings.Paths.TRANSLATIONS);
copyFile("zh-CN.yml", Settings.Paths.TRANSLATIONS);
copyFile("it-IT.yml", Settings.Paths.TRANSLATIONS);
copyFile("ko-KR.yml", Settings.Paths.TRANSLATIONS);
copyFile("hu-HU.yml", Settings.Paths.TRANSLATIONS);
copyFile("pt-BR.yml", Settings.Paths.TRANSLATIONS);
copyFile("fr-FR.yml", Settings.Paths.TRANSLATIONS);
showDebug();
} catch (Throwable e) {
e.printStackTrace();
@ -1314,7 +1306,6 @@ public class PlotSquared {
* Setup all configuration files<br>
* - Config: settings.yml<br>
* - Storage: storage.yml<br>
* - Translation: PlotSquared.use_THIS.yml, style.yml<br>
*/
public boolean setupConfigs() {
File folder = new File(this.platform.getDirectory(), "config");

View File

@ -143,7 +143,8 @@ public class Area extends SubCommand {
return false;
}
if (args.length < 2) {
player.sendMessage(TranslatableCaption.of("single.single_area_needs_name"));
player.sendMessage(TranslatableCaption.of("single.single_area_needs_name"),
Template.of("command", "/plot area single <name>"));
return false;
}
final PlotArea existingArea =
@ -305,7 +306,8 @@ public class Area extends SubCommand {
player.sendMessage(TranslatableCaption.of("set.set_attribute"),
Template.of("attribute", "area_pos1"),
Template.of("value", location.getX() + "," + location.getZ()));
player.sendMessage(TranslatableCaption.of("area.set_pos2"));
player.sendMessage(TranslatableCaption.of("area.set_pos2"),
Template.of("command", "/plot area create pos2"));
return true;
}
case "pos2": // Set position 2 and finish creation for type=2 (partial)

View File

@ -57,7 +57,8 @@ public class CmdConfirm {
if (commandStr != null) {
player.sendMessage(
TranslatableCaption.of("confirm.requires_confirm"),
Template.of("command", commandStr)
Template.of("command", commandStr),
Template.of("value", "/plot confirm")
);
}
TaskManager.runTaskLater(() -> {

View File

@ -51,6 +51,7 @@ public class Comment extends SubCommand {
if (args.length < 2) {
player.sendMessage(
TranslatableCaption.of("comment.comment_syntax"),
Template.of("command", "/plot comment [X;Z]"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
);
return false;
@ -70,6 +71,7 @@ public class Comment extends SubCommand {
if (args.length < 3) {
player.sendMessage(
TranslatableCaption.of("comment.comment_syntax"),
Template.of("command", "/plot comment [X;Z]"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
);
return false;
@ -81,6 +83,7 @@ public class Comment extends SubCommand {
if (inbox == null) {
player.sendMessage(
TranslatableCaption.of("comment.comment_syntax"),
Template.of("command", "/plot comment [X;Z]"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
);
return false;
@ -100,6 +103,7 @@ public class Comment extends SubCommand {
player.sendMessage(TranslatableCaption.of("comment.no_plot_inbox"));
player.sendMessage(
TranslatableCaption.of("comment.comment_syntax"),
Template.of("command", "/plot comment [X;Z]"),
Template.of("list", StringMan.join(CommentManager.inboxes.keySet(), "|"))
);
return false;

View File

@ -32,6 +32,7 @@ import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
@ -61,7 +62,8 @@ public class CreateRoadSchematic extends SubCommand {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
}
this.hybridUtils.setupRoadSchematic(plot);
player.sendMessage(TranslatableCaption.of("schematics.schematic_road_created"));
player.sendMessage(TranslatableCaption.of("schematics.schematic_road_created"),
Template.of("command", "/plot debugroadregen"));
return true;
}
}

View File

@ -143,8 +143,10 @@ public class DebugRoadRegen extends SubCommand {
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
return true;
}
player.sendMessage(TranslatableCaption.of("debugroadregen.schematic"));
player.sendMessage(TranslatableCaption.of("debugroadregen.regenallroads"));
player.sendMessage(TranslatableCaption.of("debugroadregen.schematic"),
Template.of("command", "/plot createroadschematic"));
player.sendMessage(TranslatableCaption.of("debugroadregen.regenallroads"),
Template.of("command", "/plot regenallroads"));
boolean result = this.hybridUtils.scheduleSingleRegionRoadUpdate(plot, height);
if (!result) {
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress"));

View File

@ -100,7 +100,10 @@ public class Load extends SubCommand {
List<String> schematics = metaDataAccess.get().orElse(null);
if (schematics == null) {
// No schematics found:
player.sendMessage(TranslatableCaption.of("web.load_null"));
player.sendMessage(
TranslatableCaption.of("web.load_null"),
Template.of("command", "/plot load")
);
return false;
}
String schematic;
@ -201,7 +204,10 @@ public class Load extends SubCommand {
e.printStackTrace();
}
}
player.sendMessage(TranslatableCaption.of("web.load_list"));
player.sendMessage(
TranslatableCaption.of("web.load_list"),
Template.of("command", "/plot load #")
);
}
}

View File

@ -93,9 +93,8 @@ public class RegenAllRoads extends SubCommand {
return false;
}
//Set<BlockVector2> chunks = ChunkManager.manager.getChunkChunks(name);
player.sendMessage(TranslatableCaption.of("debugroadregen.schematic"));
//MainUtil.sendMessage(player, "&6Potential chunks to update: &7" + (chunks.size() * 1024));
//MainUtil.sendMessage(player, "&6Estimated time: &7" + chunks.size() + " seconds");
player.sendMessage(TranslatableCaption.of("debugroadregen.schematic"),
Template.of("command", "/plot createroadschematic"));
boolean result = this.hybridUtils.scheduleRoadUpdate(area, height);
if (!result) {
player.sendMessage(TranslatableCaption.of("debugexec.mass_schematic_update_in_progress"));

View File

@ -409,7 +409,6 @@ public class Settings extends Config {
public static String SCHEMATICS = "schematics";
public static String SCRIPTS = "scripts";
public static String TEMPLATES = "templates";
public static String TRANSLATIONS = "translations";
}

View File

@ -45,6 +45,7 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
import com.sk89q.worldedit.util.eventbus.Subscribe;
import com.sk89q.worldedit.world.World;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.Set;
@ -91,7 +92,8 @@ public class WESubscriber {
mask = WEManager.getMask(plotPlayer);
if (mask.isEmpty()) {
if (Permissions.hasPermission(plotPlayer, "plots.worldedit.bypass")) {
plotPlayer.sendMessage(TranslatableCaption.of("worldedit.worldedit_bypass"));
plotPlayer.sendMessage(TranslatableCaption.of("worldedit.worldedit_bypass"),
Template.of("command", "/plot wea"));
}
if (this.plotAreaManager.hasPlotArea(world)) {
event.setExtent(new NullExtent());

View File

@ -75,7 +75,8 @@ import java.util.concurrent.atomic.AtomicInteger;
player.sendTitle(
StaticCaption.of(""),
TranslatableCaption.of("comment.inbox_notification"),
Template.of("amount", Integer.toString(total))
Template.of("amount", Integer.toString(total)),
Template.of("command", "/plot inbox")
);
}
}

View File

@ -1,7 +1,7 @@
{
"confirm.expired_confirm": "<prefix><red>Confirmation has expired, please run the command again!</red>",
"confirm.failed_confirm": "<prefix><red>You have no pending actions to confirm!</red>",
"confirm.requires_confirm": "<prefix><gray>Are you sure you wish to execute: </gray><gold><command></orange><gray>?</gray>\n<red>This cannot be undone! If you are sure: </red><gray>/plot confirm</gray>",
"confirm.requires_confirm": "<prefix><gray>Are you sure you wish to execute: </gray><gold><command></orange><gray>?</gray>\n<red>This cannot be undone! If you are sure: </red><gray><value></gray>",
"move.move_success": "<prefix><dark_aqua>Successfully moved plot.</dark_aqua>",
"move.move_merged": "<prefix><red>Merged plots may not be moved. Please unmerge the plot before performing the move.</red>",
@ -21,14 +21,14 @@
"set.set_attribute": "<prefix><dark_aqua>Successfully set <attribute> to <value>.</dark_aqua>",
"area.set_pos2": "You will now set pos2: /plot area create pos2. Note: The chosen plot size may result in the created area not exactly matching your second position.",
"area.set_pos2": "You will now set pos2: <command>. Note: The chosen plot size may result in the created area not exactly matching your second position.",
"web.generating_link": "<prefix><gold>Processing plot...</gold>",
"web.generating_link_failed": "<prefix><red>Failed to generate download link!</red>",
"web.save_failed": "<prefix><red>Failed to save.</red>",
"web.load_null": "<prefix><gray>Please use </gray><dark_aqua>/plot load </dark_aqua><gray>to get a list of schematics.</gray>",
"web.load_null": "<prefix><gray>Please use </gray><dark_aqua><command> </dark_aqua><gray>to get a list of schematics.</gray>",
"web.load_failed": "<prefix><red>Failed to load schematic.</red>",
"web.load_list": "<prefix><gray>To load a schematic, use </gray><gold>/plot load #</gold><gray>.</gray>",
"web.load_list": "<prefix><gray>To load a schematic, use </gray><gold><command</gold><gray>.</gray>",
"web.save_success": "<prefix><gold>Successfully saved!</gold>",
"compass.compass_target": "<prefix><dark_aqua>Successfully targeted plot with your compass.</dark_aqua>",
@ -60,7 +60,7 @@
"border.border": "<prefix><gray>You are outside the current map border.</gray>",
"worldedit.worldedit_bypass": "<prefix><gray><italic>To bypass your restrictions use </gray><dark_aqua>/plot wea</dark_aqua></italic>",
"worldedit.worldedit_bypass": "<prefix><gray><italic>To bypass your restrictions use </gray><dark_aqua><command></dark_aqua></italic>",
"worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>",
"gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray><gamemode></gray><gold>) <gold>set for </gold><gray><plot>.</gray>",
@ -74,10 +74,10 @@
"swap.swap_success": "<prefix><dark_aqua>Successfully swapped plots.</dark_aqua>",
"swap.swap_merged": "<prefix><red>Merged plots may not be swapped. Please unmerge the plots before performing the swap.</red>",
"comment.inbox_notification": "<prefix><dark_aqua><amount> </dark_aqua><gray>unread messages. Use /plot inbox.</gray>",
"comment.inbox_notification": "<prefix><dark_aqua><amount> </dark_aqua><gray>unread messages. Use <command>.</gray>",
"comment.not_valid_inbox_index": "<prefix><gray>No comment at index <number>.</gray>",
"comment.inbox_item": "<gray> - </gray><dark_aqua><value></dark_aqua>",
"comment.comment_syntax": "<prefix><gray>Use /plot comment [X;Z] <<list>> <comment></gray>",
"comment.comment_syntax": "<prefix><gray>Use <command> <<list>> <comment></gray>",
"comment.invalid_inbox": "<prefix><gray>That is not a valid inbox.</gray>\n<gold>Accepted values: <list></gold>",
"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>",
@ -129,7 +129,6 @@
"setup.setup_not_started": "<prefix><gold>No setup started.</gold>",
"setup.setup_init": "<prefix><gold>Usage: </gold><gray>/plot setup </gray><value>",
"setup.setup_step": "<gold><dark_gray>[</dark_gray>Step <step><dark_gray>]</dark_gray> <description> <gray>-</gray> Expecting: <gray><type></gray> Default: <gray><value></gray></gold>",
"setup.setup_invalid_arg": "<prefix><gray><value> is not a valid argument for step <step>. To cancel setup use: </gray><gold>/plot setup cancel.</gold>",
"setup.setup_valid_arg": "<prefix><gray>Value </gray><gold><description></gold> <gray>set to <value>.</gray>",
"setup.setup_finished": "<prefix><dark_aqua>You should have been teleported to the created world. Otherwise you will need to set the generator manually using the bukkit.yml or your chosen world management plugin.</dark_aqua>",
"setup.setup_world_taken": "<prefix><gray><value> </gray><red>is already a world. Choose a different name.</red>",
@ -292,9 +291,9 @@
"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>",
"schematics.schematic_road_created": "<prefix><gold>Saved new road schematic. To test the schematic, fly to a few other plots and run <command>.</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><command></red>",
"debugroadregen.regenallroads": "<prefix><red>To regenerate all roads: <command></red>",
"errors.invalid_player": "<prefix><red>Player not found: </red><gray><value></gray><red>.</red>",
"errors.invalid_player_offline": "<prefix><gray><player></gray><red> must be online.</red>",
@ -462,13 +461,11 @@
"events.event_denied": "<prefix><gold><value> </gold><gray>Cancelled by external plugin.</gray>",
"backups.backup_usage": "<prefix><gold>Usage: </gold><gray>/plot backup save/list/load</gray>",
"backups.backup_impossible": "<prefix><gray>Backups are not enabled for this plot: <plot>.</gray>",
"backups.backup_save_success": "<prefix><gold>The backup was created successfully.</gold>",
"backups.backup_save_failed": "<prefix><red>The backup could not be created: </red><gray><reason></gray>",
"backups.backup_load_success": "<prefix><gold>The backup was restored successfully.</gold>",
"backups.backup_load_failure": "<prefix><red>The backup could not be restored: </red><gray><reason></gray>",
"backups.backup_load_usage": "<prefix><gold>Usage: </gold><gray>/plot backup load [#]</gray>",
"backups.backup_list_header": "<prefix><gold>Available backups for plot <gray><plot></gray></gold>",
"backups.backup_list_entry": "<prefix><dark_gray>- </dark_gray><gold>#<number> </gold><gray><value></gray>",
"backups.backup_list_failed": "<prefix><red>Backup listing failed: </red><gray><reason></gray>",
@ -489,7 +486,7 @@
"single.single_area_missing_selection": "<prefix><red>Error! You need to select a square region.</red>",
"single.single_area_not_square": "<prefix><red>Error! Your selection needs to be a square.</red>",
"single.single_area_overlapping": "<prefix><red>Error! Your selection overlaps with an existing plot area.</red>",
"single.single_area_needs_name": "<prefix><red>Error! Please specify a plot name: /plot area single <name></red>",
"single.single_area_needs_name": "<prefix><red>Error! Please specify a plot name: <command></red>",
"single.single_area_name_taken": "<prefix><red>Error! The plot name is already taken.</red>",
"single.single_area_failed_to_save": "<prefix><red>Error! Failed to save the area schematic.</red>",
"single.single_area_could_not_make_directories": "<prefix><red>Error! Failed to create the schematic directory.</red>",
@ -632,7 +629,6 @@
"flags.flag_error_gamemode": "<prefix><red>Flag value must be a gamemode: 'survival', 'creative', 'adventure' or 'spectator.</red>",
"flags.flag_error_integer": "<prefix><red>Flag value must be a whole number.</red>",
"flags.flag_error_integer_list": "<prefix><red>Flag value must be an integer list.</red>",
"flags.flag_error_internal": "<prefix><red>Value(s) must be numeric. /plot set flag <flag> <interval> [amount].</red>",
"flags.flag_error_keep": "<prefix><red>Flag value must be a timestamp or a boolean.</red>",
"flags.flag_error_long": "<prefix><red>Flag value must be a whole number (large numbers allowed).</red>",
"flags.flag_error_plotblocklist": "<prefix><red>Flag value must be a block list.</red>",