Hotbar button cannot be negative, fixes #1631

This commit is contained in:
PikaMug 2021-03-05 06:33:48 -05:00
parent ce56f9e326
commit 00d9dc9abf
1 changed files with 5 additions and 4 deletions

View File

@ -94,10 +94,11 @@ public class PlayerListener implements Listener {
evt.setCancelled(true);
return;
}
} else if (ac.equals(InventoryAction.SWAP_WITH_CURSOR)) {
final ItemStack item = evt.getWhoClicked().getInventory().getItem(evt.getHotbarButton());
if (item != null) {
if (ItemUtil.isItem(item) && ItemUtil.isJournal(item)) {
} else if (ac.equals(InventoryAction.SWAP_WITH_CURSOR) || ac.equals(InventoryAction.HOTBAR_SWAP)
|| ac.equals(InventoryAction.HOTBAR_MOVE_AND_READD)) {
if (evt.getHotbarButton() > -1) {
final ItemStack item = evt.getWhoClicked().getInventory().getItem(evt.getHotbarButton());
if (ItemUtil.isItem(item) && ItemUtil.isJournal(item)) {
evt.setCancelled(true);
return;
}