Merge pull request #2558 from IntellectualSites/more-translation-strings

Add translation messages for flag errors
This commit is contained in:
NotMyFault 2019-11-04 21:12:39 +01:00 committed by GitHub
commit e8bf3f0d2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 31 additions and 17 deletions

View File

@ -698,11 +698,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
} }
if (Settings.UUID.OFFLINE) { if (Settings.UUID.OFFLINE) {
PlotSquared.log(Captions.PREFIX + " &6" + getPluginName() PlotSquared.log(Captions.PREFIX + "&6" + getPluginName()
+ " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of " + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of "
+ "Bukkit"); + "Bukkit");
} else { } else {
PlotSquared.log(Captions.PREFIX + "" + getPluginName() + " is using online UUIDs"); PlotSquared.log(Captions.PREFIX + "&6" + getPluginName() + " is using online UUIDs");
} }
if (Settings.UUID.USE_SQLUUIDHANDLER) { if (Settings.UUID.USE_SQLUUIDHANDLER) {
return new SQLUUIDHandler(wrapper); return new SQLUUIDHandler(wrapper);

View File

@ -548,7 +548,21 @@ public enum Captions {
FLAG_CATEGORY_BOOLEAN("Boolean Flags", "Flags"), FLAG_CATEGORY_BOOLEAN("Boolean Flags", "Flags"),
FLAG_CATEGORY_MIXED("Mixed Value Flags", "Flags"), FLAG_CATEGORY_MIXED("Mixed Value Flags", "Flags"),
//</editor-fold> //</editor-fold>
//<editor-fold desc="Flag category errors">
FLAG_ERROR_BOOLEAN("Flag value must be a boolean (true|false)", "Flags"),
FLAG_ERROR_ENUM("Must be one of: %s", "Flags"),
FLAG_ERROR_GAMEMODE("Flag value must be a gamemode: 'survival', 'creative', 'adventure' or 'spectator.", "Flags"),
FLAG_ERROR_INTEGER("Flag value must be a whole number", "Flags"),
FLAG_ERROR_INTEGER_LIST("Flag value must be an integer list", "Flags"),
FLAG_ERROR_INTERVAL("Value(s) must be numeric. /plot set flag <flag> <interval> [amount]", "Flags"),
FLAG_ERROR_KEEP("Flag value must be a timestamp or a boolean", "Flags"),
FLAG_ERROR_LONG("Flag value must be a whole number (large numbers allowed)", "Flags"),
FLAG_ERROR_PLOTBLOCKLIST("Flag value must be a block list", "Flags"),
FLAG_ERROR_PRICE("Flag value must be a positive number.", "Flags"),
FLAG_ERROR_STRING("Flag value must be alphanumeric. Some special characters are allowed.", "Flags"),
FLAG_ERROR_STRINGLIST("Flag value must be a string list", "Flags"),
FLAG_ERROR_WEATHER("Flag must be a weather: 'rain' or 'sun'", "Flags"),
//</editor-fold>
//<editor-fold desc="Trusted"> //<editor-fold desc="Trusted">
TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"), TRUSTED_ADDED("$4You successfully trusted a user to the plot", "Trusted"),
WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"), WAS_NOT_ADDED("$2That player was not trusted on this plot", "Trusted"),

View File

@ -31,7 +31,7 @@ public class BooleanFlag extends Flag<Boolean> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be a boolean (true|false)"; return Captions.FLAG_ERROR_BOOLEAN.getTranslated();
} }
public boolean isTrue(Plot plot) { public boolean isTrue(Plot plot) {

View File

@ -22,6 +22,6 @@ public class DoubleFlag extends Flag<Double> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be a number."; return Captions.FLAG_ERROR_BOOLEAN.getTranslated();
} }
} }

View File

@ -28,6 +28,6 @@ public class EnumFlag extends Flag<String> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Must be one of: " + StringMan.getString(values); return Captions.FLAG_ERROR_ENUM.getTranslated() + StringMan.getString(values);
} }
} }

View File

@ -40,7 +40,7 @@ public final class Flags {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be a positive number."; return Captions.FLAG_ERROR_PRICE.getTranslated();
} }
}; };
public static final BooleanFlag EXPLOSION = new BooleanFlag("explosion"); public static final BooleanFlag EXPLOSION = new BooleanFlag("explosion");
@ -114,7 +114,7 @@ public final class Flags {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be a timestamp or a boolean"; return Captions.FLAG_ERROR_KEEP.getTranslated();
} }
}; };
public static final TeleportDenyFlag DENY_TELEPORT = new TeleportDenyFlag("deny-teleport"); public static final TeleportDenyFlag DENY_TELEPORT = new TeleportDenyFlag("deny-teleport");

View File

@ -37,6 +37,6 @@ public class GameModeFlag extends Flag<PlotGameMode> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be a gamemode: 'survival', 'creative', 'adventure' or 'spectator'"; return Captions.FLAG_ERROR_GAMEMODE.getTranslated();
} }
} }

View File

@ -10,7 +10,7 @@ public class IntegerFlag extends Flag<Integer> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be a whole number"; return Captions.FLAG_ERROR_INTEGER.getTranslated();
} }
@Override public String valueToString(Object value) { @Override public String valueToString(Object value) {

View File

@ -27,6 +27,6 @@ public class IntegerListFlag extends ListFlag<List<Integer>> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be an integer list"; return Captions.FLAG_ERROR_INTEGER_LIST.getTranslated();
} }
} }

View File

@ -40,7 +40,7 @@ public class IntervalFlag extends Flag<IntervalFlag.Interval> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Value(s) must be numeric. /plot set flag <flag> <interval> [amount]"; return Captions.FLAG_ERROR_INTERVAL.getTranslated();
} }
@EqualsAndHashCode @RequiredArgsConstructor @Getter public static final class Interval { @EqualsAndHashCode @RequiredArgsConstructor @Getter public static final class Interval {

View File

@ -21,6 +21,6 @@ public class LongFlag extends Flag<Long> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be a whole number (large numbers allowed)"; return Captions.FLAG_ERROR_LONG.getTranslated();
} }
} }

View File

@ -29,6 +29,6 @@ public class PlotBlockListFlag extends ListFlag<HashSet<PlotBlock>> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be a block list"; return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated();
} }
} }

View File

@ -31,6 +31,6 @@ public class PlotWeatherFlag extends Flag<PlotWeather> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag must be a weather: 'rain' or 'sun'"; return Captions.FLAG_ERROR_WEATHER.getTranslated();
} }
} }

View File

@ -18,6 +18,6 @@ public class StringFlag extends Flag<String> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be alphanumeric. Some special characters are allowed."; return Captions.FLAG_ERROR_STRING.getTranslated();
} }
} }

View File

@ -22,6 +22,6 @@ public class StringListFlag extends ListFlag<List<String>> {
} }
@Override public String getValueDescription() { @Override public String getValueDescription() {
return "Flag value must be a string list"; return Captions.FLAG_ERROR_STRINGLIST.getTranslated();
} }
} }