1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Merge pull request #2988 from martinbrom/fix/talisman-of-the-anvil

Fixes NPE when hand is empty while talisman of the anvil triggers
This commit is contained in:
Daniel Walsh 2021-04-24 12:22:59 +01:00 committed by GitHub
commit 2f27ddc6a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -196,8 +196,8 @@ public class TalismanListener implements Listener {
PlayerInventory inv = e.getPlayer().getInventory(); PlayerInventory inv = e.getPlayer().getInventory();
int slot = inv.getHeldItemSlot(); int slot = inv.getHeldItemSlot();
// Did the tool in our hand broke or was it an Armorpiece? // Did the tool in our hand break or was it an armor piece?
if (!inv.getItem(inv.getHeldItemSlot()).equals(e.getBrokenItem())) { if (!e.getBrokenItem().equals(inv.getItemInMainHand())) {
for (int s : armorSlots) { for (int s : armorSlots) {
if (e.getBrokenItem().equals(inv.getItem(s))) { if (e.getBrokenItem().equals(inv.getItem(s))) {
slot = s; slot = s;