fixed error message when using /mmocore reload

This commit is contained in:
Indyuce 2022-01-30 13:36:42 +01:00
parent d4f1477bea
commit 832e1e4d34

View File

@ -138,6 +138,11 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
/** /**
* Update all references after /mmocore reload so there can be garbage * Update all references after /mmocore reload so there can be garbage
* collection with old plugin objects like class or skill instances. * collection with old plugin objects like class or skill instances.
* <p>
* 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() { public void update() {
@ -152,16 +157,9 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
while (j < boundSkills.size()) while (j < boundSkills.size())
try { try {
boundSkills.set(j, getProfess().getSkill(boundSkills.get(j).getSkill())); boundSkills.set(j, getProfess().getSkill(boundSkills.get(j).getSkill()));
} catch (Exception ignored) {
} finally {
j++; 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.");
}
} }
} }