Closed UMRnInside closed 3 years ago
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.
@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
},
BTW CustomSkinLoader can display players' skin. It is still working.
在我和 @xfl03 讨论之后,觉得这个问题超出了 CSL 能解决的范畴,只改动客户端会非常麻烦。
因为正版服务器下,皮肤材质下载地址是由服务端获取的( BTPL 没有修改皮肤地址等相关内容),然后再发给客户端,由客户端解析到 GameProfile::properties
中去,再下载并渲染;
在离线服务器中,服务端是无法获取皮肤的,CSL 将这个步骤改到客户端侧完成;
CSL 的 MojangAPI 能够在 GameProfile::properties
存在皮肤相关内容时直接使用其中的地址,而不再根据 username 获取
我们讨论觉得给服务端用 authlib-injector 或者 SkinsRestorer 等能够在服务端侧补全皮肤地址的工具或插件比较简便
@ZekerZhayard 的确如此
我只是看到日志里面一堆的 BTLP Slot
来发个牢骚。(
因为离线模式下的用户名什么字符都可以用,可以用空格开头或结尾,可以带斜杠,所以也没办法判断一个id是不是确有其人
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 byBTLP Slot 12
, causing CSL to loadBTLP Slot 12
's profile, rather thanNotch
. Note there are spaces inBTLP Slot 12
Log
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).