Skip to content

Commit

Permalink
Fix excaping double quotes inside string (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
bensku committed Apr 11, 2017
1 parent c4a22a5 commit 013de85
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/ch/njol/skript/lang/VariableString.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ private VariableString(final String s) {

orig = simple;
string = null;
components = new MessageComponent[][] {ChatMessages.parseToArray(s)};
assert simple != null;
components = new MessageComponent[][] {ChatMessages.parseToArray(simple)};
mode = StringMode.MESSAGE;
}

Expand All @@ -102,9 +103,10 @@ private VariableString(final String orig, final Object[] string, final StringMod
for (int i = 0; i < string.length; i++) {
Object o = string[i];
if (o instanceof String) {
String quotesFixed = ((String) o).replace("\"\"", "\"");
assert this.string != null;
this.string[i] = Utils.replaceChatStyles("" + ((String) o).replace("\"\"", "\""));
components.add(ChatMessages.parseToArray((String) o));
this.string[i] = Utils.replaceChatStyles("" + quotesFixed);
components.add(ChatMessages.parseToArray("" + quotesFixed));
} else {
assert this.string != null;
this.string[i] = o;
Expand Down Expand Up @@ -185,7 +187,7 @@ public static VariableString newInstance(final String orig, final StringMode mod
}

// We must not parse color codes yet, as JSON support would be broken :(
final String s = orig;
final String s = orig.replace("\"\"", "\"");

final List<Object> string = new ArrayList<>(n / 2 + 2); // List of strings and expressions

Expand Down

0 comments on commit 013de85

Please sign in to comment.