Ajneb97 / ConditionalEvents

MIT License
22 stars 12 forks source link

player_swap_hand doesn't block offhand #58

Open baailey opened 6 months ago

baailey commented 6 months ago

When trying to block moving an item into your offhand, player_swap_hand will instead block moving the item out of the offhand. Unless there is a different way of blocking this, it seems like player_swap_hand may be bugged?

Ajneb97 commented 6 months ago

It's only using the PlayerSwapHandItemsEvent event from Spigot, so if you think is a bug, then it's a bug with Spigot.

baailey commented 6 months ago

then what measure would you recommend to block any items going into the offhand?

Ajneb97 commented 6 months ago

I mean, that event should be working. You could try to check on the spigot forums why the event PlayerSwapHandItemsEvent (https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerSwapHandItemsEvent.html) doesn't work.

This is the description of the event: "Called when a player swap items between main hand and off hand using the hotkey."

Maybe it's not what you are looking for?

baailey commented 6 months ago

I mean, it should be what I need. From the description, it's exactly what I need in-fact. For my use-case, I don't want players to be able to move a specific item into their off-hand, however when testing, the item I'm blocking can be moved into the off-hand, but then is blocked when trying to swap it back into the main hand.

This is the basic set-up I'm testing with

Ajneb97 commented 6 months ago

I will have to take a look into it when I have the time.