From 3e57cae86662fda1187311a62f1abfc7eb9e19a6 Mon Sep 17 00:00:00 2001 From: Bryan Terce Date: Wed, 26 Jun 2019 01:55:08 -0700 Subject: [PATCH] Fix sync execute logic (fixes #16) --- .../com/btk5h/skriptdb/skript/EffExecuteStatement.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/btk5h/skriptdb/skript/EffExecuteStatement.java b/src/main/java/com/btk5h/skriptdb/skript/EffExecuteStatement.java index 0326c3c..9aa5186 100644 --- a/src/main/java/com/btk5h/skriptdb/skript/EffExecuteStatement.java +++ b/src/main/java/com/btk5h/skriptdb/skript/EffExecuteStatement.java @@ -86,7 +86,7 @@ public class EffExecuteStatement extends Delay { String result = executeStatement(e); continueScriptExecution(e, result); } else { - if (isMainThread) { + if (isSync) { Skript.warning("A SQL query was attempted on the main thread!"); } @@ -98,11 +98,7 @@ public class EffExecuteStatement extends Delay { err.printStackTrace(); } - if (isSync) { - continueScriptExecution(e, res); - } else { - Bukkit.getScheduler().runTask(SkriptDB.getInstance(), () -> continueScriptExecution(e, res)); - } + Bukkit.getScheduler().runTask(SkriptDB.getInstance(), () -> continueScriptExecution(e, res)); }); } }