
item_swap event docs don't match actual behavior
Nilleke opened this issue ยท 1 comments
According to the docs the item_swap
event is supposed to return:
- player
- main_hand: the item array in the main hand before swapping
- off_hand: the item in the off hand
Note main_hand specifically says "before swapping", yet it seems to return the state after the items would be swapped. Even when you cancel the event. This also applies to the prefilters.
This behavior seems to match the bukkit javadoc (1.9-1.19.3):
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerSwapHandItemsEvent.html
ItemStack getMainHandItem() Gets the item switched to the main hand.
ItemStack getOffHandItem() Gets the item switched to the off hand.
Code to replicate the issue:
bind('item_swap', null, array('main_hand': 'REPEATER'), @event){
/* This only fires while holding a repeater in the offhand */
cancel()
msg(@event['main_hand'])
}
Tested on:
CommandHelper-3.3.5-b309
Purpur-1.19.3-b1895