Specifically handle StackOverflowError and add in missing checks for premium/config

This commit is contained in:
libraryaddict 2017-07-24 06:28:14 +12:00
parent b817aebc02
commit 940e3aab86

View File

@ -103,11 +103,18 @@ public class DisguiseUtilities {
} }
public static void saveDisguises() { public static void saveDisguises() {
if (!LibsPremium.isPremium())
return;
for (HashSet<TargetedDisguise> list : disguisesInUse.values()) { for (HashSet<TargetedDisguise> list : disguisesInUse.values()) {
for (TargetedDisguise disg : list) { for (TargetedDisguise disg : list) {
if (disg.getEntity() == null) if (disg.getEntity() == null)
continue; continue;
if (disg.getEntity() instanceof Player ? DisguiseConfig.isSavePlayerDisguises() :
DisguiseConfig.isSaveEntityDisguises())
continue;
saveDisguises(disg.getEntity().getUniqueId(), list.toArray(new Disguise[0])); saveDisguises(disg.getEntity().getUniqueId(), list.toArray(new Disguise[0]));
break; break;
} }
@ -188,7 +195,7 @@ public class DisguiseUtilities {
savedDisguiseList.add(owningEntity); savedDisguiseList.add(owningEntity);
} }
} }
catch (Exception e) { catch (StackOverflowError | Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -327,8 +334,8 @@ public class DisguiseUtilities {
cachedNames.add(string.toLowerCase()); cachedNames.add(string.toLowerCase());
} }
catch (Exception ex) { catch (StackOverflowError | Exception e) {
ex.printStackTrace(); e.printStackTrace();
} }
} }