tangled
alpha
login
or
join now
codexarchonic.nekoweb.org
/
ProjectInfinity
0
fork
atom
Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.
0
fork
atom
overview
issues
6
pulls
pipelines
wait terminator escapes are actually important
Lera
10 months ago
ab31d0ed
175022a7
+22
-4
1 changed file
expand all
collapse all
unified
split
common
src
main
java
net
lerariemann
infinity
util
core
SaferStringReader.java
+22
-4
common/src/main/java/net/lerariemann/infinity/util/core/SaferStringReader.java
···
26
26
@Override
27
27
public String readStringUntil(char terminator) throws CommandSyntaxException {
28
28
StringBuilder result = new StringBuilder();
29
29
+
boolean escaped = false;
29
30
30
31
while(this.canRead()) {
31
32
char c = this.read();
32
32
-
if (c == terminator) {
33
33
-
return result.toString();
34
34
-
}
33
33
+
if (escaped) {
34
34
+
if (c == terminator) {
35
35
+
result.append(c);
36
36
+
escaped = false;
37
37
+
}
38
38
+
else if (c == '\\') {
39
39
+
result.append('\\');
40
40
+
}
41
41
+
else {
42
42
+
result.append('\\');
43
43
+
result.append(c);
44
44
+
escaped = false;
45
45
+
}
46
46
+
} else if (c == '\\') {
47
47
+
escaped = true;
48
48
+
} else {
49
49
+
if (c == terminator) {
50
50
+
return result.toString();
51
51
+
}
35
52
36
36
-
result.append(c);
53
53
+
result.append(c);
54
54
+
}
37
55
}
38
56
39
57
throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.readerExpectedEndOfQuote().createWithContext(this);