From 784ae292ed6f39c8fee596ff9906dec56f82294e Mon Sep 17 00:00:00 2001 From: MATRIX-feather Date: Sat, 12 Oct 2024 13:35:15 +0800 Subject: [PATCH] =?UTF-8?q?misc:=20=E4=B8=8D=E8=A6=81=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96PlayerMeta=E7=9A=84uuid=20=20=20=20=20-=20=E8=BD=AC?= =?UTF-8?q?=E8=80=8C=E5=9C=A8=E8=8E=B7=E5=8F=96=E6=97=B6=E4=B8=BA=E4=BB=96?= =?UTF-8?q?=E4=BB=AC=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/playerdata/PlayerDataStoreNew.java | 16 +++++++++------- .../morph/storage/playerdata/PlayerMeta.java | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/xyz/nifeather/morph/storage/playerdata/PlayerDataStoreNew.java b/src/main/java/xyz/nifeather/morph/storage/playerdata/PlayerDataStoreNew.java index 6c410a72..5336aee6 100644 --- a/src/main/java/xyz/nifeather/morph/storage/playerdata/PlayerDataStoreNew.java +++ b/src/main/java/xyz/nifeather/morph/storage/playerdata/PlayerDataStoreNew.java @@ -213,7 +213,7 @@ public PlayerMeta getPlayerMeta(OfflinePlayer player) var storedMeta = this.get(uuid.toString()); if (storedMeta != null) { - initializePlayerMeta(storedMeta); + initializePlayerMeta(storedMeta, uuid); trackedPlayerMetaMap.put(uuid, storedMeta); return storedMeta; @@ -228,13 +228,15 @@ public PlayerMeta getPlayerMeta(OfflinePlayer player) return metaInstance; } - private void initializePlayerMeta(PlayerMeta c) + private void initializePlayerMeta(PlayerMeta meta, UUID matchingUUID) { + meta.uniqueId = matchingUUID; + //要设置给c.unlockedDisguises的列表 var list = new ObjectArrayList(); //原始列表 - var unlockedDisguiseIdentifiers = c.getUnlockedDisguiseIdentifiers(); + var unlockedDisguiseIdentifiers = meta.getUnlockedDisguiseIdentifiers(); //先对原始列表排序 unlockedDisguiseIdentifiers.sort(null); @@ -247,12 +249,12 @@ private void initializePlayerMeta(PlayerMeta c) if (type != null) list.add(new DisguiseMeta(disguiseId, DisguiseTypes.fromId(disguiseId))); else - logger.warn("Unknown disguise identifier data '%s' owned by '%s'".formatted(disguiseId, c.uniqueId)); + logger.warn("Unknown disguise identifier data '%s' owned by '%s'".formatted(disguiseId, matchingUUID)); }); //设置可用的伪装列表并对其加锁 - c.setUnlockedDisguises(list); - c.lockDisguiseList(); + meta.setUnlockedDisguises(list); + meta.lockDisguiseList(); } @Override @@ -320,7 +322,7 @@ public void loadAll() var meta = this.get(fileName); if (meta == null) continue; - initializePlayerMeta(meta); + initializePlayerMeta(meta, uuid); this.trackedPlayerMetaMap.put(uuid, meta); count++; diff --git a/src/main/java/xyz/nifeather/morph/storage/playerdata/PlayerMeta.java b/src/main/java/xyz/nifeather/morph/storage/playerdata/PlayerMeta.java index b819d278..d7d09563 100644 --- a/src/main/java/xyz/nifeather/morph/storage/playerdata/PlayerMeta.java +++ b/src/main/java/xyz/nifeather/morph/storage/playerdata/PlayerMeta.java @@ -13,7 +13,7 @@ public class PlayerMeta /** * 玩家的UUID */ - @Expose + @Expose(serialize = false) public UUID uniqueId; /**