Skip to content

Fix: InvincibleVisitors mob-targeting protection incorrectly blocks XP orbs from tracking visitors#2948

Merged
tastybento merged 2 commits intodevelopfrom
copilot/fix-xp-pickup-for-visitors
Apr 18, 2026
Merged

Fix: InvincibleVisitors mob-targeting protection incorrectly blocks XP orbs from tracking visitors#2948
tastybento merged 2 commits intodevelopfrom
copilot/fix-xp-pickup-for-visitors

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 18, 2026

EXPERIENCE_PICKUP flag set to Visitor rank had no effect — visitors still couldn't pick up XP on other islands when Invincible Visitors was enabled with ENTITY_ATTACK.

Root Cause

InvincibleVisitorsListener.onVisitorTargeting (HIGHEST priority) cancels EntityTargetLivingEntityEvent for any entity targeting a visitor not on their own island. Experience orbs use this same event to home in on players, so they were caught by the mob-targeting suppression — orbs never flew toward visitors, making pickup effectively impossible.

Fix

  • InvincibleVisitorsListener: Skip cancellation when e.getEntity() instanceof ExperienceOrb. XP orbs can't harm players; the EXPERIENCE_PICKUP flag on PaperExperiencePickupListener/ExperiencePickupListener already governs whether pickup is actually allowed.
if (!(e.getTarget() instanceof Player p) ||
        !this.getIWM().inWorld(world) ||
        e.getTarget().hasMetadata("NPC") ||
        e.getEntity() instanceof ExperienceOrb ||   // ← new
        this.getIslands().userIsOnIsland(world, User.getInstance(e.getTarget())) ||
        ...
  • InvincibleVisitorsListenerTest: Added tests covering mob targeting cancellation, XP orb targeting (must not cancel), no ENTITY_ATTACK in IV settings, and island-owner (non-visitor) path.

Copilot AI changed the title [WIP] Fix issue allowing visitors to pick up XP on islands Fix: InvincibleVisitors mob-targeting protection incorrectly blocks XP orbs from tracking visitors Apr 18, 2026
Copilot AI requested a review from tastybento April 18, 2026 04:26
@tastybento tastybento marked this pull request as ready for review April 18, 2026 04:29
@sonarqubecloud
Copy link
Copy Markdown

@tastybento tastybento merged commit 60311a2 into develop Apr 18, 2026
3 checks passed
@tastybento tastybento deleted the copilot/fix-xp-pickup-for-visitors branch April 18, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visitors cannot pick up XP on other islands

2 participants