Fixed two random NPE

This commit is contained in:
ASangarin 2020-12-17 01:46:03 +01:00
parent 0aa36dacd5
commit 753f63104a
2 changed files with 10 additions and 4 deletions

View File

@ -28,7 +28,8 @@ public class CraftItemExperienceSource extends SpecificExperienceSource<Material
return new ExperienceManager<CraftItemExperienceSource>() {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void a(CraftItemEvent event) {
if(event.getAction() == InventoryAction.NOTHING) return;
if(event.getAction() == InventoryAction.NOTHING ||
event.getInventory().getResult() == null) return;
PlayerData data = PlayerData.get((Player) event.getWhoClicked());
for (CraftItemExperienceSource source : getSources())
if (source.matches(data, event.getInventory().getResult().getType()))

View File

@ -136,10 +136,15 @@ public class PlayerData extends OfflinePlayerData {
try {
boundSkills.set(j, getProfess().getSkill(boundSkills.get(j).getSkill()));
j++;
} catch (NullPointerException notFound) {
} catch (NullPointerException npe1) {
boundSkills.remove(j);
MMOCore.log(Level.SEVERE, "[Userdata] Could not find skill " + boundSkills.get(j).getSkill().getId() + " in class "
+ getProfess().getId() + " while refreshing player data.");
try {
MMOCore.log(Level.SEVERE, "[Userdata] Could not find skill " + boundSkills.get(j).getSkill().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.");
}
}
}