From e4e3cc3f17e13d27c74485f9fe2d69cf9630aa5d Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 25 Jan 2022 10:51:56 +1300 Subject: [PATCH] Try work around async stuff, paper only issue? Fixes #636 --- .../disguise/utilities/reflection/ReflectionManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugin/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java b/plugin/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java index c5f85107..c93639c5 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java @@ -2265,13 +2265,16 @@ public class ReflectionManager { ex.printStackTrace(); } } - public static void setScore(Scoreboard scoreboard, String name, int score) { - if (!Bukkit.isPrimaryThread()) { + setScore(scoreboard, name, score, true); + } + + public static void setScore(Scoreboard scoreboard, String name, int score, boolean canScheduleTask) { + if (canScheduleTask && (!Bukkit.isPrimaryThread() || DisguiseUtilities.isRunningPaper())) { new BukkitRunnable() { @Override public void run() { - setScore(scoreboard, name, score); + setScore(scoreboard, name, score, false); } }.runTask(LibsDisguises.getInstance()); return;