Skip to content

Commit

Permalink
Fix invalid errors caused by #4104 (#4112)
Browse files Browse the repository at this point in the history
  • Loading branch information
TPGamesNL authored Jun 25, 2021
1 parent 83e9dbc commit d160a9c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/command/ScriptCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ boolean execute2(final ScriptCommandEvent event, final CommandSender sender, fin
if (e != null)
sender.sendMessage(ChatColor.DARK_RED + e.getMessage());
sender.sendMessage(usage);
log.clearAll();
log.clear();
return false;
}
log.clearError();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/effects/EffChange.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public boolean init(final Expression<?>[] exprs, final int matchedPattern, final
log.printError();
return false;
}
log.clearAll();
log.clear();
final Class<?>[] r = new Class[rs.length];
for (int i = 0; i < rs.length; i++)
r[i] = rs[i].isArray() ? rs[i].getComponentType() : rs[i];
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/ch/njol/skript/lang/SkriptParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ private final <T> Expression<? extends T> parseSingleExpr(final boolean allowUnp
log.printError();
return null;
}
log.clearAll();
log.clear();
final LogEntry e = log.getError();
return (Literal<? extends T>) new UnparsedLiteral(expr, e != null && (error == null || e.quality > error.quality) ? e : error);
}
Expand Down Expand Up @@ -561,7 +561,7 @@ else if (!hasSingular && hasPlural)
log.printError();
return null;
}
log.clearAll();
log.clear();
final LogEntry e = log.getError();
return new UnparsedLiteral(expr, e != null && (error == null || e.quality > error.quality) ? e : error);
}
Expand Down Expand Up @@ -667,11 +667,11 @@ public final <T> Expression<? extends T> parseExpression(final Class<? extends T

if (pieces.size() == 1) { // not a list of expressions, and a single one has failed to parse above
if (expr.startsWith("(") && expr.endsWith(")") && next(expr, 0, context) == expr.length()) {
log.clearAll();
log.clear();
return new SkriptParser(this, "" + expr.substring(1, expr.length() - 1)).parseExpression(types);
}
if (isObject && (flags & PARSE_LITERALS) != 0) { // single expression - can return an UnparsedLiteral now
log.clearAll();
log.clear();
return (Expression<? extends T>) new UnparsedLiteral(expr, log.getError());
}
// results in useless errors most of the time
Expand Down Expand Up @@ -816,11 +816,11 @@ public final Expression<?> parseExpression(final ExprInfo vi) {

if (pieces.size() == 1) { // not a list of expressions, and a single one has failed to parse above
if (expr.startsWith("(") && expr.endsWith(")") && next(expr, 0, context) == expr.length()) {
log.clearAll();
log.clear();
return new SkriptParser(this, "" + expr.substring(1, expr.length() - 1)).parseExpression(vi);
}
if (isObject && (flags & PARSE_LITERALS) != 0) { // single expression - can return an UnparsedLiteral now
log.clearAll();
log.clear();
return new UnparsedLiteral(expr, log.getError());
}
// results in useless errors most of the time
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/ch/njol/skript/log/ParseLogHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ public void clearError() {
error = null;
}

public void clearAll() {
clear();
clearError();
}

/**
* Prints the retained log
*/
Expand Down

0 comments on commit d160a9c

Please sign in to comment.