fix: correct remove method signature and its calls#73
Open
kaaams wants to merge 1 commit intoArtillex-Studios:masterfrom
Open
fix: correct remove method signature and its calls#73kaaams wants to merge 1 commit intoArtillex-Studios:masterfrom
kaaams wants to merge 1 commit intoArtillex-Studios:masterfrom
Conversation
- Modify remove() method to accept boolean dropInventory parameter - Fix call in update() to use lambda instead of method reference - Update all remove() calls throughout codebase - Add grave removal when GravePreSpawnEvent is cancelled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: GravePreSpawnEvent cancellation prevents item duplication Artillex-Studios/Issues#380
Description
Fixes a bug where cancelling a
GravePreSpawnEventwould still create a grave with items inside while also dropping items on the ground, causing item duplication.Problem
When
GravePreSpawnEvent.setCancelled(true)was called:Solution
This PR implements proper event cancellation handling:
Changes Made
Modified
remove()method signature inGrave.java:boolean dropInventoryparameter to control whether items should be droppedremoveInventory()based on the parameterFixed scheduler call in
Grave.java:Scheduler.get().runAt(location, this::remove)toScheduler.get().runAt(location, () -> remove(true))Updated all
remove()calls throughout the codebase:AxGraves.java:grave.remove(true)- drops inventory on plugin disableSpawnedGraves.java:oldest.remove(true)- drops inventory when limit exceededDeathListener.java:grave.remove(false)- prevents item drop when event is cancelledImplemented proper cancellation handling in
DeathListener.java:GravePreSpawnEventis cancelled, the grave is removed without dropping itemsExpected Behavior After Fix
When
GravePreSpawnEvent.setCancelled(true)is called:remove(false))Testing
The fix ensures that:
Breaking Changes
None. This is a bug fix that maintains backward compatibility while properly implementing the intended event cancellation behavior.
Type: Bug Fix
Scope: Event handling and grave management
Impact: Prevents item duplication, fixes compilation errors