1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-09-02 10:52:37 +02:00

Modify node escaping to use "\" characters, and remove all limits on node/server/world strings - closes #166

This commit is contained in:
Luck
2017-02-04 12:18:45 +00:00
parent 6540c695de
commit 9b8d6e1dc7
16 changed files with 179 additions and 140 deletions

View File

@@ -37,6 +37,20 @@ import java.util.Set;
*/
public class MetaUtils {
private static String escapeDelimiters(String s, String... delims) {
for (String delim : delims) {
s = s.replace(delim, "\\" + delim);
}
return s;
}
private static String unescapeDelimiters(String s, String... delims) {
for (String delim : delims) {
s = s.replace("\\" + delim, delim);
}
return s;
}
/**
* Escapes special characters used within LuckPerms, so the string can be saved without issues
*
@@ -49,11 +63,7 @@ public class MetaUtils {
throw new NullPointerException();
}
s = s.replace(".", "{SEP}");
s = s.replace("/", "{FSEP}");
s = s.replace("$", "{DSEP}");
return s;
return escapeDelimiters(s, ".", "/", "-", "$");
}
/**
@@ -71,6 +81,7 @@ public class MetaUtils {
s = s.replace("{SEP}", ".");
s = s.replace("{FSEP}", "/");
s = s.replace("{DSEP}", "$");
s = unescapeDelimiters(s, ".", "/", "-", "$");
return s;
}