Skip to content

Commit ce85264

Browse files
authored
Glow Module - Add Scoreborard Team Color Fallback (#209)
* Add documentation & API method for scoreboard color fallback * Add info callout for scoreboard team color
1 parent 335b3b9 commit ce85264

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

api/src/main/java/com/lunarclient/apollo/module/glow/GlowModule.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ public boolean isClientNotify() {
4747
/**
4848
* Overrides the glow effect for the glowingPlayer, visible by the viewers.
4949
*
50+
* <p>If no color is specified, the glowing color will match the player's scoreboard team color.</p>
51+
*
52+
*
53+
* @param recipients the recipients that are receiving the packet
54+
* @param glowingPlayer the UUID of the player whose glowing effect will be overwrote
55+
* @since 1.1.9
56+
*/
57+
public abstract void overrideGlow(Recipients recipients, UUID glowingPlayer);
58+
59+
/**
60+
* Overrides the glow effect for the glowingPlayer, visible by the viewers.
61+
*
62+
* <p>If the {@code color} parameter is {@code null}, the glowing color will match the player's scoreboard team color.</p>
63+
*
5064
* @param recipients the recipients that are receiving the packet
5165
* @param glowingPlayer the UUID of the player whose glowing effect will be overwrote
5266
* @param color the new color glowingPlayer should glow in.

common/src/main/java/com/lunarclient/apollo/module/glow/GlowModuleImpl.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.awt.Color;
3333
import java.util.UUID;
3434
import lombok.NonNull;
35+
import org.jetbrains.annotations.Nullable;
3536

3637
/**
3738
* Provides the glow module.
@@ -41,12 +42,20 @@
4142
public final class GlowModuleImpl extends GlowModule {
4243

4344
@Override
44-
public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer, @NonNull Color color) {
45-
OverrideGlowEffectMessage message = OverrideGlowEffectMessage.newBuilder()
46-
.setPlayerUuid(NetworkTypes.toProtobuf(glowingPlayer))
47-
.setColor(NetworkTypes.toProtobuf(color))
48-
.build();
45+
public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer) {
46+
this.overrideGlow(recipients, glowingPlayer, null);
47+
}
48+
49+
@Override
50+
public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer, @Nullable Color color) {
51+
OverrideGlowEffectMessage.Builder builder = OverrideGlowEffectMessage.newBuilder()
52+
.setPlayerUuid(NetworkTypes.toProtobuf(glowingPlayer));
53+
54+
if (color != null) {
55+
builder.setColor(NetworkTypes.toProtobuf(color));
56+
}
4957

58+
OverrideGlowEffectMessage message = builder.build();
5059
recipients.forEach(player -> ((AbstractApolloPlayer) player).sendPacket(message));
5160
}
5261

docs/developers/modules/glow.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ The glow module allows you to take advantage of the vanilla Minecraft Glow Effec
2323

2424
## Integration
2525

26+
<Callout type="info">
27+
If no color is specified, the glow effect will default to the player's scoreboard team color.
28+
</Callout>
29+
2630
### Sample Code
2731
Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
2832

@@ -65,6 +69,7 @@ public void resetGlowEffectsExample(Player viewer) {
6569
2. `UUID target`
6670
- The player or living entity you want to display the glow effect on.
6771
3. `Color glowColor`
72+
- If `null` is passed (or if no color is specified), the glow effect will default to the target's scoreboard team color.
6873
- How you'll dictate the color of the glow effect, see the [colors page](/apollo/developers/utilities/colors) for more.
6974

7075
</Tab>

0 commit comments

Comments
 (0)