From c7ba5255e3b0170a0e7183f3a38927931de34a03 Mon Sep 17 00:00:00 2001 From: Gero Date: Tue, 21 Mar 2023 09:22:40 +0100 Subject: [PATCH] Add Player#hasSentPlayerSettings (#980) --- .../main/java/com/velocitypowered/api/proxy/Player.java | 7 +++++++ .../proxy/connection/client/ConnectedPlayer.java | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/api/src/main/java/com/velocitypowered/api/proxy/Player.java b/api/src/main/java/com/velocitypowered/api/proxy/Player.java index cd41d8468..9382fec22 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/Player.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/Player.java @@ -88,6 +88,13 @@ public interface Player extends */ PlayerSettings getPlayerSettings(); + /** + * Returns whether the player has sent its client settings. + * + * @return true if the player has sent its client settings + */ + boolean hasSentPlayerSettings(); + /** * Returns the player's mod info if they have a modded client. * diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 61a2b5565..579cd60ee 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -282,6 +282,11 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player, return settings == null ? ClientSettingsWrapper.DEFAULT : this.settings; } + @Override + public boolean hasSentPlayerSettings() { + return settings != null; + } + void setPlayerSettings(ClientSettings settings) { ClientSettingsWrapper cs = new ClientSettingsWrapper(settings); this.settings = cs;