Skip to content

fancynpcs: Fix legacy formatting in team names - #313

Open
flennium wants to merge 1 commit into
FancyInnovations:mainfrom
flennium:fix/fancynpcs-legacy-team-name
Open

fancynpcs: Fix legacy formatting in team names#313
flennium wants to merge 1 commit into
FancyInnovations:mainfrom
flennium:fix/fancynpcs-legacy-team-name

Conversation

@flennium

@flennium flennium commented Aug 5, 2026

Copy link
Copy Markdown

Description

Fixes #290.

FancyNpcs generated hidden fake player names with legacy formatting codes and reused that same value as the scoreboard team identifier. This PR keeps the hidden local player name unchanged, but gives each NPC a separate plain ASCII team name before creating PlayerTeam packets.

Checklist

  • My code follows the project's coding style and guidelines
  • I have tested my changes locally and they work as expected
  • I have added necessary documentation (if applicable)
  • I have linked related issues using Fixes #290 or Closes #290
  • I have rebased/merged with the latest main branch

Changes

  • Added a separate teamName field to Npc, generated once per NPC instance.
  • Replaced "npc-" + localName with the plain teamName in all active FancyNpcs v2 NMS implementations.
  • Left localName unchanged for fake player/GameProfile names, so NPC name hiding behavior stays the same.

Evidence

Buggy FancyNpcs 2.11.0 on Paper 1.21.11 with Nexo 1.25.1:

[16:58:26] [Server thread/WARN]: [FancyNpcsLegacyTeamRepro] BUG REPRODUCED: FancyNpcs NPC class de.oliver.fancynpcs.v1_21_11.Npc_1_21_11 has no separate teamName field; team name is derived from legacy-coded localName.

Fixed jar with the same server/plugins:

[17:08:00] [Server thread/INFO]: [FancyNpcsLegacyTeamRepro] FIX VERIFIED: FancyNpcs teamName is plain and separate from localName.

How to Test

  1. Start Paper 1.21.11 with FancyNpcs 2.11.0, Nexo 1.25.1, and a small repro plugin that creates a FancyNpcs API NPC.
  2. With the buggy jar, run /fnlegacyrepro npc then /fnlegacyrepro inspect; the repro confirms the team name is derived from the legacy-coded localName.
  3. With this fix applied, run /fnlegacyrepro cleanup, /fnlegacyrepro npc, then /fnlegacyrepro inspect.
  4. Confirm the repro logs: FIX VERIFIED: FancyNpcs teamName is plain and separate from localName.

Local checks run:

  • rg -n -F '"npc-" + localName' plugins\fancynpcs-v2 returned no matches.
  • git diff --check passed.
  • ./gradlew.bat --no-daemon --console=plain :plugins:fancynpcs-v2:fn-v2-api:build passed.
  • Manual fixed-server verification passed on Paper 1.21.11 with Nexo 1.25.1.

Known local environment blocker:

  • ./gradlew.bat --no-daemon --console=plain :plugins:fancynpcs-v2:shadowJar and ./gradlew.bat --no-daemon --console=plain test fail before this code compiles because Paper's 1.21.11 dev bundle resolves net.kyori:adventure-text-serializer-ansi without a version for :libraries:packets:implementations:1_21_11:compileJava.

@flennium

flennium commented Aug 5, 2026

Copy link
Copy Markdown
Author

I used a small local repro plugin to verify this.

It creates a FancyNpcs API NPC, then reflects the runtime NPC fields:

  • buggy 2.11.0: no separate teamName field; team name is derived from legacy-coded localName
  • fixed build: teamName exists and contains no legacy formatting

I can provide the repro plugin source if needed.

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.

Bug: FancyNPCs using legacy colors for team names causing warnings in other plugins

1 participant