From 940e3aab86b89683f9afdebf337c977be6833faa Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 24 Jul 2017 06:28:14 +1200 Subject: [PATCH] Specifically handle StackOverflowError and add in missing checks for premium/config --- .../disguise/utilities/DisguiseUtilities.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 4319312b..dea9ffdd 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -103,11 +103,18 @@ public class DisguiseUtilities { } public static void saveDisguises() { + if (!LibsPremium.isPremium()) + return; + for (HashSet list : disguisesInUse.values()) { for (TargetedDisguise disg : list) { if (disg.getEntity() == null) continue; + if (disg.getEntity() instanceof Player ? DisguiseConfig.isSavePlayerDisguises() : + DisguiseConfig.isSaveEntityDisguises()) + continue; + saveDisguises(disg.getEntity().getUniqueId(), list.toArray(new Disguise[0])); break; } @@ -188,7 +195,7 @@ public class DisguiseUtilities { savedDisguiseList.add(owningEntity); } } - catch (Exception e) { + catch (StackOverflowError | Exception e) { e.printStackTrace(); } } @@ -327,8 +334,8 @@ public class DisguiseUtilities { cachedNames.add(string.toLowerCase()); } - catch (Exception ex) { - ex.printStackTrace(); + catch (StackOverflowError | Exception e) { + e.printStackTrace(); } }