Skip to content

Commit

Permalink
Fix shields behaving strangely
Browse files Browse the repository at this point in the history
  • Loading branch information
Travja committed Feb 6, 2025
1 parent 028fb4a commit 5dbfbd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void onHandDrag(InventoryDragEvent e) {
Player player = (Player) e.getWhoClicked();
Set<Integer> slots = e.getRawSlots();

if (slots.contains(45)) { // Offhand
if (slots.contains(40)) { // Offhand
plugin.lang().Module_Item_Interact_Error_Hand.send(player);
e.setCancelled(true);
e.setResult(Event.Result.DENY);
Expand Down Expand Up @@ -125,13 +125,14 @@ public void onHandHoldOffClick(InventoryClickEvent e) {
if (handAtt != null && handAtt.getType() == HandAttribute.Type.TWO) {
plugin.lang().Module_Item_Interact_Error_Hand.send(player);
e.setCancelled(true);
player.updateInventory();
} else {
if (this.holdMainTwo(player)) {
plugin.lang().Module_Item_Interact_Error_Hand.send(player);
e.setCancelled(true);
player.updateInventory();
}
}
player.updateInventory();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public void onRequirementsItemDrag(InventoryDragEvent e) {

Player player = (Player) e.getWhoClicked();
Set<Integer> slots = e.getRawSlots();
Set<Integer> deny = Sets.newHashSet(5, 6, 7, 8, 45);
Set<Integer> deny = Sets.newHashSet(36, 37, 38, 39, 40);

boolean doCheck = slots.stream().anyMatch(slotRaw -> deny.contains(slotRaw));
boolean doCheck = slots.stream().anyMatch(deny::contains);

if (doCheck && !ItemUtils.canUse(drag, player)) {
e.setCancelled(true);
Expand Down

0 comments on commit 5dbfbd8

Please sign in to comment.