EssentialsX

EssentialsX

2M Downloads

`essentials.keepinv` permission stops player loot table from dropping (breaking data packs), unlike `/gamerule keepInventory true`

GrantGryczan opened this issue ยท 0 comments

commented

Type of bug

Compatibility issue, Other unexpected behaviour

/ess dump all output

I'm using EssentialsX 2.21.0-dev+102-fcf6e64 (latest as of writing) on CraftBukkit version 4254-Bukkit-bd4e8c3 (MC: 1.21) (Implementing API version 1.21-R0.1-SNAPSHOT).

/ess dump all currently outputs "Error while creating dump error code: 504." which sounds like an issue on the web server's end. If necessary, I can update this issue with a dump later after that issue is resolved.

Error log (if applicable)

No response

Bug description

Players with the essentials.keepinv permission should keep their inventory on death, but they should still drop their loot table. For example, using the Player Head Drops data pack from Vanilla Tweaks which makes a player killing another player drop their head, the head of a player with the essentials.keepinv permission will never drop.

Other data packs, such as Graves from Vanilla Tweaks, use player loot tables to save data from just before a player dies. It's otherwise impossible to do so (at least without saving the player's NBT data every tick, which would be just about the laggiest thing a data pack can do). A data pack using this method adds to the player loot table an item which copies data from the player onto it via an item modifier, so that the data is persisted and can be read after the player dies. But with this bug, any data packs that rely on this method of saving player data on death (such as items from their inventory or how much XP they had) won't find the loot table item for any players with the essentials.keepinv permission.

Steps to reproduce

  1. On a 1.21 server, install this minimal reproduction data pack to your world by copying it into the server's world > datapacks folder. This adds an unconditional player head to the player's loot table.
  2. Enter /minecraft:reload to load the data pack.
  3. Give your player the essentials.keepinv permission. (Or if testing without EssentialsX for comparison, enter /gamerule keepInventory true.)
  4. Enter /minecraft:kill.

Expected behaviour

Just like using /gamerule keepInventory true, dying with the essentials.keepinv permission should drop your loot table.

Actual behaviour

With EssentialsX, using the essentials.keepinv permission, dying does not drop your loot table.

Additional Information

It's important to emphasize that not only does this bugged behavior deviate from the vanilla gameplay functionality of keepInventory (e.g. players not dropping their heads when killed with a data pack like Player Head Drops), but it also causes incompatibilities with other data packs that rely on player loot tables to preserve player information on death. And again, there isn't really any efficient alternative that works as well as using a player loot table, so data packs have no workaround for this. Using Graves as an example again, this bug currently causes a big warning to show up in chat due to the loot table item not being detected every time a player with this permission dies.