From 9c1d252057b0f49b6ab0f47f70d16e58c143da93 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Thu, 25 Apr 2024 16:30:32 +0100 Subject: [PATCH] Add javadoc to event --- .../event/bedrock/SessionSkinApplyEvent.java | 60 +++++++++++++++++-- .../org/geysermc/geyser/api/skin/Cape.java | 2 +- .../org/geysermc/geyser/api/skin/Skin.java | 2 +- 3 files changed, 57 insertions(+), 7 deletions(-) diff --git a/api/src/main/java/org/geysermc/geyser/api/event/bedrock/SessionSkinApplyEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/bedrock/SessionSkinApplyEvent.java index 1fa11be59..7487a027a 100644 --- a/api/src/main/java/org/geysermc/geyser/api/event/bedrock/SessionSkinApplyEvent.java +++ b/api/src/main/java/org/geysermc/geyser/api/event/bedrock/SessionSkinApplyEvent.java @@ -45,42 +45,92 @@ public abstract class SessionSkinApplyEvent extends ConnectionEvent { private final String username; private final UUID uuid; private final boolean slim; - private final boolean isBedrock; + private final boolean bedrock; private final SkinData skinData; - public SessionSkinApplyEvent(@NonNull GeyserConnection connection, String username, UUID uuid, boolean slim, boolean isBedrock, SkinData skinData) { + public SessionSkinApplyEvent(@NonNull GeyserConnection connection, String username, UUID uuid, boolean slim, boolean bedrock, SkinData skinData) { super(connection); this.username = username; this.uuid = uuid; this.slim = slim; - this.isBedrock = isBedrock; + this.bedrock = bedrock; this.skinData = skinData; } + /** + * The username of the player. + * + * @return the username of the player + */ public String username() { return username; } + /** + * The UUID of the player. + * + * @return the UUID of the player + */ public UUID uuid() { return uuid; } + /** + * If the player is using a slim model. + * + * @return if the player is using a slim model + */ public boolean slim() { return slim; } - public boolean isBedrock() { - return isBedrock; + /** + * If the player is using a Bedrock skin. + * + * @return if the player is using a Bedrock skin + */ + public boolean bedrock() { + return bedrock; } + /** + * The skin data of the player. + * + * @return the skin data of the player + */ public SkinData skinData() { return skinData; } + /** + * Change the skin of the player. + * + * @param newSkin the new skin + */ public abstract void skin(@NonNull Skin newSkin); + + /** + * Change the cape of the player. + * + * @param newCape the new cape + */ public abstract void cape(@NonNull Cape newCape); + + /** + * Change the geometry of the player. + * + * @param newGeometry the new geometry + */ public abstract void geometry(@NonNull SkinGeometry newGeometry); + /** + * Change the geometry of the player. + *

+ * Constructs a generic {@link SkinGeometry} object with the given data. + * + * @param geometryName the name of the geometry + * @param geometryData the data of the geometry + */ public void geometry(@NonNull String geometryName, @NonNull String geometryData) { geometry(new SkinGeometry("{\"geometry\" :{\"default\" :\"" + geometryName + "\"}}", geometryData)); } diff --git a/api/src/main/java/org/geysermc/geyser/api/skin/Cape.java b/api/src/main/java/org/geysermc/geyser/api/skin/Cape.java index 6b8b3c072..1e7341ae4 100644 --- a/api/src/main/java/org/geysermc/geyser/api/skin/Cape.java +++ b/api/src/main/java/org/geysermc/geyser/api/skin/Cape.java @@ -30,7 +30,7 @@ package org.geysermc.geyser.api.skin; * * @param textureUrl The URL of the cape texture * @param capeId The ID of the cape - * @param capeData The raw cape image data + * @param capeData The raw cape image data in ARGB format * @param failed If the cape failed to load, this is for things like fallback capes */ public record Cape(String textureUrl, String capeId, byte[] capeData, boolean failed) { diff --git a/api/src/main/java/org/geysermc/geyser/api/skin/Skin.java b/api/src/main/java/org/geysermc/geyser/api/skin/Skin.java index 408a24add..9b39ddfe8 100644 --- a/api/src/main/java/org/geysermc/geyser/api/skin/Skin.java +++ b/api/src/main/java/org/geysermc/geyser/api/skin/Skin.java @@ -29,7 +29,7 @@ package org.geysermc.geyser.api.skin; * Represents a skin. * * @param textureUrl The URL/ID of the skin texture - * @param skinData The raw skin image data + * @param skinData The raw skin image data in ARGB * @param failed If the skin failed to load, this is for things like fallback skins */ public record Skin(String textureUrl, byte[] skinData, boolean failed) {