From 2dc65aeeb4a4351affe3b3926312c35fe6f075a3 Mon Sep 17 00:00:00 2001 From: ItsNature Date: Fri, 13 Sep 2024 20:53:29 +0200 Subject: [PATCH] move builders inside API tab, add nametag, nickhider & notification examples --- docs/developers/modules/border.mdx | 172 +++++++++++------------ docs/developers/modules/coloredfire.mdx | 18 +-- docs/developers/modules/cooldown.mdx | 44 +++--- docs/developers/modules/entity.mdx | 14 +- docs/developers/modules/glow.mdx | 18 +-- docs/developers/modules/hologram.mdx | 106 +++++++------- docs/developers/modules/limb.mdx | 68 ++++----- docs/developers/modules/nametag.mdx | 127 ++++++++++++++++- docs/developers/modules/nickhider.mdx | 67 ++++++++- docs/developers/modules/notification.mdx | 95 ++++++++++++- 10 files changed, 498 insertions(+), 231 deletions(-) diff --git a/docs/developers/modules/border.mdx b/docs/developers/modules/border.mdx index 98fa3f50..42d89504 100644 --- a/docs/developers/modules/border.mdx +++ b/docs/developers/modules/border.mdx @@ -67,6 +67,92 @@ public void resetBordersExample(Player viewer) { } ``` +### `Border` Options + +`.id(String)` should include a unique identifier for the border. It's important when you have multiple borders in a single world. + +```java +.id("pvp-tagged-spawn") +``` + +`.world(String)` is the world, by name, that you wish to add the border to. + +```java +.world("world") +``` + +`.cancelEntry(boolean)` is a boolean option to prevent players from entering the border, if they're outside the border bounds. + +```java +.cancelEntry(true) +``` + +`.cancelExit(boolean)` is a boolean option to prevent players from exiting the border, if they're currently inside the border bounds. + +```java +.cancelExit(true) +``` + +`.canShrinkOrExpand(boolean)` is a boolean option to control if the border has the ability to expand or shrink. + +```java +.canShrinkOrExpand(false) +``` + +`.color(java.awt.Color)` is how you dictate the color of the border. See the [colors page](/apollo/developers/utilities/colors) for more. + +**Color Types** + + + + +The `java.awt.Color` class statically exposes some colors, although they do not correspond to any existing colors used in Minecraft. + +```java +.color(Color.CYAN) +``` + + + + + +The `ApolloColors` class statically exposes colors that correspond to Bukkit/Spigot's `ChatColor` enum. + +```java +.color(ApolloColors.LIGHT_PURPLE) +``` + + + + + +Custom colors can be created from any RGB values using `new Color(int red, int green, int blue)`, or from any hex color using `Color.decode(String hex)`. + +```java +.color(Color.decode("#FF00FF")) +``` + + + + +`.bounds(Cuboid2D)` is used to determine the bounds of the border, using a 2D cuboid. See the [cuboids page](/apollo/developers/utilities/cuboids) for more. + +```java +.bounds(Cuboid2D.builder() + .minX(-50) + .minZ(-50) + .maxX(50) + .maxZ(50) + .build() +) +``` + +`.durationTicks(Integer)` is used to determine the speed of expansion or shrinkage. + +```java +.durationTicks(0) +``` + @@ -167,89 +253,3 @@ public void resetBordersExample(Player viewer) { - -### `Border` Options - -`.id(String)` should include a unique identifier for the border. It's important when you have multiple borders in a single world. - -```java -.id("pvp-tagged-spawn") -``` - -`.world(String)` is the world, by name, that you wish to add the border to. - -```java -.world("world") -``` - -`.cancelEntry(boolean)` is a boolean option to prevent players from entering the border, if they're outside the border bounds. - -```java -.cancelEntry(true) -``` - -`.cancelExit(boolean)` is a boolean option to prevent players from exiting the border, if they're currently inside the border bounds. - -```java -.cancelExit(true) -``` - -`.canShrinkOrExpand(boolean)` is a boolean option to control if the border has the ability to expand or shrink. - -```java -.canShrinkOrExpand(false) -``` - -`.color(java.awt.Color)` is how you dictate the color of the border. See the [colors page](/apollo/developers/utilities/colors) for more. - -**Color Types** - - - - -The `java.awt.Color` class statically exposes some colors, although they do not correspond to any existing colors used in Minecraft. - -```java -.color(Color.CYAN) -``` - - - - - -The `ApolloColors` class statically exposes colors that correspond to Bukkit/Spigot's `ChatColor` enum. - -```java -.color(ApolloColors.LIGHT_PURPLE) -``` - - - - - -Custom colors can be created from any RGB values using `new Color(int red, int green, int blue)`, or from any hex color using `Color.decode(String hex)`. - -```java -.color(Color.decode("#FF00FF")) -``` - - - - -`.bounds(Cuboid2D)` is used to determine the bounds of the border, using a 2D cuboid. See the [cuboids page](/apollo/developers/utilities/cuboids) for more. - -```java -.bounds(Cuboid2D.builder() - .minX(-50) - .minZ(-50) - .maxX(50) - .maxZ(50) - .build() -) -``` - -`.durationTicks(Integer)` is used to determine the speed of expansion or shrinkage. - -```java -.durationTicks(0) -``` diff --git a/docs/developers/modules/coloredfire.mdx b/docs/developers/modules/coloredfire.mdx index fea4a106..5a70cbaf 100644 --- a/docs/developers/modules/coloredfire.mdx +++ b/docs/developers/modules/coloredfire.mdx @@ -49,6 +49,15 @@ public void resetColoredFiresExample(Player viewer) { } ``` +### `overrideColoredFire` Parameters + +1. `Recipients recipients` + - A list of all the player(s) you want to be able to see the updated fire color. +2. `UUID target` + - The player or living entity you want to display the updated fire color on. +3. `Color flameColor` + - How you'll dictate the color of the fire, see the [colors page](/apollo/developers/utilities/colors) for more. + @@ -130,12 +139,3 @@ public void resetColoredFiresExample(Player viewer) { - -### `overrideColoredFire` Parameters - -1. `Recipients recipients` - - A list of all the player(s) you want to be able to see the updated fire color. -2. `UUID target` - - The player or living entity you want to display the updated fire color on. -3. `Color flameColor` - - How you'll dictate the color of the fire, see the [colors page](/apollo/developers/utilities/colors) for more. diff --git a/docs/developers/modules/cooldown.mdx b/docs/developers/modules/cooldown.mdx index 500624ab..5e61f4c5 100644 --- a/docs/developers/modules/cooldown.mdx +++ b/docs/developers/modules/cooldown.mdx @@ -88,6 +88,28 @@ public void resetCooldownsExample(Player viewer) { } ``` +### `Cooldown` Options + +`.name(String)` should include a unique identifier for the each cooldown. +```java +.name("enderpearl-cooldown") +``` + +`.duration(java.time.Duration)` the duration the cooldown should last for. See the [java.time.Duration Javadocs](https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html) for more. +```java +.duration(Duration.ofSeconds(15)) +``` + +`.icon(itemStackIcon)` is how you display a custom item icon. Read the [icons utilities page](/apollo/developers/utilities/icons) to learn more about icons. +```java +.icon(ItemStackIcon.builder().itemId("ENDER_PEARL").build()) +``` + +`.icon(SimpleResourceLocationIcon)` is how you display a custom texture icon. Read the [icons utilities page](/apollo/developers/utilities/icons) to learn more about icons. +```java +.icon(SimpleResourceLocationIcon.builder().resourceLocation("lunar:logo/logo-200x182.svg").size(12).build()) +``` + @@ -213,25 +235,3 @@ public void resetCooldownsExample(Player viewer) { - -### `Cooldown` Options - -`.name(String)` should include a unique identifier for the each cooldown. -```java -.name("enderpearl-cooldown") -``` - -`.duration(java.time.Duration)` the duration the cooldown should last for. See the [java.time.Duration Javadocs](https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html) for more. -```java -.duration(Duration.ofSeconds(15)) -``` - -`.icon(itemStackIcon)` is how you display a custom item icon. Read the [icons utilities page](/apollo/developers/utilities/icons) to learn more about icons. -```java -.icon(ItemStackIcon.builder().itemId("ENDER_PEARL").build()) -``` - -`.icon(SimpleResourceLocationIcon)` is how you display a custom texture icon. Read the [icons utilities page](/apollo/developers/utilities/icons) to learn more about icons. -```java -.icon(SimpleResourceLocationIcon.builder().resourceLocation("lunar:logo/logo-200x182.svg").size(12).build()) -``` diff --git a/docs/developers/modules/entity.mdx b/docs/developers/modules/entity.mdx index ecb1be7c..efbd3ba9 100644 --- a/docs/developers/modules/entity.mdx +++ b/docs/developers/modules/entity.mdx @@ -89,6 +89,13 @@ public void resetFlippedEntityExample(Player viewer) { } ``` +#### `Entity` Parameters + +1. `Recipients recipients` + - A list of all the player(s) you want to be able to see the updated fire color. +2. `List entities` + - A list of all entities you want to reset the flip state from. + @@ -236,10 +243,3 @@ public void resetFlippedEntityExample(Player viewer) { - -#### `Entity` Parameters - -1. `Recipients recipients` - - A list of all the player(s) you want to be able to see the updated fire color. -2. `List entities` - - A list of all entities you want to reset the flip state from. diff --git a/docs/developers/modules/glow.mdx b/docs/developers/modules/glow.mdx index 667bb972..38952b2d 100644 --- a/docs/developers/modules/glow.mdx +++ b/docs/developers/modules/glow.mdx @@ -53,6 +53,15 @@ public void resetGlowEffectsExample(Player viewer) { } ``` +### `overrideGlowEffectExample` Parameters + +1. `Recipients recipients` + - A list of all the player(s) you want to be able to see the updated glow effect. +2. `UUID target` + - The player or living entity you want to display the glow effect on. +3. `Color glowColor` + - How you'll dictate the color of the glow effect, see the [colors page](/apollo/developers/utilities/colors) for more. + @@ -134,12 +143,3 @@ public void resetGlowEffectsExample(Player viewer) { - -### `overrideGlowEffectExample` Parameters - -1. `Recipients recipients` - - A list of all the player(s) you want to be able to see the updated glow effect. -2. `UUID target` - - The player or living entity you want to display the glow effect on. -3. `Color glowColor` - - How you'll dictate the color of the glow effect, see the [colors page](/apollo/developers/utilities/colors) for more. diff --git a/docs/developers/modules/hologram.mdx b/docs/developers/modules/hologram.mdx index 65effa99..fdd1885a 100644 --- a/docs/developers/modules/hologram.mdx +++ b/docs/developers/modules/hologram.mdx @@ -68,6 +68,59 @@ public void resetHologramsExample(Player viewer) { } ``` +### `Hologram` Options + +`.id(String)` should include a unique identifier for the hologram. + +```java +.id("welcome-hologram") +``` + +`.location(ApolloLocation)` is using the `ApolloLocation` builder to create the location. See the [locations page](/apollo/developers/utilities/locations) for more. + +```java +.location(ApolloLocation.builder() + .world("world") + .x(5) + .y(100) + .z(0) + .build() +) +``` + +`.lines(Component)` should be a string, or an Adventure `Component`. See the [chat components](https://docs.advntr.dev/text.html) page for more. + +```java +.lines(List.of( + Component.text() + .content("Welcome to my server!") + .color(NamedTextColor.RED) + .decorate(TextDecoration.BOLD, TextDecoration.UNDERLINED) + .build(), + Component.text() + .content("Type /help to get started!") + .build() +)) +``` + +`.showThroughWalls(Boolean)` if the player is able to see the hologram through walls. + +```java +.showThroughWalls(true) +``` + +`.showShadow(Boolean)` if the player is able to see the hologram shadow. + +```java +.showShadow(false) +``` + +`.showBackground(Boolean)` if the player is able to see the hologram background. + +```java +.showBackground(true) +``` + @@ -186,56 +239,3 @@ public void resetHologramsExample(Player viewer) { - -### `Hologram` Options - -`.id(String)` should include a unique identifier for the hologram. - -```java -.id("welcome-hologram") -``` - -`.location(ApolloLocation)` is using the `ApolloLocation` builder to create the location. See the [locations page](/apollo/developers/utilities/locations) for more. - -```java -.location(ApolloLocation.builder() - .world("world") - .x(5) - .y(100) - .z(0) - .build() -) -``` - -`.lines(Component)` should be a string, or an Adventure `Component`. See the [chat components](https://docs.advntr.dev/text.html) page for more. - -```java -.lines(List.of( - Component.text() - .content("Welcome to my server!") - .color(NamedTextColor.RED) - .decorate(TextDecoration.BOLD, TextDecoration.UNDERLINED) - .build(), - Component.text() - .content("Type /help to get started!") - .build() -)) -``` - -`.showThroughWalls(Boolean)` if the player is able to see the hologram through walls. - -```java -.showThroughWalls(true) -``` - -`.showShadow(Boolean)` if the player is able to see the hologram shadow. - -```java -.showShadow(false) -``` - -`.showBackground(Boolean)` if the player is able to see the hologram background. - -```java -.showBackground(true) -``` diff --git a/docs/developers/modules/limb.mdx b/docs/developers/modules/limb.mdx index 85b95b01..2b260908 100644 --- a/docs/developers/modules/limb.mdx +++ b/docs/developers/modules/limb.mdx @@ -84,6 +84,40 @@ public void resetBodyExample(Player viewer, Player target) { } ``` +#### `Armor` Parameters + +1. `Recipients recipients` + - A list of all the player(s) you want to be able to see the updated fire color. +2. `UUID Target` + - The player UUID you want to hide the armor piece of. +3. `ArmorPiece.TYPE` + - The armor piece types you wish to hide on the `target` player. See the [armor pieces](#armorpiece-types) section for more. + +#### `Body` Parameters + +1. `Recipients recipients` + - A list of all the player(s) you want to be able to see the updated fire color. +2. `UUID Target` + - The players UUID you want to reset the body part of. +3. `BodyPart.TYPE` + - The type of body part(s) you want to reset on the `target` player. See the [body parts](#bodyparts-types) section for more. + +## `ArmorPiece` Types + +* `HELMET` +* `CHESTPLATE` +* `LEGGINGS` +* `BOOTS` + +## `BodyPart` Types + +* `HEAD` +* `TORSO` +* `LEFT_ARM` +* `RIGHT_ARM` +* `LEFT_LEG` +* `RIGHT_LEG` + @@ -215,37 +249,3 @@ public void resetBodyExample(Player viewer, Player target) { - -#### `Armor` Parameters - -1. `Recipients recipients` - - A list of all the player(s) you want to be able to see the updated fire color. -2. `UUID Target` - - The player UUID you want to hide the armor piece of. -3. `ArmorPiece.TYPE` - - The armor piece types you wish to hide on the `target` player. See the [armor pieces](#armorpiece-types) section for more. - -#### `Body` Parameters - -1. `Recipients recipients` - - A list of all the player(s) you want to be able to see the updated fire color. -2. `UUID Target` - - The players UUID you want to reset the body part of. -3. `BodyPart.TYPE` - - The type of body part(s) you want to reset on the `target` player. See the [body parts](#bodyparts-types) section for more. - -## `ArmorPiece` Types - -* `HELMET` -* `CHESTPLATE` -* `LEGGINGS` -* `BOOTS` - -## `BodyPart` Types - -* `HEAD` -* `TORSO` -* `LEFT_ARM` -* `RIGHT_ARM` -* `LEFT_LEG` -* `RIGHT_LEG` diff --git a/docs/developers/modules/nametag.mdx b/docs/developers/modules/nametag.mdx index c0e9e18c..2d1087b0 100644 --- a/docs/developers/modules/nametag.mdx +++ b/docs/developers/modules/nametag.mdx @@ -25,6 +25,13 @@ The nametag module enhances the vanilla Minecraft nametag. ## Integration ### Sample Code +Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. + + + + + +### Override a Nametag ```java public void overrideNametagExample(Player target) { @@ -45,6 +52,23 @@ public void overrideNametagExample(Player target) { } ``` +### Reset a Nametag + +```java +public void resetNametagExample(Player target) { + this.nametagModule.resetNametag(Recipients.ofEveryone(), target.getUniqueId()); +} +``` + +### Resetting all Nametags + +```java +public void resetNametagsExample(Player viewer) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(this.nametagModule::resetNametags); +} +``` + ### `overrideNametag` Parameters 1. `Recipients recipients` @@ -73,19 +97,112 @@ public void overrideNametagExample(Player target) { )) ``` -### Reset nametag for players + + + + +### Override a Nametag + +```java +public void overrideNametagExample(Player target) { + List lines = Lists.newArrayList( + Component.text() + .content("[StaffMode]") + .decorate(TextDecoration.ITALIC) + .color(NamedTextColor.GRAY) + .build(), + Component.text() + .content(target.getName()) + .color(NamedTextColor.RED) + .build() + ) + .stream().map(AdventureUtil::toJson) + .collect(Collectors.toList()); + + OverrideNametagMessage message = OverrideNametagMessage.newBuilder() + .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId())) + .addAllAdventureJsonLines(lines) + .build(); + + ProtobufPacketUtil.broadcastPacket(message); +} +``` + +### Reset a Nametag ```java public void resetNametagExample(Player target) { - this.nametagModule.resetNametag(Recipients.ofEveryone(), target.getUniqueId()); + ResetNametagMessage message = ResetNametagMessage.newBuilder() + .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId())) + .build(); + + ProtobufPacketUtil.broadcastPacket(message); } ``` -### Resetting all nametags for a player +### Resetting all Nametags ```java public void resetNametagsExample(Player viewer) { - Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); - apolloPlayerOpt.ifPresent(this.nametagModule::resetNametags); + ResetNametagsMessage message = ResetNametagsMessage.getDefaultInstance(); + ProtobufPacketUtil.sendPacket(viewer, message); +} +``` + + + + + +### Override a Nametag + +```java +public void overrideNametagExample(Player target) { + JsonArray lines = Lists.newArrayList( + Component.text() + .content("[StaffMode]") + .decorate(TextDecoration.ITALIC) + .color(NamedTextColor.GRAY) + .build(), + Component.text() + .content(target.getName()) + .color(NamedTextColor.RED) + .build() + ) + .stream().map(AdventureUtil::toJson) + .collect(JsonArray::new, JsonArray::add, JsonArray::addAll); + + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.nametag.v1.OverrideNametagMessage"); + message.add("player_uuid", JsonUtil.createUuidObject(target.getUniqueId())); + message.add("adventure_json_lines", lines); + + JsonPacketUtil.broadcastPacket(message); +} +``` + +### Reset a Nametag + +```java +public void resetNametagExample(Player target) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.nametag.v1.ResetNametagMessage"); + message.add("player_uuid", JsonUtil.createUuidObject(target.getUniqueId())); + + JsonPacketUtil.broadcastPacket(message); } ``` + +### Resetting all Nametags + +```java +public void resetNametagsExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.nametag.v1.ResetNametagsMessage"); + + JsonPacketUtil.sendPacket(viewer, message); +} +``` + + + + diff --git a/docs/developers/modules/nickhider.mdx b/docs/developers/modules/nickhider.mdx index edfcb6fa..4122158b 100644 --- a/docs/developers/modules/nickhider.mdx +++ b/docs/developers/modules/nickhider.mdx @@ -10,7 +10,14 @@ The Nick Hider module allows you to interact with the Nick Hider mod. ## Integration -### Override the nick for a specific player +### Sample Code +Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. + + + + + +### Override a Nick ```java public void overrideNickExample(Player viewer) { @@ -19,7 +26,7 @@ public void overrideNickExample(Player viewer) { } ``` -### Reset the nick for a specific player +### Reset a Nick ```java public void resetNickExample(Player viewer) { @@ -27,3 +34,59 @@ public void resetNickExample(Player viewer) { apolloPlayerOpt.ifPresent(this.nickHiderModule::resetNick); } ``` + + + + + +### Override a Nick + +```java +public void overrideNickExample(Player viewer) { + OverrideNickHiderMessage message = OverrideNickHiderMessage.newBuilder() + .setNick("Notch") + .build(); + + ProtobufPacketUtil.sendPacket(viewer, message); +} +``` + +### Reset a Nick + +```java +public void resetNickExample(Player viewer) { + ResetNickHiderMessage message = ResetNickHiderMessage.getDefaultInstance(); + ProtobufPacketUtil.sendPacket(viewer, message); +} +``` + + + + + +### Override a Nick + +```java +public void overrideNickExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.nickhider.v1.OverrideNickHiderMessage"); + message.addProperty("nick", "Notch"); + + JsonPacketUtil.sendPacket(viewer, message); +} +``` + +### Reset a Nick + +```java +public void resetNickExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.nickhider.v1.ResetNickHiderMessage"); + + JsonPacketUtil.sendPacket(viewer, message); +} +``` + + + + diff --git a/docs/developers/modules/notification.mdx b/docs/developers/modules/notification.mdx index 3d0346f0..4876f915 100644 --- a/docs/developers/modules/notification.mdx +++ b/docs/developers/modules/notification.mdx @@ -19,7 +19,14 @@ The notification module allows you to send Lunar Client notifications to players ## Integration -### Displaying a Notification for a specific player +### Sample Code +Explore each integration by cycling through each tab, to find the best fit for your requirements and needs. + + + + + +### Displaying a Notification ```java public void displayNotificationExample(Player viewer) { @@ -41,6 +48,15 @@ public void displayNotificationExample(Player viewer) { } ``` +### Resetting all Notifications + +```java +public void resetNotificationsExample(Player viewer) { + Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); + apolloPlayerOpt.ifPresent(this.notificationModule::resetNotifications); +} +``` + #### `Notification` Options @@ -89,11 +105,82 @@ If this field is left empty (null) it'll display a generic info icon, as display .description("UHC starts in 5 minutes...") ``` -### Resetting all notifications for a player + + + + +### Displaying a Notification + +```java +public void displayNotificationExample(Player viewer) { + DisplayNotificationMessage message = DisplayNotificationMessage.newBuilder() + .setTitleAdventureJsonLines(AdventureUtil.toJson( + Component.text("UHC Announcement", NamedTextColor.GREEN) + )) + .setDescriptionAdventureJsonLines(AdventureUtil.toJson( + Component.text("UHC starts in 5 minutes...", NamedTextColor.RED) + .appendNewline() + .append(Component.text("Get ready!", NamedTextColor.WHITE)) + .appendNewline() + .append(Component.text("Good luck!", NamedTextColor.GOLD)) + ) + ) + .setResourceLocation("icons/golden_apple.png") // This field is optional + .setDisplayTime(ProtobufUtil.createDurationProto(Duration.ofSeconds(5))) + .build(); + + ProtobufPacketUtil.sendPacket(viewer, message); +} +``` + +### Resetting all Notifications ```java public void resetNotificationsExample(Player viewer) { - Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); - apolloPlayerOpt.ifPresent(this.notificationModule::resetNotifications); + ResetNotificationsMessage message = ResetNotificationsMessage.getDefaultInstance(); + ProtobufPacketUtil.sendPacket(viewer, message); +} +``` + + + + + +### Displaying a Notification + +```java +public void displayNotificationExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.notification.v1.DisplayNotificationMessage"); + message.addProperty("title_adventure_json_lines", AdventureUtil.toJson( + Component.text("UHC Announcement", NamedTextColor.GREEN) + )); + message.addProperty("description_adventure_json_lines", AdventureUtil.toJson( + Component.text("UHC starts in 5 minutes...", NamedTextColor.RED) + .appendNewline() + .append(Component.text("Get ready!", NamedTextColor.WHITE)) + .appendNewline() + .append(Component.text("Good luck!", NamedTextColor.GOLD)) + )); + + message.addProperty("display_time", JsonUtil.createDurationObject(Duration.ofSeconds(5))); + message.addProperty("resource_location", "icons/golden_apple.png"); + + JsonPacketUtil.sendPacket(viewer, message); } ``` + +### Resetting all Notifications + +```java +public void resetNotificationsExample(Player viewer) { + JsonObject message = new JsonObject(); + message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.notification.v1.ResetNotificationsMessage"); + + JsonPacketUtil.sendPacket(viewer, message); +} +``` + + + +