Fix #242: enforce shulker entity limit on Paper via ShulkerDuplicateEvent#243
Merged
tastybento merged 5 commits intomasterfrom Feb 20, 2026
Merged
Fix #242: enforce shulker entity limit on Paper via ShulkerDuplicateEvent#243tastybento merged 5 commits intomasterfrom
tastybento merged 5 commits intomasterfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vent On Paper servers, CreatureSpawnEvent fires for the new shulker *after* the original shulker has already teleported away. If the original shulker teleports outside the island bounding box, getNearbyEntities counts N-1 shulkers instead of N, so the limit check incorrectly allows duplication past the configured limit. Paper's ShulkerDuplicateEvent fires *before* the original shulker teleports and before the duplicate is created, so the island entity count is accurate. Register PaperShulkerLimitListener when Paper is detected at runtime; fall back to the existing CreatureSpawnEvent handling on Spigot. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Change Paper API dependency from 1.21.8 to 1.20.4, which is the last version compiled for Java 17. Paper 1.20.6+ targets Java 21 (class version 65), which the compiler rejects under --release 17. - Stage the remaining add_tags source files (IslandBlockCount, BlockLimitsListener, RecountCalculator, etc.) that Limits.java depends on; they were missing from the previous commit, causing NamespacedKey / Material type mismatches in CI. - Fix @AfterEach (JUnit 5) -> @after (JUnit 4) in the three test files that have JUnit 4 imports; the annotation was unresolved in CI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fc312d8 to
7dc5736
Compare
Add isLogLimitsOnJoin() config option (from master commit bdf41ea) so that the verbose per-permission log lines can be silenced. Wraps each addon.log() call in checkPerms/runNullCheckAndSet with the guard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Conflict in JoinListener.java resolved by keeping the add_tags/PR branch version, which already incorporates the log-limits-on-join changes from master commit bdf41ea. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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.




Summary
PaperShulkerLimitListenerwhich handles Paper'sShulkerDuplicateEventto enforce shulker limits before duplication occurs.providedMaven dependency (compile-time only; not bundled in the jar).Root cause
On Paper,
CreatureSpawnEvent(withSpawnReason.DUPLICATION) fires for the new shulker after the original shulker has already teleported to a new position. If the original shulker teleports outside the island's protection bounding box,getNearbyEntities(island.getBoundingBox())counts N−1 shulkers instead of N. This makes the limit check think there is room for one more, allowing duplication past the configured limit. Each farm cycle can leak one shulker outside the island, which then duplicates freely with no limit applied at all.Paper's
ShulkerDuplicateEventfires before the original shulker teleports and before the duplicate is created, so the entity count within the island bounding box is accurate. Cancelling this event prevents both the teleport and the duplicate.How it works
PaperShulkerLimitListeneris registered at startup (detected viaClass.forName). It cancelsShulkerDuplicateEventwhen the island is at its shulker entity limit.CreatureSpawnEvent/SpawnReason.DUPLICATIONpath is unchanged.ClassNotFoundExceptionis silently caught and no Paper listener is registered.Test plan
SHULKERentity limit to a small value (e.g. 2) inentitylimitsconfig.🤖 Generated with Claude Code