Skip to content

Commit

Permalink
Fix offhand tool getter in tool change event (#5095)
Browse files Browse the repository at this point in the history
  • Loading branch information
TUCAOEVER authored Oct 22, 2022
1 parent b13c29c commit 8d6cf1f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/expressions/ExprTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected Slot[] get(final Event e, final LivingEntity[] source) {
@Nullable
public Slot get(final LivingEntity ent) {
if (!delayed) {
if (e instanceof PlayerItemHeldEvent && ((PlayerItemHeldEvent) e).getPlayer() == ent) {
if (!offHand && e instanceof PlayerItemHeldEvent && ((PlayerItemHeldEvent) e).getPlayer() == ent) {
final PlayerInventory i = ((PlayerItemHeldEvent) e).getPlayer().getInventory();
return new InventorySlot(i, getTime() >= 0 ? ((PlayerItemHeldEvent) e).getNewSlot() : ((PlayerItemHeldEvent) e).getPreviousSlot());
} else if (e instanceof PlayerBucketEvent && ((PlayerBucketEvent) e).getPlayer() == ent) {
Expand Down

0 comments on commit 8d6cf1f

Please sign in to comment.