From ae11f0610e9215ff74ec34e1b9ce3fca87ba0c7d Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Sat, 9 May 2020 16:45:32 +0200 Subject: [PATCH] Add a few more translation strings for setup wizard --- .../com/plotsquared/core/PlotSquared.java | 2 +- .../com/plotsquared/core/command/Setup.java | 68 ++++++------------- .../core/configuration/Captions.java | 30 +++++++- 3 files changed, 52 insertions(+), 48 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index bd018399f..f17226cd3 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -1831,7 +1831,7 @@ public class PlotSquared { setupStyle(); } catch (IOException err) { err.printStackTrace(); - PlotSquared.log("failed to save style.yml"); + PlotSquared.log("Failed to save style.yml"); } try { this.storageFile = new File(folder, "storage.yml"); diff --git a/Core/src/main/java/com/plotsquared/core/command/Setup.java b/Core/src/main/java/com/plotsquared/core/command/Setup.java index 947a3221f..61eb2b958 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Setup.java +++ b/Core/src/main/java/com/plotsquared/core/command/Setup.java @@ -104,7 +104,7 @@ public class Setup extends SubCommand { if (args.length == 1) { if (args[0].equalsIgnoreCase("cancel")) { player.deleteMeta("setup"); - MainUtil.sendMessage(player, "&aCancelled setup"); + MainUtil.sendMessage(player, Captions.SETUP_CANCELLED); return false; } if (args[0].equalsIgnoreCase("back")) { @@ -125,8 +125,7 @@ public class Setup extends SubCommand { case 0: // choose generator if (args.length != 1 || !SetupUtils.generators.containsKey(args[0])) { String prefix = "\n&8 - &7"; - MainUtil.sendMessage(player, - "&cYou must choose a generator!" + prefix + StringMan + MainUtil.sendMessage(player, Captions.SETUP_WORLD_GENERATOR_ERROR + prefix + StringMan .join(SetupUtils.generators.keySet(), prefix) .replaceAll(PlotSquared.imp().getPluginName(), "&2" + PlotSquared.imp().getPluginName())); @@ -135,10 +134,7 @@ public class Setup extends SubCommand { } object.setupGenerator = args[0]; object.current++; - MainUtil.sendMessage(player, "&6What world type do you want?" - + "\n&8 - &2normal&8 - &7Standard plot generation" - + "\n&8 - &7augmented&8 - &7Plot generation with terrain" - + "\n&8 - &7partial&8 - &7Vanilla with clusters of plots"); + MainUtil.sendMessage(player, Captions.SETUP_WORLD_TYPE); break; case 1: // choose world type List allTypes = Arrays.asList("normal", "augmented", "partial"); @@ -154,7 +150,7 @@ public class Setup extends SubCommand { Optional plotAreaType; if (args.length != 1 || !(plotAreaType = PlotAreaType.fromString(args[0])) .isPresent()) { - MainUtil.sendMessage(player, "&cYou must choose a world type!"); + MainUtil.sendMessage(player, Captions.SETUP_WORLD_TYPE_ERROR); for (String type : types) { int i = allTypes.indexOf(type); if (type.equals("normal")) { @@ -181,7 +177,7 @@ public class Setup extends SubCommand { .processSetup(object); } if (object.step.length == 0) { - MainUtil.sendMessage(player, "&6What do you want your world to be called?"); + MainUtil.sendMessage(player, Captions.SETUP_WORLD_NAME); object.setup_index = 0; return true; } @@ -201,53 +197,45 @@ public class Setup extends SubCommand { .processSetup(object); } else { object.plotManager = PlotSquared.imp().getPluginName(); - MainUtil.sendMessage(player, - "&c[WARNING] The specified generator does not identify as BukkitPlotGenerator"); - MainUtil.sendMessage(player, - "&7 - You may need to manually configure the other plugin"); + MainUtil.sendMessage(player, Captions.SETUP_WRONG_GENERATOR); object.step = SetupUtils.generators.get(object.plotManager).getPlotGenerator() .getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null) .getSettingNodes(); } if (object.type == PlotAreaType.PARTIAL) { - MainUtil.sendMessage(player, "What would you like this area called?"); + MainUtil.sendMessage(player, Captions.SETUP_AREA_NAME); object.current++; } else { - MainUtil.sendMessage(player, "&6What terrain would you like in plots?" - + "\n&8 - &2NONE&8 - &7No terrain at all" - + "\n&8 - &7ORE&8 - &7Just some ore veins and trees" - + "\n&8 - &7ROAD&8 - &7Terrain separated by roads" - + "\n&8 - &7ALL&8 - &7Entirely vanilla generation"); + MainUtil.sendMessage(player, Captions.SETUP_PARTIAL_AREA); object.current = 5; } } break; case 2: // area id if (!StringMan.isAlphanumericUnd(args[0])) { - MainUtil.sendMessage(player, "&cThe area id must be alphanumerical!"); + MainUtil.sendMessage(player, Captions.SETUP_AREA_NON_ALPHANUMERICAL); return false; } for (PlotArea area : PlotSquared.get().getPlotAreas()) { if (area.getId() != null && area.getId().equalsIgnoreCase(args[0])) { - MainUtil.sendMessage(player, - "&cYou must choose an area id that is not in use!"); + MainUtil.sendMessage(player, Captions.SETUP_AREA_INVALID_ID); return false; } } object.id = args[0]; object.current++; - MainUtil.sendMessage(player, "&6What should be the minimum Plot Id?"); + MainUtil.sendMessage(player, Captions.SETUP_AREA_MIN_PLOT_ID); break; case 3: // min try { object.min = PlotId.fromString(args[0]); } catch (IllegalArgumentException ignored) { - MainUtil.sendMessage(player, "&cYou must choose a valid minimum PlotId!"); + MainUtil.sendMessage(player, Captions.SETUP_AREA_MIN_PLOT_ID_ERROR); return false; } object.current++; - MainUtil.sendMessage(player, "&6What should be the maximum Plot Id?"); + MainUtil.sendMessage(player, Captions.SETUP_AREA_MAX_PLOT_ID); break; case 4: // max @@ -255,31 +243,23 @@ public class Setup extends SubCommand { try { id = PlotId.fromString(args[0]); } catch (IllegalArgumentException ignored) { - MainUtil.sendMessage(player, "&cYou must choose a valid maximum PlotId!"); + MainUtil.sendMessage(player, Captions.SETUP_AREA_MAX_PLOT_ID_ERROR); return false; } if (id.x <= object.min.x || id.y <= object.min.y) { MainUtil - .sendMessage(player, "&cThe max PlotId must be greater than the minimum!"); + .sendMessage(player, Captions.SETUP_AREA_PLOT_ID_GREATER_THAN_MINIMUM); return false; } object.max = id; object.current++; - MainUtil.sendMessage(player, "&6What terrain would you like in plots?" - + "\n&8 - &2NONE&8 - &7No terrain at all" - + "\n&8 - &7ORE&8 - &7Just some ore veins and trees" - + "\n&8 - &7ROAD&8 - &7Terrain separated by roads" - + "\n&8 - &7ALL&8 - &7Entirely vanilla generation"); + MainUtil.sendMessage(player, Captions.SETUP_PARTIAL_AREA); break; case 5: { // Choose terrain Optional optTerrain; if (args.length != 1 || !(optTerrain = PlotAreaTerrainType.fromString(args[0])) .isPresent()) { - MainUtil.sendMessage(player, - "&cYou must choose the terrain!" + "\n&8 - &2NONE&8 - &7No terrain at all" - + "\n&8 - &7ORE&8 - &7Just some ore veins and trees" - + "\n&8 - &7ROAD&8 - &7Terrain separated by roads" - + "\n&8 - &7ALL&8 - &7Entirely vanilla generation"); + MainUtil.sendMessage(player, Captions.SETUP_PARTIAL_AREA_ERROR, Captions.SETUP_PARTIAL_AREA); return false; } object.terrain = optTerrain.get(); @@ -297,7 +277,7 @@ public class Setup extends SubCommand { } case 6: // world setup if (object.setup_index == object.step.length) { - MainUtil.sendMessage(player, "&6What do you want your world to be called?"); + MainUtil.sendMessage(player, Captions.SETUP_WORLD_NAME); object.setup_index = 0; object.current++; return true; @@ -339,23 +319,19 @@ public class Setup extends SubCommand { } case 7: if (args.length != 1) { - MainUtil.sendMessage(player, "&cYou need to choose a world name!"); + MainUtil.sendMessage(player, Captions.SETUP_WORLD_NAME_ERROR); return false; } if (!d(args[0])) { - MainUtil.sendMessage(player, - "Non [a-z0-9_.-] character in the world name: " + args[0]); + MainUtil.sendMessage(player, Captions.SETUP_WORLD_NAME_FORMAT + args[0]); return false; } if (WorldUtil.IMP.isWorld(args[0])) { if (PlotSquared.get().hasPlotArea(args[0])) { - MainUtil.sendMessage(player, "&cThat world name is already taken!"); + MainUtil.sendMessage(player, Captions.SETUP_WORLD_NAME_TAKEN); return false; } - MainUtil.sendMessage(player, - "&cThe world you specified already exists. After restarting, new terrain will use " - + PlotSquared.imp().getPluginName() + ", however you may need to " - + "reset the world for it to generate correctly!"); + MainUtil.sendMessage(player, Captions.SETUP_WORLD_APPLY_PLOTSQUARED); } object.world = args[0]; player.deleteMeta("setup"); diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Captions.java b/Core/src/main/java/com/plotsquared/core/configuration/Captions.java index cf8d28175..c6dad68d6 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Captions.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Captions.java @@ -321,6 +321,35 @@ public enum Captions implements Caption { "$4You 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.", "Setup"), SETUP_WORLD_TAKEN("$2%s is already a world", "Setup"), + SETUP_CANCELLED("$7Cancelled setup.", "Setup"), + SETUP_WORLD_NAME("$1What do you want your world to be called?", "Setup"), + SETUP_WORLD_NAME_ERROR("$7You need to choose a world name!", "Setup"), + SETUP_WORLD_NAME_TAKEN("$7That world name is already taken!", "Setup"), + SETUP_WORLD_GENERATOR_ERROR("$7You must choose a generator!", "Setup"), + SETUP_WORLD_TYPE("$1What world type do you want?&-" + + "$3 - $6normal$3 - $2Standard plot generation&-" + + "$3 - $6augmented$3 - $2Plot generation with terrain&-" + + "$3 - $6partial$3 - $2Vanilla with clusters of plots", "Setup"), + SETUP_WORLD_TYPE_ERROR("$7You must choose a world type!", "Setup"), + SETUP_WRONG_GENERATOR("$7The specified generator does not identify as BukkitPlotGenerator" + + "$3 - $6You may need to manually configure the other plugin", "Setup"), + SETUP_WORLD_NAME_FORMAT("$7Non [a-z0-9_.-] character in the world name:$1 ", "Setup"), + SETUP_WORLD_APPLY_PLOTSQUARED("$7The world you specified already exists. After restarting, new terrain will use " + + "$1PlotSquared$7, however you may need to reset the world for it to generate correctly!", "Setup"), + SETUP_PARTIAL_AREA("$1What terrain would you like in plots?&-" + + "$3 - $6NONE$3 - $2No terrain at all&-" + + "$3 - $6ORE$3 - $2Just some ore veins and trees&-" + + "$3 - $6ROAD$3 - $2Terrain separated by roads&-" + + "$3 - $6ALL$3 - $2Entirely vanilla generation", "Setup"), + SETUP_PARTIAL_AREA_ERROR("$7You must choose the terrain!", "Setup"), + SETUP_AREA_NAME("$1What would you like this area called?", "Setup"), + SETUP_AREA_NON_ALPHANUMERICAL("$7The area id must be alphanumerical!", "Setup"), + SETUP_AREA_INVALID_ID("$7You must choose an area id that is not in use!", "Setup"), + SETUP_AREA_MIN_PLOT_ID("$1What should be the minimum Plot Id?", "Setup"), + SETUP_AREA_MIN_PLOT_ID_ERROR("$7You must choose a valid minimum Plot Id!", "Setup"), + SETUP_AREA_MAX_PLOT_ID("$1What should be the maximum Plot Id?", "Setup"), + SETUP_AREA_MAX_PLOT_ID_ERROR("$7You must choose a valid maximum Plot Id!", "Setup"), + SETUP_AREA_PLOT_ID_GREATER_THAN_MINIMUM("$7The max PlotId must be greater than the minimum!", "Setup"), // // SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", "Schematics"), @@ -360,7 +389,6 @@ public enum Captions implements Caption { // ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"), ALIAS_REMOVED("$2Plot alias removed", "Alias"), - ALIAS_TOO_LONG("$2The alias must be < 50 characters in length", "Alias"), ALIAS_IS_TAKEN("$2That alias is already taken", "Alias"), //