From 832e1e4d341ad3d520a400fd9945bc64a397e573 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 30 Jan 2022 13:36:42 +0100 Subject: [PATCH] fixed error message when using /mmocore reload --- .../Indyuce/mmocore/api/player/PlayerData.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 1f85a8ed..8f9a5f78 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -138,6 +138,11 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc /** * Update all references after /mmocore reload so there can be garbage * collection with old plugin objects like class or skill instances. + *

+ * It's OK if bound skills disappear because of a configuration issue + * on the user's end. After all this method is only called when using + * /reload and /reload is considered a bad practice. If any error + * happens then just don't update the player's skill. */ public void update() { @@ -152,16 +157,9 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc while (j < boundSkills.size()) try { boundSkills.set(j, getProfess().getSkill(boundSkills.get(j).getSkill())); + } catch (Exception ignored) { + } finally { j++; - } catch (NullPointerException npe1) { - boundSkills.remove(j); - try { - MMOCore.log(Level.SEVERE, "[Userdata] Could not find skill " + boundSkills.get(j).getSkill().getHandler().getId() + " in class " - + getProfess().getId() + " while refreshing player data."); - } catch (NullPointerException npe2) { - MMOCore.log(Level.SEVERE, - "[Userdata] Could not find unidentified skill in class " + getProfess().getId() + " while refreshing player data."); - } } } @@ -868,7 +866,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc * checks if they could potentially upgrade to one of these * * @return If the player can change its current class to - * a subclass + * a subclass */ public boolean canChooseSubclass() { for (Subclass subclass : getProfess().getSubclasses())