From f273c046ecef55c58646699389783f263178a035 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 25 Aug 2018 12:54:30 -0400 Subject: [PATCH] Add javadoc and reorganize the player settings stuff. --- .../player/PlayerSettingsChangedEvent.java | 2 +- .../api/playersettings/PlayerSettings.java | 29 ---------- .../com/velocitypowered/api/proxy/Player.java | 2 +- .../api/proxy/player/PlayerSettings.java | 56 +++++++++++++++++++ .../player}/SkinParts.java | 2 +- .../api/proxy/player/package-info.java | 4 ++ .../client/ClientSettingsWrapper.java | 4 +- .../connection/client/ConnectedPlayer.java | 2 +- 8 files changed, 66 insertions(+), 35 deletions(-) delete mode 100644 api/src/main/java/com/velocitypowered/api/playersettings/PlayerSettings.java create mode 100644 api/src/main/java/com/velocitypowered/api/proxy/player/PlayerSettings.java rename api/src/main/java/com/velocitypowered/api/{playersettings => proxy/player}/SkinParts.java (94%) create mode 100644 api/src/main/java/com/velocitypowered/api/proxy/player/package-info.java diff --git a/api/src/main/java/com/velocitypowered/api/event/player/PlayerSettingsChangedEvent.java b/api/src/main/java/com/velocitypowered/api/event/player/PlayerSettingsChangedEvent.java index 4bb433ec2..a657543ad 100644 --- a/api/src/main/java/com/velocitypowered/api/event/player/PlayerSettingsChangedEvent.java +++ b/api/src/main/java/com/velocitypowered/api/event/player/PlayerSettingsChangedEvent.java @@ -1,7 +1,7 @@ package com.velocitypowered.api.event.player; import com.google.common.base.Preconditions; -import com.velocitypowered.api.playersettings.PlayerSettings; +import com.velocitypowered.api.proxy.player.PlayerSettings; import com.velocitypowered.api.proxy.Player; public class PlayerSettingsChangedEvent { diff --git a/api/src/main/java/com/velocitypowered/api/playersettings/PlayerSettings.java b/api/src/main/java/com/velocitypowered/api/playersettings/PlayerSettings.java deleted file mode 100644 index 0c04ac44d..000000000 --- a/api/src/main/java/com/velocitypowered/api/playersettings/PlayerSettings.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.velocitypowered.api.playersettings; - -import java.util.Locale; - -public interface PlayerSettings { - - Locale getLocale(); - - byte getViewDistance(); - - ChatMode getChatMode(); - - boolean hasChatColors(); - - SkinParts getSkinParts(); - - MainHand getMainHand(); - - public enum ChatMode { - SHOWN, - COMMANDS_ONLY, - HIDDEN - } - - public enum MainHand { - LEFT, - RIGHT - } -} 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 7e72b5d9b..0ebb1fdfa 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/Player.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/Player.java @@ -1,7 +1,7 @@ package com.velocitypowered.api.proxy; import com.velocitypowered.api.command.CommandSource; -import com.velocitypowered.api.playersettings.PlayerSettings; +import com.velocitypowered.api.proxy.player.PlayerSettings; import com.velocitypowered.api.proxy.messages.ChannelMessageSink; import com.velocitypowered.api.proxy.messages.ChannelMessageSource; import com.velocitypowered.api.proxy.server.ServerInfo; diff --git a/api/src/main/java/com/velocitypowered/api/proxy/player/PlayerSettings.java b/api/src/main/java/com/velocitypowered/api/proxy/player/PlayerSettings.java new file mode 100644 index 000000000..050df101e --- /dev/null +++ b/api/src/main/java/com/velocitypowered/api/proxy/player/PlayerSettings.java @@ -0,0 +1,56 @@ +package com.velocitypowered.api.proxy.player; + +import java.util.Locale; + +/** + * Represents the client settings for the player. + */ +public interface PlayerSettings { + /** + * Returns the locale of the Minecraft client. + * @return the client locale + */ + Locale getLocale(); + + /** + * Returns the client's view distance. This does not guarantee the client will see this many chunks, since your + * servers are responsible for sending the chunks. + * @return the client view distance + */ + byte getViewDistance(); + + /** + * Returns the chat setting for the client. + * @return the chat setting + */ + ChatMode getChatMode(); + + /** + * Returns whether or not the client has chat colors disabled. + * @return whether or not the client has chat colors disabled + */ + boolean hasChatColors(); + + /** + * Returns the parts of player skins the client will show. + * @return the skin parts for the client + */ + SkinParts getSkinParts(); + + /** + * Returns the primary hand of the client. + * @return the primary hand of the client + */ + MainHand getMainHand(); + + enum ChatMode { + SHOWN, + COMMANDS_ONLY, + HIDDEN + } + + enum MainHand { + LEFT, + RIGHT + } +} diff --git a/api/src/main/java/com/velocitypowered/api/playersettings/SkinParts.java b/api/src/main/java/com/velocitypowered/api/proxy/player/SkinParts.java similarity index 94% rename from api/src/main/java/com/velocitypowered/api/playersettings/SkinParts.java rename to api/src/main/java/com/velocitypowered/api/proxy/player/SkinParts.java index 4ec3d305b..29a6a501e 100644 --- a/api/src/main/java/com/velocitypowered/api/playersettings/SkinParts.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/player/SkinParts.java @@ -1,4 +1,4 @@ -package com.velocitypowered.api.playersettings; +package com.velocitypowered.api.proxy.player; public class SkinParts { diff --git a/api/src/main/java/com/velocitypowered/api/proxy/player/package-info.java b/api/src/main/java/com/velocitypowered/api/proxy/player/package-info.java new file mode 100644 index 000000000..9f72f6cc2 --- /dev/null +++ b/api/src/main/java/com/velocitypowered/api/proxy/player/package-info.java @@ -0,0 +1,4 @@ +/** + * Provides an interface to work with Minecraft client settings. + */ +package com.velocitypowered.api.proxy.player; \ No newline at end of file diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientSettingsWrapper.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientSettingsWrapper.java index 854e6c7d8..4e47c3145 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientSettingsWrapper.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientSettingsWrapper.java @@ -1,7 +1,7 @@ package com.velocitypowered.proxy.connection.client; -import com.velocitypowered.api.playersettings.PlayerSettings; -import com.velocitypowered.api.playersettings.SkinParts; +import com.velocitypowered.api.proxy.player.PlayerSettings; +import com.velocitypowered.api.proxy.player.SkinParts; import com.velocitypowered.proxy.protocol.packet.ClientSettings; import java.util.Locale; 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 7c5d19db6..3c0789cd4 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 @@ -6,7 +6,7 @@ import com.velocitypowered.api.event.player.PlayerSettingsChangedEvent; import com.velocitypowered.api.event.player.ServerPreConnectEvent; import com.velocitypowered.api.permission.PermissionFunction; import com.velocitypowered.api.permission.PermissionProvider; -import com.velocitypowered.api.playersettings.PlayerSettings; +import com.velocitypowered.api.proxy.player.PlayerSettings; import com.velocitypowered.api.proxy.ConnectionRequestBuilder; import com.velocitypowered.api.proxy.ServerConnection; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;