Skip to content

Commit

Permalink
Fix CondCompare Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
APickledWalrus committed Dec 29, 2023
1 parent 03e912c commit ec7345d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main/java/ch/njol/skript/conditions/CondCompare.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package ch.njol.skript.conditions;

import ch.njol.skript.log.ParseLogHandler;
import ch.njol.skript.util.Time;
import org.bukkit.event.Event;
import org.eclipse.jdt.annotation.Nullable;
Expand Down Expand Up @@ -166,17 +167,16 @@ public static String f(final Expression<?> e) {

@SuppressWarnings("unchecked")
private boolean init(String expr) {
RetainingLogHandler log = SkriptLogger.startRetainingLog();
Expression<?> third = this.third;
try {
try (ParseLogHandler log = SkriptLogger.startParseLogHandler()) {
if (first.getReturnType() == Object.class) {
Expression<?> expression = null;
if (first instanceof UnparsedLiteral)
expression = attemptReconstruction((UnparsedLiteral) first, second);
if (expression == null)
expression = first.getConvertedExpression(Object.class);
if (expression == null) {
log.printErrors();
log.printError();
return false;
}
first = expression;
Expand All @@ -188,7 +188,7 @@ private boolean init(String expr) {
if (expression == null)
expression = second.getConvertedExpression(Object.class);
if (expression == null) {
log.printErrors();
log.printError();
return false;
}
second = expression;
Expand All @@ -200,14 +200,13 @@ private boolean init(String expr) {
if (expression == null)
expression = third.getConvertedExpression(Object.class);
if (expression == null) {
log.printErrors();
log.printError();
return false;
}
this.third = third = expression;
}
log.printLog();
} finally {
log.stop();
// we do not want to print any errors as they are not applicable
log.printLog(false);
}
Class<?> firstReturnType = first.getReturnType();
Class<?> secondReturnType = third == null ? second.getReturnType() : Utils.getSuperType(second.getReturnType(), third.getReturnType());
Expand Down

0 comments on commit ec7345d

Please sign in to comment.