Inventory NPE fix

This commit is contained in:
nossr50 2020-07-02 21:04:06 -07:00
parent ce03e6613f
commit 900a534edb
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,6 @@
Version 2.1.132
Fixed a NPE that could happen when players swapped items from their hotbar
Version 2.1.131
New permission node 'mcmmo.ability.repair.netheriterepair' which is included in the mcmmo.defaults permission package

View File

@ -435,8 +435,9 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryClickEvent(InventoryClickEvent event) {
SkillUtils.removeAbilityBuff(event.getCurrentItem());
if (event.getAction() == InventoryAction.HOTBAR_SWAP) {
SkillUtils.removeAbilityBuff(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()));
if (event.getAction() == InventoryAction.HOTBAR_SWAP) {\
if(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()) != null)
SkillUtils.removeAbilityBuff(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()));
}
}