Fix player disguise skin being comma-split before setSkin#1514
Open
mvanhorn wants to merge 2 commits into
Open
Fix player disguise skin being comma-split before setSkin#1514mvanhorn wants to merge 2 commits into
mvanhorn wants to merge 2 commits into
Conversation
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.
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 :( |
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.
Fixes #1484
Summary
Player disguises with a custom
skinwere 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.setSkinalready fragmented. ThePLAYERcase inModernLibsDisguiseManager.disguise()reads theskinvalue throughRandomUtils.createStringProbabilityMap(configuration, "skin"). For a plain single string this descends intoConfigUtils.getList(Object), which doesStringUtils.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
skinnode is actually a YAML list or configuration section (the legitimate random-skin case, where each whole entry is preserved byConfigurationSection.getList). Otherwise read the value verbatim withconfiguration.getString("skin"), so a single comma-laden JSON skin string is passed tosetSkinuntouched.This leaves the shared
RandomUtils/ConfigUtilshelpers unchanged, since other callers rely on their comma-splitting behavior.Behavior
setSkin.skinas a value-to-weight section: unchanged.skinabsent: falls back to name-only exactly as before.