Skip to content

Commit

Permalink
Fix parsing not always converting expressions (#3774)
Browse files Browse the repository at this point in the history
* Update SkriptParser.java

* Update SkriptParser.java
  • Loading branch information
TPGamesNL authored Mar 22, 2021
1 parent 6f964bb commit f1f9904
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/main/java/ch/njol/skript/lang/SkriptParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -526,25 +526,10 @@ else if (!hasSingular && hasPlural)
}

// No directly same type found
if (types.length == 1) { // Only one type is accepted here
// So, we'll just create converted expression
@SuppressWarnings("unchecked") // This is safe... probably
Expression<?> r = e.getConvertedExpression((Class<Object>[]) types);
if (r != null) {
log.printLog();
return r;
}
} else { // Multiple types accepted
if (returnType == Object.class) { // No specific return type, so probably variable etc.
log.printLog();
return e; // Expression will have to deal with it runtime
} else {
Expression<?> r = e.getConvertedExpression((Class<Object>[]) types);
if (r != null) {
log.printLog();
return r;
}
}
Expression<?> r = e.getConvertedExpression((Class<Object>[]) types);
if (r != null) {
log.printLog();
return r;
}

// Print errors, if we couldn't get the correct type
Expand Down

0 comments on commit f1f9904

Please sign in to comment.