Skip to content

Commit

Permalink
Fix game profile uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Feb 27, 2024
1 parent 59ba34b commit f0ec846
Showing 1 changed file with 41 additions and 8 deletions.
49 changes: 41 additions & 8 deletions src/main/java/com/soulfiremc/server/plugins/POVServer.java
Expand Up @@ -544,16 +544,49 @@ private void syncBotAndUser() {
sessionDataManager.playerListState().footer()));
}

var updateSet = EnumSet.noneOf(PlayerListEntryAction.class);
var playerEntries = new ArrayList<PlayerListEntry>();
for (var player : sessionDataManager.playerListState().entries().values()) {
updateSet.add(PlayerListEntryAction.ADD_PLAYER);
playerEntries.add(player);
}

var currentId =
session.<GameProfile>getFlag(MinecraftConstants.PROFILE_KEY).getId();
session.send(
new ClientboundPlayerInfoUpdatePacket(
updateSet, playerEntries.toArray(new PlayerListEntry[0])));
EnumSet.of(
PlayerListEntryAction.ADD_PLAYER,
PlayerListEntryAction.INITIALIZE_CHAT,
PlayerListEntryAction.UPDATE_GAME_MODE,
PlayerListEntryAction.UPDATE_LISTED,
PlayerListEntryAction.UPDATE_LATENCY,
PlayerListEntryAction.UPDATE_DISPLAY_NAME),
sessionDataManager.playerListState().entries().values().stream()
.map(
entry -> {
if (entry.getProfileId().equals(currentId)) {
GameProfile newGameProfile;
if (entry.getProfile() == null) {
newGameProfile = null;
} else {
newGameProfile =
new GameProfile(
currentId, entry.getProfile().getName());
newGameProfile.setProperties(
entry.getProfile().getProperties());
}

return new PlayerListEntry(
currentId,
newGameProfile,
entry.isListed(),
entry.getLatency(),
entry.getGameMode(),
entry.getDisplayName(),
entry.getSessionId(),
entry.getExpiresAt(),
entry.getPublicKey(),
entry.getKeySignature());
} else {
return entry;
}
})
.toList()
.toArray(new PlayerListEntry[0])));

if (sessionDataManager.centerChunk() != null) {
session.send(
Expand Down

0 comments on commit f0ec846

Please sign in to comment.