Conversation
Contributor
|
Pro Tip!
If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀 |
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.
Description
This PR addresses a critical item duplication exploit involving Explosive Tools (e.g., Explosive Pickaxe) and blocks that rely on a support block (e.g., Elevator Plates, Rails, Torches, Carpets).
The Issue:
Previously, when an Explosive Tool was used on a cluster of blocks, the order of destruction was not determined by height. If the tool destroyed the supporting block (floor) before the attached block (Elevator Plate):
This resulted in infinite duplication of Elevator Plates and similar items.
Proposed changes
Modified
ExplosiveTool.javato implement a sorting mechanism for the destruction list.Y-Level Sorting: The list of blocks to be destroyed (
blocksToDestroy) is now sorted by Y-level in descending order (Top to Bottom).blocksToDestroy.sort((b1, b2) -> Integer.compare(b2.getY(), b1.getY()));Safety Check: Added a validation check
if (block.getType() != Material.AIR)before breaking to ensure the tool does not attempt to break a block that has already been removed by other means/plugins.This change completely resolves the duplication glitch while maintaining the intended behavior of the Explosive Tool.
Related Issues (if applicable)
Resolves #4037
Checklist
NonnullandNullableannotations to my methods to indicate their behaviour for null values