Skip to content

Commit c6a3bd7

Browse files
authored
server: Fix persona premium skins by setting correct skin full id (#1118)
1 parent 2e95010 commit c6a3bd7

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

server/player/skin/skin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type Skin struct {
1313
// Persona specifies if the skin uses the persona skin system.
1414
Persona bool
1515
PlayFabID string
16+
FullID string
1617

1718
// Pix holds the raw pixel data of the skin. This is an RGBA byte slice, meaning that every first byte is
1819
// a Red value, the second a Green value, the third a Blue value and the fourth an Alpha value.

server/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ func (srv *Server) createWorld(dim world.Dimension, nether, end **world.World) *
594594
return w
595595
}
596596

597-
// parseSkin parses a skin from the login.ClientData and returns it.
597+
// parseSkin parses a skin from the login.ClientData and returns it.
598598
func (srv *Server) parseSkin(data login.ClientData) skin.Skin {
599599
// Gophertunnel guarantees the following values are valid data and are of
600600
// the correct size.
@@ -606,6 +606,7 @@ func (srv *Server) parseSkin(data login.ClientData) skin.Skin {
606606
playerSkin.Model, _ = base64.StdEncoding.DecodeString(data.SkinGeometry)
607607
playerSkin.ModelConfig, _ = skin.DecodeModelConfig(skinResourcePatch)
608608
playerSkin.PlayFabID = data.PlayFabID
609+
playerSkin.FullID = data.SkinID
609610

610611
playerSkin.Cape = skin.NewCape(data.CapeImageWidth, data.CapeImageHeight)
611612
playerSkin.Cape.Pix, _ = base64.StdEncoding.DecodeString(data.CapeData)

server/session/player.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ package session
33
import (
44
"encoding/json"
55
"fmt"
6-
"github.com/df-mc/dragonfly/server/player/debug"
7-
"github.com/df-mc/dragonfly/server/player/hud"
8-
"github.com/go-gl/mathgl/mgl32"
96
"image/color"
107
"maps"
118
"math"
@@ -21,10 +18,13 @@ import (
2118
"github.com/df-mc/dragonfly/server/item/creative"
2219
"github.com/df-mc/dragonfly/server/item/inventory"
2320
"github.com/df-mc/dragonfly/server/item/recipe"
21+
"github.com/df-mc/dragonfly/server/player/debug"
2422
"github.com/df-mc/dragonfly/server/player/dialogue"
2523
"github.com/df-mc/dragonfly/server/player/form"
24+
"github.com/df-mc/dragonfly/server/player/hud"
2625
"github.com/df-mc/dragonfly/server/player/skin"
2726
"github.com/df-mc/dragonfly/server/world"
27+
"github.com/go-gl/mathgl/mgl32"
2828
"github.com/go-gl/mathgl/mgl64"
2929
"github.com/google/uuid"
3030
"github.com/sandertv/gophertunnel/minecraft/protocol"
@@ -1084,6 +1084,7 @@ func protocolToSkin(sk protocol.Skin) (s skin.Skin, err error) {
10841084
s.Pix = sk.SkinData
10851085
s.Model = sk.SkinGeometry
10861086
s.PlayFabID = sk.PlayFabID
1087+
s.FullID = sk.FullID
10871088

10881089
s.Cape = skin.NewCape(int(sk.CapeImageWidth), int(sk.CapeImageHeight))
10891090
s.Cape.Pix = sk.CapeData

server/session/session_list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package session
22

33
import (
4+
"slices"
5+
"sync"
6+
47
"github.com/df-mc/dragonfly/server/internal/sliceutil"
58
"github.com/df-mc/dragonfly/server/player/skin"
69
"github.com/google/uuid"
710
"github.com/sandertv/gophertunnel/minecraft/protocol"
811
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
9-
"slices"
10-
"sync"
1112
)
1213

1314
var sessions = new(sessionList)
@@ -125,7 +126,7 @@ func skinToProtocol(s skin.Skin) protocol.Skin {
125126
SkinGeometry: s.Model,
126127
PersonaSkin: s.Persona,
127128
CapeID: uuid.New().String(),
128-
FullID: uuid.New().String(),
129+
FullID: s.FullID,
129130
Animations: animations,
130131
Trusted: true,
131132
OverrideAppearance: true,

0 commit comments

Comments
 (0)