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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user