mirror of
https://github.com/CosmicStar98/bedrocktool.git
synced 2024-06-16 12:59:46 +00:00
add deviceID to custom data
This commit is contained in:
parent
d6b2f53f48
commit
8365adb4cd
|
@ -69,41 +69,39 @@ func (s *skinsSession) AddPlayerSkin(playerID uuid.UUID, playerName string, skin
|
|||
}
|
||||
}
|
||||
|
||||
func (s *skinsSession) ProcessPacket(pk packet.Packet) {
|
||||
switch pk := pk.(type) {
|
||||
case *packet.PlayerSkin:
|
||||
playerName := s.playerNames[pk.UUID]
|
||||
func (s *skinsSession) AddSkin(playerName string, playerID uuid.UUID, playerSkin *protocol.Skin) {
|
||||
if playerName == "" {
|
||||
playerName = pk.UUID.String()
|
||||
playerName = s.playerNames[playerID]
|
||||
if playerName == "" {
|
||||
playerName = playerID.String()
|
||||
}
|
||||
}
|
||||
if !strings.HasPrefix(playerName, s.PlayerNameFilter) {
|
||||
return
|
||||
}
|
||||
s.playerNames[playerID] = playerName
|
||||
|
||||
skin := Skin{&pk.Skin}
|
||||
skin := Skin{playerSkin}
|
||||
if s.OnlyIfHasGeometry && !skin.HaveGeometry() {
|
||||
return
|
||||
}
|
||||
s.AddPlayerSkin(pk.UUID, playerName, &skin)
|
||||
s.AddPlayerSkin(playerID, playerName, &skin)
|
||||
}
|
||||
|
||||
func (s *skinsSession) ProcessPacket(pk packet.Packet) {
|
||||
switch pk := pk.(type) {
|
||||
case *packet.PlayerSkin:
|
||||
s.AddSkin("", pk.UUID, &pk.Skin)
|
||||
case *packet.PlayerList:
|
||||
if pk.ActionType == 1 { // remove
|
||||
return
|
||||
}
|
||||
for _, player := range pk.Entries {
|
||||
playerName := utils.CleanupName(player.Username)
|
||||
if playerName == "" {
|
||||
playerName = player.UUID.String()
|
||||
s.AddSkin(utils.CleanupName(player.Username), player.UUID, &player.Skin)
|
||||
}
|
||||
if !strings.HasPrefix(playerName, s.PlayerNameFilter) {
|
||||
return
|
||||
}
|
||||
s.playerNames[player.UUID] = playerName
|
||||
|
||||
skin := Skin{&player.Skin}
|
||||
if s.OnlyIfHasGeometry && !skin.HaveGeometry() {
|
||||
return
|
||||
}
|
||||
s.AddPlayerSkin(player.UUID, playerName, &skin)
|
||||
case *packet.AddPlayer:
|
||||
if _, ok := s.playerNames[pk.UUID]; !ok {
|
||||
s.playerNames[pk.UUID] = utils.CleanupName(pk.Username)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ type CustomClientData struct {
|
|||
// misc
|
||||
IsEditorMode bool
|
||||
LanguageCode string
|
||||
DeviceID string
|
||||
}
|
||||
|
||||
func (p *ProxyContext) LoadCustomUserData(path string) error {
|
||||
|
@ -148,6 +149,8 @@ func (p *ProxyContext) LoadCustomUserData(path string) error {
|
|||
p.CustomClientData.SkinGeometry = base64.RawStdEncoding.EncodeToString(data)
|
||||
}
|
||||
|
||||
p.CustomClientData.DeviceID = customData.DeviceID
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user