InventoryClickEvent puts Skulls on like hats
kennyrkun opened this issue ยท 5 comments
Information
Full output of /ess version
:
[22:02:14 INFO]: CONSOLE issued server command: /ess version
[22:02:14 INFO]: Server version: 1.9.4-R0.1-SNAPSHOT git-Spigot-c6871e2-0cd0397 (MC: 1.9.4)
[22:02:14 INFO]: EssentialsX version: 2.15.0.1
[22:02:14 INFO]: PermissionsEx version: 1.23.4
[22:02:14 INFO]: EssentialsXProtect version: 2.15.0.1
[22:02:14 INFO]: EssentialsXChat version: 2.15.0.1
[22:02:14 INFO]: EssentialsXGeoIP version: 2.15.0.1
[22:02:14 INFO]: EssentialsXAntiBuild version: 2.15.0.1
[22:02:14 INFO]: EssentialsXSpawn version: 2.15.0.1
[22:02:14 INFO]: Vault version: 1.5.6-b49
Server log: latest.log
EssentialsX config: config.yml
Details
Description
Essentials allows users with the essentials.hat
permission and the allow direct hat enabled to put items directly on their heads. It does this by cancelling the InventoryClickEvent and manually setting the item in the helmet slot. The bug here is when a user puts on a Skull, Essentials overrides the default Minecraft behaviour and puts the Skull on manually. This causes plugins looking for Skull equip events to fail because Essentials cancels the event.
The code in question is this:
Steps to reproduce
- Put a skull on your head by dragging it into the helmet slot and releasing it.
Expected behavior
Minecraft should put the helmet on itself, not Essentials.
this fix should be as simple as adding && event.getCursor().getType() != Material.SKULL_ITEM
to the if statement, right? if it is I can whip up a pull request right now.
In 2.16 (the 1.13 branch), you need to use MaterialUtil
to ensure it works across both 1.12 and 1.13.
So the proper check to implement would be && MaterialUtil.isSkull(event.getCursor().getType())
?
Fixed in dd41b10 - you can download 2.16.0.16 from the build server.