Skip to content

Fix player disguise skin being comma-split before setSkin#1514

Open
mvanhorn wants to merge 2 commits into
elBukkit:mainfrom
mvanhorn:fix/1484-disguise-skin-comma-split
Open

Fix player disguise skin being comma-split before setSkin#1514
mvanhorn wants to merge 2 commits into
elBukkit:mainfrom
mvanhorn:fix/1484-disguise-skin-comma-split

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #1484

Summary

Player disguises with a custom skin were rendering as a default Minecraft character instead of the configured skin. The fix reads a single-string skin value verbatim instead of running it through list-loading logic that splits on commas, while keeping weighted random selection for list-form skin configs.

Why

As reported in the issue, the skin value arrives at PlayerDisguise.setSkin already fragmented. The PLAYER case in ModernLibsDisguiseManager.disguise() reads the skin value through RandomUtils.createStringProbabilityMap(configuration, "skin"). For a plain single string this descends into ConfigUtils.getList(Object), which does StringUtils.split((String) o, ','). A Mojang skin property is a single JSON string full of commas, so it gets split into meaningless fragments before it ever reaches LibsDisguises, and the custom skin never loads.

Changes

Only build the weighted probability map when the skin node is actually a YAML list or configuration section (the legitimate random-skin case, where each whole entry is preserved by ConfigurationSection.getList). Otherwise read the value verbatim with configuration.getString("skin"), so a single comma-laden JSON skin string is passed to setSkin untouched.

This leaves the shared RandomUtils / ConfigUtils helpers unchanged, since other callers rely on their comma-splitting behavior.

Behavior

  • Single JSON skin string: the full untouched string reaches setSkin.
  • YAML list of skins: weighted random selection still picks one whole entry.
  • skin as a value-to-weight section: unchanged.
  • skin absent: falls back to name-only exactly as before.
  • Bare skin/player name with no commas: passes through unchanged.

The PLAYER disguise case loaded the skin value through
RandomUtils.createStringProbabilityMap, which for a plain string
descends into ConfigUtils.getList and splits it on commas. A Mojang
skin property is a single comma-laden JSON string, so it was
fragmented into garbage before reaching PlayerDisguise.setSkin,
causing custom skins to render as default characters.

Only build the weighted probability map when the skin node is
actually a YAML list or configuration section; otherwise read the
value verbatim so a single JSON skin string passes through untouched.
@NathanWolf

Copy link
Copy Markdown
Member

Thank you! That makes sense, and I like the fix. Unfortunately we got some merge conflicts because I changed all the weighted maps to List instead of Dequeu. I tried to resolve the conflict here but it didn't work.

I always like to take PRs rather than applying changes directly for attribution, but I don't know why the github resolution didn't work :(

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 - mmob Disguise player's skin not loading.

2 participants