Cancel hotkeying journal into inventory (#1619)

* Cancel hotkeying journal into inventory

Previously, a journal could be moved into another inventory by putting it in a hotkey slot and pressing the corresponding hotkey while hovering over any slot in the target inventory.

* syntax fix

* forgot the return
This commit is contained in:
John Locke 2021-02-22 21:42:38 -05:00 committed by GitHub
parent e4b8779325
commit fcad9600cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -94,6 +94,14 @@ public class PlayerListener implements Listener {
evt.setCancelled(true);
return;
}
} else if (ac.equals(InventoryAction.SWAP_WITH_CURSOR))) {
ItemStack item=evt.getWhoClicked().getInventory().getItem(event.getHotbarButton());
if (item!=null) {
if (ItemUtil.isItem(item) && ItemUtil.isJournal(item)) {
evt.setCancelled(true);
return;
}
}
}
if (ItemUtil.isItem(evt.getCurrentItem()) && ItemUtil.isJournal(evt.getCurrentItem())
|| ItemUtil.isItem(evt.getCursor()) && ItemUtil.isJournal(evt.getCursor())) {