Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CondCompare Logging #6266

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/main/java/ch/njol/skript/conditions/CondCompare.java
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