Skip to content

Commit

Permalink
(Hotfix) Possibly work around #2 for the time being
Browse files Browse the repository at this point in the history
  • Loading branch information
btk5h committed Apr 7, 2017
1 parent 8c6c8a7 commit e121e62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

group 'com.btk5h'
version '1.1.0'
version '1.1.1'

apply plugin: 'java'

Expand Down
14 changes: 9 additions & 5 deletions src/main/java/com/btk5h/skriptjson/skript/EffJSONToVariable.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,34 @@ protected void execute(Event e) {
}
}

private void setVariable(Event e, String name, Object obj) {
Variables.setVariable(name.toLowerCase(Locale.ENGLISH), obj, e, isLocal);
}

private void mapFirst(Event e, String name, Object obj) {
if (obj instanceof JSONObject) {
handleObject(e, name, (JSONObject) obj);
} else if (obj instanceof JSONArray) {
handleArray(e, name, (JSONArray) obj);
} else {
Variables.setVariable(name, obj, e, isLocal);
setVariable(e, name, obj);
}
}

private void map(Event e, String name, Object obj) {
if (obj instanceof JSONObject) {
if (((JSONObject) obj).containsKey("__javaclass__")
|| ((JSONObject) obj).containsKey("__skriptclass__")) {
Variables.setVariable(name, Serializers.deserialize(((JSONObject) obj)), e, isLocal);
setVariable(e, name, Serializers.deserialize(((JSONObject) obj)));
} else {
Variables.setVariable(name, true, e, isLocal);
setVariable(e, name, true);
handleObject(e, name, (JSONObject) obj);
}
} else if (obj instanceof JSONArray) {
Variables.setVariable(name, true, e, isLocal);
setVariable(e, name, true);
handleArray(e, name, (JSONArray) obj);
} else {
Variables.setVariable(name, obj, e, isLocal);
setVariable(e, name, obj);
}
}

Expand Down

0 comments on commit e121e62

Please sign in to comment.