From 4e3f86acd0d58f60268b621d21b2c41522524053 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 25 Mar 2020 16:39:00 +1300 Subject: [PATCH] Add more warnings for async custom disguises --- .../disguise/DisguiseConfig.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java b/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java index c1b997f3..71225fcb 100644 --- a/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java +++ b/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java @@ -254,6 +254,12 @@ public class DisguiseConfig { } public static Entry getCustomDisguise(String disguise) { + if (!Bukkit.isPrimaryThread()) { + DisguiseUtilities.getLogger().warning( + "Custom Disguises should not be called async! This operation will become impossible in the " + + "future!"); + } + Entry entry = getRawCustomDisguise(disguise); if (entry == null) { @@ -273,6 +279,12 @@ public class DisguiseConfig { public static Entry getCustomDisguise(Entity target, String disguise) throws IllegalAccessException, DisguiseParseException, InvocationTargetException { + if (!Bukkit.isPrimaryThread()) { + DisguiseUtilities.getLogger().warning( + "Custom Disguises should not be called async! This operation will become impossible in the " + + "future!"); + } + Entry entry = getRawCustomDisguise(disguise); if (entry == null) { @@ -285,6 +297,12 @@ public class DisguiseConfig { public static Entry getCustomDisguise(CommandSender invoker, Entity target, String disguise) throws IllegalAccessException, DisguiseParseException, InvocationTargetException { + if (!Bukkit.isPrimaryThread()) { + DisguiseUtilities.getLogger().warning( + "Custom Disguises should not be called async! This operation will become impossible in the " + + "future!"); + } + Entry entry = getRawCustomDisguise(disguise); if (entry == null) { @@ -633,6 +651,12 @@ public class DisguiseConfig { } public static void addCustomDisguise(String disguiseName, String toParse) throws DisguiseParseException { + if (!Bukkit.isPrimaryThread()) { + DisguiseUtilities.getLogger().warning( + "Custom Disguises should not be called async! This operation will become impossible in the " + + "future!"); + } + if (getRawCustomDisguise(toParse) != null) { throw new DisguiseParseException(LibsMsg.CUSTOM_DISGUISE_NAME_CONFLICT, disguiseName); }