xfl03 / MCCustomSkinLoader

Customize Skin, Cape and Elytra in Minecraft 1.8-1.21
GNU General Public License v3.0
500 stars 33 forks source link

CSL is overriding in-game change skin packets #179

Closed AchiraE closed 3 years ago

AchiraE commented 3 years ago

Description

I have an RPG server that heavily relies on in-game skin changes. The skin change is done by setting the player's GameProfile and sending some refresh packets. This mechanism works for most of the players, regardless of online/offline mode or Mojang/offline accounts.

However, if the player has the CustomSkinLoader Mod installed, CSL will override all the skin packets, so their skins will always remain unchanged.

Expected behavior

CSL should only set the player's skin during login. Subsequent in-game changes of skin should not be overridden.

Notes

The change of skin is done by Paper's Player#setPlayerProfile. (Or the following three packets, if you prefer a packet-level view).

  1. remove the player (Player Info Packet)
  2. add the player with new GameProfile(new skin texture) (Player Info Packet)
  3. respawn the player in-place (Respawn Packet)
ZekerZhayard commented 3 years ago

Theoretically speaking, this problem is caused by too long cache invalidation time.

When the player respawns, the CustomSkinLoader will request the skin again - this was confirmed when I played pvp servers before.

CustomSkinLoader sets a default cache time of 30 seconds to avoid too many requests for skin sites. If the player respawn interval is less than the set cache time, then the old skin will be used. You can modify this time in the config file (.minecraft/CustomSkinLoader/CustomSkinLoader.json -> cacheExpiry). Setting cacheExpiry to a value less than -5 means that the caching of the requested skin is completely disabled.

AchiraE commented 3 years ago

Wow, that works! Thanks!