Forgotten Graves

Forgotten Graves

273k Downloads

[BUG] ON_USE retrieval type ignored by operator override

ginsm opened this issue ยท 1 comments

commented

Describe the bug
If you have the appropriate operator override level you can still break graves while retrieval type is set to ON_USE. However, useGrave will still prevent you from receiving any of the loot.

Forgotten Graves Version
v1.2.0 (affects v1.1.0 as well)

To Reproduce

  1. Set Minimum OP Level Override to 4 (and make sure you are oped).
  2. Set your Retrieval Type to ON_USE.
  3. Spawn a grave that you do not own (see additional context).
  4. Break the grave you spawned.

Expected behavior
There are two things that could be expected when Retrieval Type is set to ON_USE for players who meet the operator level requirements:

  1. The operator can override Retrieval Type and retrieve the grave (i.e. they would still get the items/XP).
  2. The operator cannot override the Retrieval Type and thus cannot break the grave.

I'm not entirely sure which I prefer. I'm going to choose the latter but if someone requests the former I wouldn't be opposed.

Additional context
This likely takes place in the PlayerBlockBreakEvents.BEFORE event handler.

Here's the command to spawn a grave that you do not own:

/setblock ~ ~ ~ forgottengraves:grave{XP: 0, ItemCount: 41, Items: {Items: [{Slot: 0b, id: "minecraft:wheat_seeds", Count: 1b}]}, id: "forgottengraves:grave", GraveOwner: {Id: [I; -147600996, 943405439, -1674657691, 1983108200], Name: "DUMMY"}}
commented

Commit d0dcae4 resolved this issue.

The issue occurred due to the order of the conditionals in the PlayerBlockBreakEvents.BEFORE event handler.

Closing.