Essentials: InventoryClickEvent puts Skulls on like hats

Created on 31 Dec 2018  路  5Comments  路  Source: EssentialsX/Essentials

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: https://github.com/EssentialsX/Essentials/blob/7b67b3b8580b174ef5ac21044fd97665b93ef8aa/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java#L726-L736

Steps to reproduce

  1. 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.

confirmed open to PR

All 5 comments

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()) ?

Yes - feel free to PR this.

Fixed in dd41b10522b512a450a97907f36bd71fd8cd6554 - you can download 2.16.0.16 from the build server.

Was this page helpful?
0 / 5 - 0 ratings