Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ public boolean isClientNotify() {
/**
* Overrides the glow effect for the glowingPlayer, visible by the viewers.
*
* <p>If no color is specified, the glowing color will match the player's scoreboard team color.</p>
*
*
* @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.
*
* <p>If the {@code color} parameter is {@code null}, the glowing color will match the player's scoreboard team color.</p>
*
* @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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.awt.Color;
import java.util.UUID;
import lombok.NonNull;
import org.jetbrains.annotations.Nullable;

/**
* Provides the glow module.
Expand All @@ -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));
}

Expand Down
5 changes: 5 additions & 0 deletions docs/developers/modules/glow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ The glow module allows you to take advantage of the vanilla Minecraft Glow Effec

## Integration

<Callout type="info">
If no color is specified, the glow effect will default to the player's scoreboard team color.
</Callout>

### Sample Code
Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.

Expand Down Expand Up @@ -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.

</Tab>
Expand Down