Add a few more translation strings for setup wizard

This commit is contained in:
N0tMyFaultOG 2020-05-09 16:45:32 +02:00
parent 198c7ca58d
commit ae11f0610e
3 changed files with 52 additions and 48 deletions

View File

@ -1831,7 +1831,7 @@ public class PlotSquared {
setupStyle(); setupStyle();
} catch (IOException err) { } catch (IOException err) {
err.printStackTrace(); err.printStackTrace();
PlotSquared.log("failed to save style.yml"); PlotSquared.log("Failed to save style.yml");
} }
try { try {
this.storageFile = new File(folder, "storage.yml"); this.storageFile = new File(folder, "storage.yml");

View File

@ -104,7 +104,7 @@ public class Setup extends SubCommand {
if (args.length == 1) { if (args.length == 1) {
if (args[0].equalsIgnoreCase("cancel")) { if (args[0].equalsIgnoreCase("cancel")) {
player.deleteMeta("setup"); player.deleteMeta("setup");
MainUtil.sendMessage(player, "&aCancelled setup"); MainUtil.sendMessage(player, Captions.SETUP_CANCELLED);
return false; return false;
} }
if (args[0].equalsIgnoreCase("back")) { if (args[0].equalsIgnoreCase("back")) {
@ -125,8 +125,7 @@ public class Setup extends SubCommand {
case 0: // choose generator case 0: // choose generator
if (args.length != 1 || !SetupUtils.generators.containsKey(args[0])) { if (args.length != 1 || !SetupUtils.generators.containsKey(args[0])) {
String prefix = "\n&8 - &7"; String prefix = "\n&8 - &7";
MainUtil.sendMessage(player, MainUtil.sendMessage(player, Captions.SETUP_WORLD_GENERATOR_ERROR + prefix + StringMan
"&cYou must choose a generator!" + prefix + StringMan
.join(SetupUtils.generators.keySet(), prefix) .join(SetupUtils.generators.keySet(), prefix)
.replaceAll(PlotSquared.imp().getPluginName(), .replaceAll(PlotSquared.imp().getPluginName(),
"&2" + PlotSquared.imp().getPluginName())); "&2" + PlotSquared.imp().getPluginName()));
@ -135,10 +134,7 @@ public class Setup extends SubCommand {
} }
object.setupGenerator = args[0]; object.setupGenerator = args[0];
object.current++; object.current++;
MainUtil.sendMessage(player, "&6What world type do you want?" MainUtil.sendMessage(player, Captions.SETUP_WORLD_TYPE);
+ "\n&8 - &2normal&8 - &7Standard plot generation"
+ "\n&8 - &7augmented&8 - &7Plot generation with terrain"
+ "\n&8 - &7partial&8 - &7Vanilla with clusters of plots");
break; break;
case 1: // choose world type case 1: // choose world type
List<String> allTypes = Arrays.asList("normal", "augmented", "partial"); List<String> allTypes = Arrays.asList("normal", "augmented", "partial");
@ -154,7 +150,7 @@ public class Setup extends SubCommand {
Optional<PlotAreaType> plotAreaType; Optional<PlotAreaType> plotAreaType;
if (args.length != 1 || !(plotAreaType = PlotAreaType.fromString(args[0])) if (args.length != 1 || !(plotAreaType = PlotAreaType.fromString(args[0]))
.isPresent()) { .isPresent()) {
MainUtil.sendMessage(player, "&cYou must choose a world type!"); MainUtil.sendMessage(player, Captions.SETUP_WORLD_TYPE_ERROR);
for (String type : types) { for (String type : types) {
int i = allTypes.indexOf(type); int i = allTypes.indexOf(type);
if (type.equals("normal")) { if (type.equals("normal")) {
@ -181,7 +177,7 @@ public class Setup extends SubCommand {
.processSetup(object); .processSetup(object);
} }
if (object.step.length == 0) { 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; object.setup_index = 0;
return true; return true;
} }
@ -201,53 +197,45 @@ public class Setup extends SubCommand {
.processSetup(object); .processSetup(object);
} else { } else {
object.plotManager = PlotSquared.imp().getPluginName(); object.plotManager = PlotSquared.imp().getPluginName();
MainUtil.sendMessage(player, MainUtil.sendMessage(player, Captions.SETUP_WRONG_GENERATOR);
"&c[WARNING] The specified generator does not identify as BukkitPlotGenerator");
MainUtil.sendMessage(player,
"&7 - You may need to manually configure the other plugin");
object.step = object.step =
SetupUtils.generators.get(object.plotManager).getPlotGenerator() SetupUtils.generators.get(object.plotManager).getPlotGenerator()
.getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null) .getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null)
.getSettingNodes(); .getSettingNodes();
} }
if (object.type == PlotAreaType.PARTIAL) { if (object.type == PlotAreaType.PARTIAL) {
MainUtil.sendMessage(player, "What would you like this area called?"); MainUtil.sendMessage(player, Captions.SETUP_AREA_NAME);
object.current++; object.current++;
} else { } else {
MainUtil.sendMessage(player, "&6What terrain would you like in plots?" MainUtil.sendMessage(player, Captions.SETUP_PARTIAL_AREA);
+ "\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");
object.current = 5; object.current = 5;
} }
} }
break; break;
case 2: // area id case 2: // area id
if (!StringMan.isAlphanumericUnd(args[0])) { if (!StringMan.isAlphanumericUnd(args[0])) {
MainUtil.sendMessage(player, "&cThe area id must be alphanumerical!"); MainUtil.sendMessage(player, Captions.SETUP_AREA_NON_ALPHANUMERICAL);
return false; return false;
} }
for (PlotArea area : PlotSquared.get().getPlotAreas()) { for (PlotArea area : PlotSquared.get().getPlotAreas()) {
if (area.getId() != null && area.getId().equalsIgnoreCase(args[0])) { if (area.getId() != null && area.getId().equalsIgnoreCase(args[0])) {
MainUtil.sendMessage(player, MainUtil.sendMessage(player, Captions.SETUP_AREA_INVALID_ID);
"&cYou must choose an area id that is not in use!");
return false; return false;
} }
} }
object.id = args[0]; object.id = args[0];
object.current++; object.current++;
MainUtil.sendMessage(player, "&6What should be the minimum Plot Id?"); MainUtil.sendMessage(player, Captions.SETUP_AREA_MIN_PLOT_ID);
break; break;
case 3: // min case 3: // min
try { try {
object.min = PlotId.fromString(args[0]); object.min = PlotId.fromString(args[0]);
} catch (IllegalArgumentException ignored) { } 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; return false;
} }
object.current++; object.current++;
MainUtil.sendMessage(player, "&6What should be the maximum Plot Id?"); MainUtil.sendMessage(player, Captions.SETUP_AREA_MAX_PLOT_ID);
break; break;
case 4: case 4:
// max // max
@ -255,31 +243,23 @@ public class Setup extends SubCommand {
try { try {
id = PlotId.fromString(args[0]); id = PlotId.fromString(args[0]);
} catch (IllegalArgumentException ignored) { } 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; return false;
} }
if (id.x <= object.min.x || id.y <= object.min.y) { if (id.x <= object.min.x || id.y <= object.min.y) {
MainUtil MainUtil
.sendMessage(player, "&cThe max PlotId must be greater than the minimum!"); .sendMessage(player, Captions.SETUP_AREA_PLOT_ID_GREATER_THAN_MINIMUM);
return false; return false;
} }
object.max = id; object.max = id;
object.current++; object.current++;
MainUtil.sendMessage(player, "&6What terrain would you like in plots?" MainUtil.sendMessage(player, Captions.SETUP_PARTIAL_AREA);
+ "\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");
break; break;
case 5: { // Choose terrain case 5: { // Choose terrain
Optional<PlotAreaTerrainType> optTerrain; Optional<PlotAreaTerrainType> optTerrain;
if (args.length != 1 || !(optTerrain = PlotAreaTerrainType.fromString(args[0])) if (args.length != 1 || !(optTerrain = PlotAreaTerrainType.fromString(args[0]))
.isPresent()) { .isPresent()) {
MainUtil.sendMessage(player, MainUtil.sendMessage(player, Captions.SETUP_PARTIAL_AREA_ERROR, Captions.SETUP_PARTIAL_AREA);
"&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");
return false; return false;
} }
object.terrain = optTerrain.get(); object.terrain = optTerrain.get();
@ -297,7 +277,7 @@ public class Setup extends SubCommand {
} }
case 6: // world setup case 6: // world setup
if (object.setup_index == object.step.length) { 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.setup_index = 0;
object.current++; object.current++;
return true; return true;
@ -339,23 +319,19 @@ public class Setup extends SubCommand {
} }
case 7: case 7:
if (args.length != 1) { if (args.length != 1) {
MainUtil.sendMessage(player, "&cYou need to choose a world name!"); MainUtil.sendMessage(player, Captions.SETUP_WORLD_NAME_ERROR);
return false; return false;
} }
if (!d(args[0])) { if (!d(args[0])) {
MainUtil.sendMessage(player, MainUtil.sendMessage(player, Captions.SETUP_WORLD_NAME_FORMAT + args[0]);
"Non [a-z0-9_.-] character in the world name: " + args[0]);
return false; return false;
} }
if (WorldUtil.IMP.isWorld(args[0])) { if (WorldUtil.IMP.isWorld(args[0])) {
if (PlotSquared.get().hasPlotArea(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; return false;
} }
MainUtil.sendMessage(player, MainUtil.sendMessage(player, Captions.SETUP_WORLD_APPLY_PLOTSQUARED);
"&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!");
} }
object.world = args[0]; object.world = args[0];
player.deleteMeta("setup"); player.deleteMeta("setup");

View File

@ -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 " "$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"), + "your chosen world management plugin.", "Setup"),
SETUP_WORLD_TAKEN("$2%s is already a world", "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"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Schematic"> //<editor-fold desc="Schematic">
SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", "Schematics"), SCHEMATIC_TOO_LARGE("$2The plot is too large for this action!", "Schematics"),
@ -360,7 +389,6 @@ public enum Captions implements Caption {
//<editor-fold desc="Alias"> //<editor-fold desc="Alias">
ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"), ALIAS_SET_TO("$2Plot alias set to $1%alias%", "Alias"),
ALIAS_REMOVED("$2Plot alias removed", "Alias"), ALIAS_REMOVED("$2Plot alias removed", "Alias"),
ALIAS_TOO_LONG("$2The alias must be < 50 characters in length", "Alias"), ALIAS_TOO_LONG("$2The alias must be < 50 characters in length", "Alias"),
ALIAS_IS_TAKEN("$2That alias is already taken", "Alias"), ALIAS_IS_TAKEN("$2That alias is already taken", "Alias"),
//</editor-fold> //</editor-fold>