feat: invalid chat session handle
This commit is contained in:
parent
fb05305d8d
commit
88f32ff954
1 changed files with 10 additions and 11 deletions
|
@ -95,17 +95,16 @@ public class v1_19_R2 implements Internals {
|
||||||
Collections.singletonList(serverPlayer));
|
Collections.singletonList(serverPlayer));
|
||||||
final ClientboundPlayerInfoRemovePacket remove = new ClientboundPlayerInfoRemovePacket(List.of(player.getUniqueId()));
|
final ClientboundPlayerInfoRemovePacket remove = new ClientboundPlayerInfoRemovePacket(List.of(player.getUniqueId()));
|
||||||
|
|
||||||
if (serverPlayer.getChatSession() == null) {
|
RemoteChatSession chatSession;
|
||||||
NickoBukkit.getInstance().getLogger().warning("Chat Session of " + serverPlayer.displayName + " is undefined.\n" +
|
|
||||||
"Nicko might fail at changing skins and even throw an error.\n" +
|
|
||||||
"Worse however, the player might get kicked when chatting.\n" +
|
|
||||||
"This is pretty rare however and this\n" +
|
|
||||||
"warning can be safely ignored in most cases.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (serverPlayer.getChatSession() == null) {
|
||||||
|
NickoBukkit.getInstance().getLogger().warning("Chat Session of " + serverPlayer.displayName + " is null!");
|
||||||
|
chatSession = null;
|
||||||
|
} else {
|
||||||
final UUID uuid = serverPlayer.getChatSession().sessionId();
|
final UUID uuid = serverPlayer.getChatSession().sessionId();
|
||||||
final ProfilePublicKey ppk = serverPlayer.getChatSession().profilePublicKey();
|
final ProfilePublicKey ppk = serverPlayer.getChatSession().profilePublicKey();
|
||||||
final RemoteChatSession newChatSession = new RemoteChatSession(uuid, ppk);
|
chatSession = new RemoteChatSession(uuid, ppk);
|
||||||
|
}
|
||||||
|
|
||||||
spoofPlayerInfoPacket(init, List.of(new ClientboundPlayerInfoUpdatePacket.Entry(
|
spoofPlayerInfoPacket(init, List.of(new ClientboundPlayerInfoUpdatePacket.Entry(
|
||||||
player.getUniqueId(),
|
player.getUniqueId(),
|
||||||
|
@ -114,7 +113,7 @@ public class v1_19_R2 implements Internals {
|
||||||
serverPlayer.latency,
|
serverPlayer.latency,
|
||||||
serverPlayer.gameMode.getGameModeForPlayer(),
|
serverPlayer.gameMode.getGameModeForPlayer(),
|
||||||
Component.literal(profileName),
|
Component.literal(profileName),
|
||||||
newChatSession.asData()
|
chatSession == null ? null : chatSession.asData()
|
||||||
)));
|
)));
|
||||||
|
|
||||||
Bukkit.getOnlinePlayers().forEach(online -> {
|
Bukkit.getOnlinePlayers().forEach(online -> {
|
||||||
|
|
Loading…
Reference in a new issue