CustomSkinLoader

CustomSkinLoader

1M Downloads

BUG: CSL tries to load profile for 'invalid' users

UMRnInside opened this issue · 6 comments

commented

Description

Some BungeeCord servers support displaying cross-subserver players in Tab menu.
However, there are servers that have cross-subserver players' name (e.g. Notch) replaced by BTLP Slot 12, causing CSL to load BTLP Slot 12's profile, rather than Notch. Note there are spaces in BTLP Slot 12

Log

[17:14:34] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 51 INFO]  BTLP Slot 51's profile not found in load list.
[17:14:34] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] Loading  BTLP Slot 52's profile.
[17:14:34] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] 1/7 Try to load profile from 'Mojang'.
[17:14:34] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] Payload: [" BTLP Slot 52"]
[17:14:35] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] Profile not found.( BTLP Slot 52's profile not found.)
[17:14:35] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] 2/7 Try to load profile from 'LittleSkin'.
[17:14:36] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] Both skin and cape not found.
[17:14:36] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] 3/7 Try to load profile from 'BlessingSkin'.
[17:14:37] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] Profile not found.
[17:14:37] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] 4/7 Try to load profile from 'ElyBy'.
[17:14:37] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] Profile not found.
[17:14:37] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] 5/7 Try to load profile from 'SkinMe'.
[17:14:37] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] Error 404: User not found.
[17:14:37] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] 6/7 Try to load profile from 'LocalSkin'.
[17:14:37] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] Both skin and cape not found.
[17:14:37] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] 7/7 Try to load profile from 'GlitchlessGames'.
[17:14:38] [<player>/INFO] [STDOUT]: [customskinloader.Logger:log:70]: [ BTLP Slot 52 INFO] Profile not found.

Expected behavior

CSL should check if the username is valid before trying to load one's profile.
Or at least, check if username starts with (a space).

commented

CustomSkinLoader gets uernames via com/mojang/authlib/GameProfile::name rather than net/minecraft/client/network/NetworkPlayerInfo::displayName.

IMO the username should be determined by the server plugin instead of guessing by CSL because there are too many servers using strange prefixes or suffixes in display names such as [平民]LexManos or LexManos [平民].

And a username with spaces is indeed valid in offline mode.

commented

@ZekerZhayard Some offline mode servers (like mc.66ko.cc:25565) did manipulations in Tab list, which has NO EFFECT on NetworkPlayerInfo::displayName, but greatly changed the behavior of GameProfile::name (returning BTLP Slot 12, rather than real name Notch)

A Node.JS example (requires Mineflayer):

const mineflayer = require('mineflayer')

const bot = mineflayer.createBot({
    host: "mc.66ko.cc",
    port: 25565,
    username: 'PlayerLister',
    version: "1.12.2"
})

bot.on('login', function(){
    console.log("login")
    setTimeout(() => {
        console.log(bot.players)
        bot.quit()
        process.exit(0)
    }, 5000)
})

I found that there are normal players in Tab list:

  PlayerLister: {
    username: 'PlayerLister',
    ping: 0,
    uuid: '7b323022-9a91-3d7c-bdb5-c9504700e63c',
    displayName: ChatMessage {
      json: [Object],
      text: '',
      extra: [Array],
      bold: undefined,
      italic: undefined,
      underlined: undefined,
      strikethrough: undefined,
      obfuscated: undefined,
      color: undefined
    },
    entity: [Entity],
    gamemode: 0
  },

And there are manipulated ones:

  ' BTLP Slot 02': {
    username: ' BTLP Slot 02',
    ping: 28,
    uuid: '1e47312c-caf5-3393-9499-fe79fecba08f',
    displayName: ChatMessage {
      json: [Object],
      text: '\u00a7fPlayerLister',
      bold: undefined,
      italic: undefined,
      underlined: undefined,
      strikethrough: undefined,
      obfuscated: undefined,
      color: undefined
    },
    entity: null,
    gamemode: 0
  },
commented

BTW CustomSkinLoader can display players' skin. It is still working.

commented

因为离线模式下的用户名什么字符都可以用,可以用空格开头或结尾,可以带斜杠,所以也没办法判断一个id是不是确有其人

commented

在我和 @xfl03 讨论之后,觉得这个问题超出了 CSL 能解决的范畴,只改动客户端会非常麻烦。

因为正版服务器下,皮肤材质下载地址是由服务端获取的( BTPL 没有修改皮肤地址等相关内容),然后再发给客户端,由客户端解析到 GameProfile::properties 中去,再下载并渲染;
在离线服务器中,服务端是无法获取皮肤的,CSL 将这个步骤改到客户端侧完成;
CSL 的 MojangAPI 能够在 GameProfile::properties 存在皮肤相关内容时直接使用其中的地址,而不再根据 username 获取

我们讨论觉得给服务端用 authlib-injector 或者 SkinsRestorer 等能够在服务端侧补全皮肤地址的工具或插件比较简便

commented

@ZekerZhayard 的确如此
我只是看到日志里面一堆的 BTLP Slot 来发个牢骚。(