diff --git a/api/src/main/java/com/lunarclient/apollo/module/glow/GlowModule.java b/api/src/main/java/com/lunarclient/apollo/module/glow/GlowModule.java index e4118a14..aa4b6e79 100644 --- a/api/src/main/java/com/lunarclient/apollo/module/glow/GlowModule.java +++ b/api/src/main/java/com/lunarclient/apollo/module/glow/GlowModule.java @@ -47,6 +47,20 @@ public boolean isClientNotify() { /** * Overrides the glow effect for the glowingPlayer, visible by the viewers. * + *

If no color is specified, the glowing color will match the player's scoreboard team color.

+ * + * + * @param recipients the recipients that are receiving the packet + * @param glowingPlayer the UUID of the player whose glowing effect will be overwrote + * @since 1.1.9 + */ + public abstract void overrideGlow(Recipients recipients, UUID glowingPlayer); + + /** + * Overrides the glow effect for the glowingPlayer, visible by the viewers. + * + *

If the {@code color} parameter is {@code null}, the glowing color will match the player's scoreboard team color.

+ * * @param recipients the recipients that are receiving the packet * @param glowingPlayer the UUID of the player whose glowing effect will be overwrote * @param color the new color glowingPlayer should glow in. diff --git a/common/src/main/java/com/lunarclient/apollo/module/glow/GlowModuleImpl.java b/common/src/main/java/com/lunarclient/apollo/module/glow/GlowModuleImpl.java index cc832417..e74d9486 100644 --- a/common/src/main/java/com/lunarclient/apollo/module/glow/GlowModuleImpl.java +++ b/common/src/main/java/com/lunarclient/apollo/module/glow/GlowModuleImpl.java @@ -32,6 +32,7 @@ import java.awt.Color; import java.util.UUID; import lombok.NonNull; +import org.jetbrains.annotations.Nullable; /** * Provides the glow module. @@ -41,12 +42,20 @@ public final class GlowModuleImpl extends GlowModule { @Override - public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer, @NonNull Color color) { - OverrideGlowEffectMessage message = OverrideGlowEffectMessage.newBuilder() - .setPlayerUuid(NetworkTypes.toProtobuf(glowingPlayer)) - .setColor(NetworkTypes.toProtobuf(color)) - .build(); + public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer) { + this.overrideGlow(recipients, glowingPlayer, null); + } + + @Override + public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer, @Nullable Color color) { + OverrideGlowEffectMessage.Builder builder = OverrideGlowEffectMessage.newBuilder() + .setPlayerUuid(NetworkTypes.toProtobuf(glowingPlayer)); + + if (color != null) { + builder.setColor(NetworkTypes.toProtobuf(color)); + } + OverrideGlowEffectMessage message = builder.build(); recipients.forEach(player -> ((AbstractApolloPlayer) player).sendPacket(message)); } diff --git a/docs/developers/modules/glow.mdx b/docs/developers/modules/glow.mdx index ec71a80f..c9d9dc7c 100644 --- a/docs/developers/modules/glow.mdx +++ b/docs/developers/modules/glow.mdx @@ -23,6 +23,10 @@ The glow module allows you to take advantage of the vanilla Minecraft Glow Effec ## Integration + + If no color is specified, the glow effect will default to the player's scoreboard team color. + + ### Sample Code Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. @@ -65,6 +69,7 @@ public void resetGlowEffectsExample(Player viewer) { 2. `UUID target` - The player or living entity you want to display the glow effect on. 3. `Color glowColor` + - If `null` is passed (or if no color is specified), the glow effect will default to the target's scoreboard team color. - How you'll dictate the color of the glow effect, see the [colors page](/apollo/developers/utilities/colors) for more.