mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-29 05:26:12 +01:00
Fix writing of config values with backslashes (Fixes #444)
The VALID_PLAYERNAME_REGEXP setting needs to be changed to "^\\w+$" to work properly.
This commit is contained in:
parent
b09a1255a7
commit
ca25dca6b0
@ -31,9 +31,9 @@ public class ValueParser {
|
||||
} else if (object instanceof String) {
|
||||
String[] lines = ((String) object).split("\\R");
|
||||
if (lines.length == 1) {
|
||||
return '\"' + String.valueOf(object) + '\"';
|
||||
return '\"' + String.valueOf(object).replace("\\", "\\\\") + '\"';
|
||||
} else {
|
||||
return "|-\n" + Arrays.stream(lines).map(s -> " " + s).collect(Collectors.joining("\n"));
|
||||
return "|-\n" + Arrays.stream(lines).map(s -> " " + s.replace("\\", "\\\\")).collect(Collectors.joining("\n"));
|
||||
}
|
||||
} else {
|
||||
return '\"' + String.valueOf(object) + '\"';
|
||||
|
@ -200,7 +200,7 @@ public class Properties {
|
||||
@ConfigurationComment("This regexp validates the name of the player. If the name doesn't match, the player will neither be able to create a valid shop sign, nor buy/sell from a shop.\n" +
|
||||
"Note for Bedrock support: If you have Floodgate on your server, you should set this regexp to ^\\\\*?\\\\w+$ and ENSURE_CORRECT_PLAYERID to false\n" +
|
||||
"If your Floodgate prefix is not *, change the first * in the regexp (the one before the question mark) to whatever your prefix is.")
|
||||
public static String VALID_PLAYERNAME_REGEXP = "^\\\\w+$";
|
||||
public static String VALID_PLAYERNAME_REGEXP = "^\\w+$";
|
||||
|
||||
@PrecededBySpace
|
||||
@ConfigurationComment("Should we block shops that sell things for more than they buy? (This prevents newbies from creating shops that would be exploited)")
|
||||
|
Loading…
Reference in New Issue
Block a user