From 1b5997a3be8d31de68db640e5a85665e27f656de Mon Sep 17 00:00:00 2001
From: Connor Lewis <50084106+imconnorngl@users.noreply.github.com>
Date: Fri, 25 Oct 2024 17:26:37 +0100
Subject: [PATCH 1/3] fix(docs): update to correct image paths (#180)
---
docs/downloads.mdx | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/docs/downloads.mdx b/docs/downloads.mdx
index 7216e9e9..b80f6218 100644
--- a/docs/downloads.mdx
+++ b/docs/downloads.mdx
@@ -14,8 +14,8 @@ import router from "next/router";
,
+ backgroundImage: "/backgrounds/1.png",
+ customIcon: ,
title: "Bukkit",
subtitle: "",
button: [
@@ -38,8 +38,8 @@ import router from "next/router";
},
},
{
- backgroundImage: "/assets/backgrounds/2.png",
- customIcon: ,
+ backgroundImage: "/backgrounds/2.png",
+ customIcon: ,
title: "Bungee",
subtitle: "",
button: [
@@ -62,8 +62,8 @@ import router from "next/router";
},
},
{
- backgroundImage: "/assets/backgrounds/3.png",
- customIcon: ,
+ backgroundImage: "/backgrounds/3.png",
+ customIcon: ,
title: "Velocity",
subtitle: "",
button: [
From 11600a8e146b89b650b4f69403ae906eb046be15 Mon Sep 17 00:00:00 2001
From: Trentin <25537885+TrentinTheKid@users.noreply.github.com>
Date: Fri, 25 Oct 2024 12:26:54 -0400
Subject: [PATCH 2/3] Add chat creation section (#178)
---
docs/developers/modules/waypoint.mdx | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/docs/developers/modules/waypoint.mdx b/docs/developers/modules/waypoint.mdx
index 43e59655..6458bde0 100644
--- a/docs/developers/modules/waypoint.mdx
+++ b/docs/developers/modules/waypoint.mdx
@@ -143,3 +143,20 @@ public void resetWaypointsExample(Player viewer) {
- Values
- Type: `List`
- Default: `Empty List`
+
+## Automatic Waypoint Creation from Chat
+
+Our Waypoints mod has a built-in feature that allows players to click on coordinates in chat and generate waypoints for those locations, if the coordinates follow specific regex patterns.
+
+### Regex Patterns for Waypoint Creation from Chat
+
+The following regex patterns are used to extract coordinates from chat messages. The system will automatically generate waypoints when these patterns match a chat message.
+
+- **Bracket Pattern**: Matches coordinates in the format of `"[x, y, z]"`.
+ - Regex: `\\[(?(?:-|)[0-9.]*), (?(?:-|)[0-9.]*), (?(?:-|)[0-9.]*)]`
+ - Chat Example: `[100.5, 64, -200]`
+
+
+- **Title Pattern**: Matches coordinates in the format of `"X: x, Y: y, Z: z"`.
+ - Regex: `\\[(?(?:-|)[0-9.]*), (?(?:-|)[0-9.]*), (?(?:-|)[0-9.]*)]`
+ - Chat Example: `X: 123, Y: 65, Z: -320`
From 634813e0452a692e995b544d19767f151d015f41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matej=20Bu=C4=8Dari=C4=87?=
Date: Mon, 28 Oct 2024 17:29:06 +0100
Subject: [PATCH 3/3] Lightweight: Documentation (#172)
* Add a bunch of lightweight examples
* Add more examples
* Even more examples...
* More examples & prepare for example plugin merge
* Fix adventure usages
* Testable state
* Add more notes
* Add switch implementation command
* Finish more examples, start working on markdown
* Spotless fixes
* Update beam.mdx with new examples
* Finish team examples
* More markdown work
* Add missing import to chat.mdx
* Move builders outside tabs again
* Fix remaining serialization issues
* Add more markdown examples
* Add hologram & limb examples
* move builders inside API tab, add nametag, nickhider & notification examples
* Finish proto examples
* Remove object utils
* add temp layout
* Finish all Json Examples
* Add Tebex module locale field to lightweight examples
* The merge!
* Start lightweight.mdx rewrite
* Close tab
* Import callout
* ADd modsettings examples
* richpresence, serverrule, staffmod, stopwatch, title, tntcountdown, tranfser, vignette & waypoint markdown examples
* Protobuf Lightweight Documentation
* Minor changes
* Updating player world code & markdown, packet enrichment & minor parameter fixups
* Fix links
* Fix the fixed links
* Spotless fixes
* Add lightweight callout to intro
* add intro to meta json
* Finish JSON lightweight docs
* Remove old lightweight.mdx
* Link usage methods, add module examples note
* resolve callout issue?
* Rebuild
* Team markdown examples
* update callout
* update callout
* remove placeholder text
* Remove build status
* Replace Component#appendNewLine with Component.append(Component.newline()) for backwards compatibility
* Default implementation type to API
* Remove protobuf-java-util dependency
* Final touch-ups
* fix typo
* Wording Change
* Lightning -> Lighting
* Use Futures for Roundtrip example & implement timeout
* Mark player data fields with `@Nullable`
---------
Co-authored-by: TrentinTheKid <25537885+TrentinTheKid@users.noreply.github.com>
---
README.md | 1 -
.../apollo/player/ApolloPlayer.java | 10 +-
bukkit-example/build.gradle.kts | 12 +
.../apollo/example/ApolloExamplePlugin.java | 351 +++++++++++++-----
.../{ => api}/ApolloGeneralExample.java | 2 +-
.../examples/BeamApiExample.java} | 8 +-
.../examples/BorderApiExample.java} | 8 +-
.../examples/ChatApiExample.java} | 13 +-
.../examples/ColoredFireApiExample.java} | 8 +-
.../examples/CombatApiExample.java} | 6 +-
.../examples/CooldownApiExample.java} | 9 +-
.../examples/EntityApiExample.java} | 9 +-
.../examples/GlowApiExample.java} | 8 +-
.../examples/HologramApiExample.java} | 8 +-
.../examples/LimbApiExample.java} | 9 +-
.../examples/ModSettingsApiExample.java} | 14 +-
.../examples/NametagApiExample.java} | 8 +-
.../examples/NickHiderApiExample.java} | 7 +-
.../examples/NotificationApiExample.java} | 34 +-
.../examples/RichPresenceApiExample.java} | 7 +-
.../examples/ServerRuleApiExample.java} | 8 +-
.../examples/StaffModApiExample.java} | 7 +-
.../examples/StopwatchApiExample.java} | 8 +-
.../examples/TeamApiExample.java} | 84 ++++-
.../examples/TebexApiExample.java} | 6 +-
.../examples/TitleApiExample.java} | 67 ++--
.../examples/TntCountdownApiExample.java} | 10 +-
.../examples/TransferApiExample.java} | 7 +-
.../examples/VignetteApiExample.java} | 7 +-
.../examples/WaypointApiExample.java} | 8 +-
.../listeners/ApolloGeneralApiListener.java} | 4 +-
.../listeners/ApolloPlayerApiListener.java} | 22 +-
.../utilities/BukkitApolloExample.java | 2 +-
.../{ => api}/utilities/ComponentExample.java | 2 +-
.../{ => api}/utilities/CuboidExample.java | 2 +-
.../{ => api}/utilities/IconExample.java | 2 +-
.../{ => api}/utilities/LocationExample.java | 2 +-
.../common/commands/SwitchCommand.java | 76 ++++
.../commands/module}/BeamCommand.java | 14 +-
.../commands/module}/BorderCommand.java | 14 +-
.../commands/module}/ChatCommand.java | 12 +-
.../commands/module}/ColoredFireCommand.java | 13 +-
.../commands/module}/CombatCommand.java | 10 +-
.../commands/module}/CooldownCommand.java | 16 +-
.../commands/module}/EntityCommand.java | 16 +-
.../commands/module}/GlowCommand.java | 13 +-
.../commands/module}/HologramCommand.java | 14 +-
.../commands/module}/LimbCommand.java | 16 +-
.../commands/module}/ModSettingsCommand.java | 20 +-
.../commands/module}/NametagCommand.java | 14 +-
.../commands/module}/NickHiderCommand.java | 12 +-
.../commands/module}/NotificationCommand.java | 12 +-
.../commands/module}/RichPresenceCommand.java | 12 +-
.../commands/module}/ServerRuleCommand.java | 14 +-
.../commands/module}/StaffModCommand.java | 12 +-
.../commands/module}/StopwatchCommand.java | 14 +-
.../commands/module}/TeamCommand.java | 59 +--
.../commands/module}/TebexCommand.java | 9 +-
.../commands/module}/TitleCommand.java | 22 +-
.../commands/module}/TntCountdownCommand.java | 14 +-
.../commands/module}/TransferCommand.java | 12 +-
.../commands/module}/VignetteCommand.java | 12 +-
.../commands/module}/WaypointCommand.java | 14 +-
.../example/common/modules/ApolloExample.java | 37 ++
.../common/modules/ApolloExampleType.java | 30 ++
.../common/modules/impl/BeamExample.java | 37 ++
.../common/modules/impl/BorderExample.java | 37 ++
.../common/modules/impl/ChatExample.java | 34 ++
.../modules/impl/ColoredFireExample.java | 38 ++
.../common/modules/impl/CombatExample.java | 32 ++
.../common/modules/impl/CooldownExample.java | 39 ++
.../common/modules/impl/EntityExample.java | 39 ++
.../common/modules/impl/GlowExample.java | 38 ++
.../common/modules/impl/HologramExample.java | 37 ++
.../common/modules/impl/LimbExample.java | 39 ++
.../modules/impl/ModSettingsExample.java | 37 ++
.../common/modules/impl/NametagExample.java | 37 ++
.../common/modules/impl/NickHiderExample.java | 35 ++
.../modules/impl/NotificationExample.java | 35 ++
.../modules/impl/RichPresenceExample.java | 35 ++
.../modules/impl/ServerRuleExample.java | 37 ++
.../common/modules/impl/StaffModExample.java | 35 ++
.../common/modules/impl/StopwatchExample.java | 37 ++
.../common/modules/impl/TeamExample.java | 39 ++
.../common/modules/impl/TebexExample.java | 33 ++
.../common/modules/impl/TitleExample.java | 37 ++
.../modules/impl/TntCountdownExample.java | 37 ++
.../common/modules/impl/TransferExample.java | 35 ++
.../common/modules/impl/VignetteExample.java | 35 ++
.../common/modules/impl/WaypointExample.java | 37 ++
.../apollo/example/json/AdventureUtil.java | 39 ++
.../apollo/example/json/JsonPacketUtil.java | 134 +++++++
.../apollo/example/json/JsonUtil.java | 154 ++++++++
.../json/examples/BeamJsonExample.java | 67 ++++
.../json/examples/BorderJsonExample.java | 68 ++++
.../json/examples/ChatJsonExample.java | 63 ++++
.../json/examples/ColoredFireJsonExample.java | 63 ++++
.../json/examples/CombatJsonExample.java | 44 +++
.../json/examples/CooldownJsonExample.java | 74 ++++
.../json/examples/EntityJsonExample.java | 93 +++++
.../json/examples/GlowJsonExample.java | 63 ++++
.../json/examples/HologramJsonExample.java | 88 +++++
.../json/examples/LimbJsonExample.java | 97 +++++
.../json/examples/ModSettingsJsonExample.java | 64 ++++
.../json/examples/NametagJsonExample.java | 82 ++++
.../json/examples/NickHiderJsonExample.java | 50 +++
.../examples/NotificationJsonExample.java | 67 ++++
.../examples/RichPresenceJsonExample.java | 57 +++
.../json/examples/ServerRuleJsonExample.java | 63 ++++
.../json/examples/StaffModJsonExample.java | 68 ++++
.../json/examples/StopwatchJsonExample.java | 57 +++
.../json/examples/TeamJsonExample.java | 255 +++++++++++++
.../json/examples/TebexJsonExample.java | 46 +++
.../json/examples/TitleJsonExample.java | 89 +++++
.../examples/TntCountdownJsonExample.java | 140 +++++++
.../json/examples/TransferJsonExample.java | 41 ++
.../json/examples/VignetteJsonExample.java | 51 +++
.../json/examples/WaypointJsonExample.java | 69 ++++
.../listeners/ApolloPlayerJsonListener.java | 107 ++++++
.../apollo/example/proto/AdventureUtil.java | 39 ++
.../example/proto/ProtobufPacketUtil.java | 118 ++++++
.../apollo/example/proto/ProtobufUtil.java | 156 ++++++++
.../proto/examples/BeamProtoExample.java | 64 ++++
.../proto/examples/BorderProtoExample.java | 68 ++++
.../proto/examples/ChatProtoExample.java | 64 ++++
.../examples/ColoredFireProtoExample.java | 63 ++++
.../proto/examples/CombatProtoExample.java | 44 +++
.../proto/examples/CooldownProtoExample.java | 74 ++++
.../proto/examples/EntityProtoExample.java | 98 +++++
.../proto/examples/GlowProtoExample.java | 63 ++++
.../proto/examples/HologramProtoExample.java | 89 +++++
.../proto/examples/LimbProtoExample.java | 80 ++++
.../examples/ModSettingsProtoExample.java | 65 ++++
.../proto/examples/NametagProtoExample.java | 82 ++++
.../proto/examples/NickHiderProtoExample.java | 49 +++
.../examples/NotificationProtoExample.java | 66 ++++
.../examples/RichPresenceProtoExample.java | 56 +++
.../examples/ServerRuleProtoExample.java | 63 ++++
.../proto/examples/StaffModProtoExample.java | 58 +++
.../proto/examples/StopwatchProtoExample.java | 53 +++
.../proto/examples/TeamProtoExample.java | 254 +++++++++++++
.../proto/examples/TebexProtoExample.java | 46 +++
.../proto/examples/TitleProtoExample.java | 89 +++++
.../examples/TntCountdownProtoExample.java | 143 +++++++
.../proto/examples/TransferProtoExample.java | 110 ++++++
.../proto/examples/VignetteProtoExample.java | 50 +++
.../proto/examples/WaypointProtoExample.java | 66 ++++
.../ApolloPacketReceiveProtoListener.java | 135 +++++++
.../listeners/ApolloPlayerProtoListener.java | 105 ++++++
.../ApolloRoundtripProtoListener.java | 110 ++++++
bukkit-example/src/main/resources/plugin.yml | 4 +-
docs/developers/_meta.json | 3 +-
docs/developers/events.mdx | 1 +
docs/developers/lightweight/_meta.json | 5 +
docs/developers/lightweight/introduction.mdx | 28 ++
docs/developers/lightweight/json/_meta.json | 7 +
.../lightweight/json/adventure-util.mdx | 13 +
.../lightweight/json/getting-started.mdx | 22 ++
.../lightweight/json/object-util.mdx | 129 +++++++
.../lightweight/json/packet-util.mdx | 124 +++++++
.../lightweight/json/player-detection.mdx | 64 ++++
.../lightweight/protobuf/_meta.json | 9 +
.../lightweight/protobuf/adventure-util.mdx | 13 +
.../lightweight/protobuf/getting-started.mdx | 74 ++++
.../lightweight/protobuf/object-util.mdx | 126 +++++++
.../lightweight/protobuf/packet-util.mdx | 105 ++++++
.../lightweight/protobuf/player-detection.mdx | 53 +++
.../protobuf/roundtrip-packets.mdx | 111 ++++++
.../protobuf/serverbound-packets.mdx | 102 +++++
docs/developers/modules/beam.mdx | 108 +++++-
docs/developers/modules/border.mdx | 113 +++++-
docs/developers/modules/chat.mdx | 103 ++++-
docs/developers/modules/coloredfire.mdx | 101 ++++-
docs/developers/modules/cooldown.mdx | 143 ++++++-
docs/developers/modules/entity.mdx | 196 ++++++++--
docs/developers/modules/glow.mdx | 101 ++++-
docs/developers/modules/hologram.mdx | 139 ++++++-
docs/developers/modules/limb.mdx | 197 ++++++++--
docs/developers/modules/modsetting.mdx | 107 +++++-
docs/developers/modules/nametag.mdx | 128 ++++++-
docs/developers/modules/nickhider.mdx | 69 +++-
docs/developers/modules/notification.mdx | 121 +++++-
docs/developers/modules/packetenrichment.mdx | 18 +
docs/developers/modules/richpresence.mdx | 84 ++++-
docs/developers/modules/serverrule.mdx | 98 ++++-
docs/developers/modules/staffmod.mdx | 107 +++++-
docs/developers/modules/stopwatch.mdx | 87 ++++-
docs/developers/modules/team.mdx | 294 +++++++++++++++
docs/developers/modules/title.mdx | 207 +++++++++--
docs/developers/modules/tntcountdown.mdx | 261 ++++++++++++-
docs/developers/modules/transfer.mdx | 125 ++++++-
docs/developers/modules/vignette.mdx | 75 +++-
docs/developers/modules/waypoint.mdx | 121 +++++-
docs/internals/lightweight.mdx | 232 ------------
docs/introduction.mdx | 6 +
195 files changed, 10650 insertions(+), 881 deletions(-)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{ => api}/ApolloGeneralExample.java (98%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/BeamExample.java => api/examples/BeamApiExample.java} (92%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/BorderExample.java => api/examples/BorderApiExample.java} (93%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/ChatExample.java => api/examples/ChatApiExample.java} (89%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/ColoredFireExample.java => api/examples/ColoredFireApiExample.java} (90%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/CombatExample.java => api/examples/CombatApiExample.java} (88%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/CooldownExample.java => api/examples/CooldownApiExample.java} (93%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/EntityExample.java => api/examples/EntityApiExample.java} (94%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/GlowExample.java => api/examples/GlowApiExample.java} (90%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/HologramExample.java => api/examples/HologramApiExample.java} (93%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/LimbExample.java => api/examples/LimbApiExample.java} (93%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/ModSettingsExample.java => api/examples/ModSettingsApiExample.java} (84%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/NametagExample.java => api/examples/NametagApiExample.java} (92%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/NickHiderExample.java => api/examples/NickHiderApiExample.java} (90%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/NotificationExample.java => api/examples/NotificationApiExample.java} (67%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/RichPresenceExample.java => api/examples/RichPresenceApiExample.java} (91%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/ServerRuleExample.java => api/examples/ServerRuleApiExample.java} (90%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/StaffModExample.java => api/examples/StaffModApiExample.java} (91%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/StopwatchExample.java => api/examples/StopwatchApiExample.java} (90%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/TeamExample.java => api/examples/TeamApiExample.java} (68%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/TebexExample.java => api/examples/TebexApiExample.java} (91%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/TitleExample.java => api/examples/TitleApiExample.java} (60%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/TntCountdownExample.java => api/examples/TntCountdownApiExample.java} (89%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/TransferExample.java => api/examples/TransferApiExample.java} (95%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/VignetteExample.java => api/examples/VignetteApiExample.java} (91%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{modules/WaypointExample.java => api/examples/WaypointApiExample.java} (92%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{listeners/GeneralListenerExample.java => api/listeners/ApolloGeneralApiListener.java} (97%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{listeners/PlayerListener.java => api/listeners/ApolloPlayerApiListener.java} (76%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{ => api}/utilities/BukkitApolloExample.java (98%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{ => api}/utilities/ComponentExample.java (97%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{ => api}/utilities/CuboidExample.java (97%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{ => api}/utilities/IconExample.java (97%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{ => api}/utilities/LocationExample.java (97%)
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/SwitchCommand.java
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/BeamCommand.java (86%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/BorderCommand.java (86%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/ChatCommand.java (87%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/ColoredFireCommand.java (85%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/CombatCommand.java (89%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/CooldownCommand.java (84%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/EntityCommand.java (85%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/GlowCommand.java (86%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/HologramCommand.java (86%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/LimbCommand.java (86%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/ModSettingsCommand.java (77%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/NametagCommand.java (86%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/NickHiderCommand.java (87%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/NotificationCommand.java (86%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/RichPresenceCommand.java (85%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/ServerRuleCommand.java (87%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/StaffModCommand.java (86%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/StopwatchCommand.java (85%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/TeamCommand.java (57%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/TebexCommand.java (88%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/TitleCommand.java (75%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/TntCountdownCommand.java (85%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/TransferCommand.java (87%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/VignetteCommand.java (87%)
rename bukkit-example/src/main/java/com/lunarclient/apollo/example/{commands => common/commands/module}/WaypointCommand.java (85%)
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/ApolloExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/ApolloExampleType.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/BeamExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/BorderExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ChatExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ColoredFireExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/CombatExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/CooldownExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/EntityExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/GlowExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/HologramExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/LimbExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ModSettingsExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NametagExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NickHiderExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NotificationExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/RichPresenceExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ServerRuleExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/StaffModExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/StopwatchExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TeamExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TebexExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TitleExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TntCountdownExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TransferExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/VignetteExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/WaypointExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/AdventureUtil.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/JsonPacketUtil.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/JsonUtil.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/BeamJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/BorderJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ChatJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ColoredFireJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/CombatJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/CooldownJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/EntityJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/GlowJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/HologramJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/LimbJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ModSettingsJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NametagJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NickHiderJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NotificationJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/RichPresenceJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ServerRuleJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/StaffModJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/StopwatchJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TeamJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TebexJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TitleJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TntCountdownJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TransferJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/VignetteJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/WaypointJsonExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/json/listeners/ApolloPlayerJsonListener.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/AdventureUtil.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/ProtobufPacketUtil.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/ProtobufUtil.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/BeamProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/BorderProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ChatProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ColoredFireProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/CombatProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/CooldownProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/EntityProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/GlowProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/HologramProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/LimbProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ModSettingsProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NametagProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NickHiderProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NotificationProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/RichPresenceProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ServerRuleProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/StaffModProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/StopwatchProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TeamProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TebexProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TitleProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TntCountdownProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TransferProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/VignetteProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/WaypointProtoExample.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPacketReceiveProtoListener.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPlayerProtoListener.java
create mode 100644 bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloRoundtripProtoListener.java
create mode 100644 docs/developers/lightweight/_meta.json
create mode 100644 docs/developers/lightweight/introduction.mdx
create mode 100644 docs/developers/lightweight/json/_meta.json
create mode 100644 docs/developers/lightweight/json/adventure-util.mdx
create mode 100644 docs/developers/lightweight/json/getting-started.mdx
create mode 100644 docs/developers/lightweight/json/object-util.mdx
create mode 100644 docs/developers/lightweight/json/packet-util.mdx
create mode 100644 docs/developers/lightweight/json/player-detection.mdx
create mode 100644 docs/developers/lightweight/protobuf/_meta.json
create mode 100644 docs/developers/lightweight/protobuf/adventure-util.mdx
create mode 100644 docs/developers/lightweight/protobuf/getting-started.mdx
create mode 100644 docs/developers/lightweight/protobuf/object-util.mdx
create mode 100644 docs/developers/lightweight/protobuf/packet-util.mdx
create mode 100644 docs/developers/lightweight/protobuf/player-detection.mdx
create mode 100644 docs/developers/lightweight/protobuf/roundtrip-packets.mdx
create mode 100644 docs/developers/lightweight/protobuf/serverbound-packets.mdx
delete mode 100644 docs/internals/lightweight.mdx
diff --git a/README.md b/README.md
index 1d533c25..6d554e82 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,4 @@
# Apollo
-![Build Status](https://img.shields.io/github/actions/workflow/status/LunarClient/Apollo/.github/workflows/deploy.yml)
[![Discord](https://img.shields.io/discord/1080556677004271666?logo=discord&label=discord)](https://discord.gg/3T9Atyb6pf)
Apollo is a powerful tool that allows developers to create custom integrations with Lunar Client.
diff --git a/api/src/main/java/com/lunarclient/apollo/player/ApolloPlayer.java b/api/src/main/java/com/lunarclient/apollo/player/ApolloPlayer.java
index 5770214e..63f8bf9f 100644
--- a/api/src/main/java/com/lunarclient/apollo/player/ApolloPlayer.java
+++ b/api/src/main/java/com/lunarclient/apollo/player/ApolloPlayer.java
@@ -37,6 +37,7 @@
import java.util.UUID;
import net.kyori.adventure.audience.ForwardingAudience;
import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Nullable;
/**
* Represents a player on Apollo.
@@ -111,14 +112,13 @@ default boolean hasPermission(Options options, Option option) {
*/
Object getPlayer();
- // TODO: nullable or optional?
/**
* Returns the {@link MinecraftVersion} the player is running.
*
* @return the minecraft version
* @since 1.1.5
*/
- MinecraftVersion getMinecraftVersion();
+ @Nullable MinecraftVersion getMinecraftVersion();
/**
* Returns the {@link LunarClientVersion} the player is running.
@@ -126,7 +126,7 @@ default boolean hasPermission(Options options, Option option) {
* @return the lunar client version
* @since 1.1.5
*/
- LunarClientVersion getLunarClientVersion();
+ @Nullable LunarClientVersion getLunarClientVersion();
/**
* Returns a {@link List} of {@link LunarClientMod} the player has installed.
@@ -134,7 +134,7 @@ default boolean hasPermission(Options options, Option option) {
* @return the installed mods
* @since 1.1.5
*/
- List getInstalledMods();
+ @Nullable List getInstalledMods();
/**
* Returns the {@link TebexEmbeddedCheckoutSupport} type.
@@ -142,6 +142,6 @@ default boolean hasPermission(Options options, Option option) {
* @return the Tebex checkout support type
* @since 1.1.5
*/
- TebexEmbeddedCheckoutSupport getTebexEmbeddedCheckoutSupport();
+ @Nullable TebexEmbeddedCheckoutSupport getTebexEmbeddedCheckoutSupport();
}
diff --git a/bukkit-example/build.gradle.kts b/bukkit-example/build.gradle.kts
index c2e4d456..6e9ceb70 100644
--- a/bukkit-example/build.gradle.kts
+++ b/bukkit-example/build.gradle.kts
@@ -1,10 +1,22 @@
plugins {
id("apollo.base-conventions")
+ id("apollo.shadow-conventions")
}
dependencies {
compileOnly(libs.bukkit.api)
+ // Used for Proto Implementation
+ api(libs.protobuf)
+
+ // Used for Proto & Json Implementation
+ api(libs.bundles.adventure) {
+ exclude("org.checkerframework")
+ exclude("net.kyori", "adventure-api")
+ exclude("net.kyori", "adventure-bom")
+ }
+
+ // Used for API Implementation
compileOnly(project(":extra:apollo-extra-adventure4"))
compileOnly(project(path = ":apollo-api", configuration = "bukkit"))
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java
index 56ec642c..f55295fb 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloExamplePlugin.java
@@ -23,58 +23,136 @@
*/
package com.lunarclient.apollo.example;
-import com.lunarclient.apollo.event.EventBus;
-import com.lunarclient.apollo.example.commands.BeamCommand;
-import com.lunarclient.apollo.example.commands.BorderCommand;
-import com.lunarclient.apollo.example.commands.ChatCommand;
-import com.lunarclient.apollo.example.commands.ColoredFireCommand;
-import com.lunarclient.apollo.example.commands.CombatCommand;
-import com.lunarclient.apollo.example.commands.CooldownCommand;
-import com.lunarclient.apollo.example.commands.EntityCommand;
-import com.lunarclient.apollo.example.commands.GlowCommand;
-import com.lunarclient.apollo.example.commands.HologramCommand;
-import com.lunarclient.apollo.example.commands.LimbCommand;
-import com.lunarclient.apollo.example.commands.ModSettingsCommand;
-import com.lunarclient.apollo.example.commands.NametagCommand;
-import com.lunarclient.apollo.example.commands.NickHiderCommand;
-import com.lunarclient.apollo.example.commands.NotificationCommand;
-import com.lunarclient.apollo.example.commands.RichPresenceCommand;
-import com.lunarclient.apollo.example.commands.ServerRuleCommand;
-import com.lunarclient.apollo.example.commands.StaffModCommand;
-import com.lunarclient.apollo.example.commands.StopwatchCommand;
-import com.lunarclient.apollo.example.commands.TeamCommand;
-import com.lunarclient.apollo.example.commands.TebexCommand;
-import com.lunarclient.apollo.example.commands.TitleCommand;
-import com.lunarclient.apollo.example.commands.TntCountdownCommand;
-import com.lunarclient.apollo.example.commands.TransferCommand;
-import com.lunarclient.apollo.example.commands.VignetteCommand;
-import com.lunarclient.apollo.example.commands.WaypointCommand;
-import com.lunarclient.apollo.example.listeners.PlayerListener;
-import com.lunarclient.apollo.example.modules.BeamExample;
-import com.lunarclient.apollo.example.modules.BorderExample;
-import com.lunarclient.apollo.example.modules.ChatExample;
-import com.lunarclient.apollo.example.modules.ColoredFireExample;
-import com.lunarclient.apollo.example.modules.CombatExample;
-import com.lunarclient.apollo.example.modules.CooldownExample;
-import com.lunarclient.apollo.example.modules.EntityExample;
-import com.lunarclient.apollo.example.modules.GlowExample;
-import com.lunarclient.apollo.example.modules.HologramExample;
-import com.lunarclient.apollo.example.modules.LimbExample;
-import com.lunarclient.apollo.example.modules.ModSettingsExample;
-import com.lunarclient.apollo.example.modules.NametagExample;
-import com.lunarclient.apollo.example.modules.NickHiderExample;
-import com.lunarclient.apollo.example.modules.NotificationExample;
-import com.lunarclient.apollo.example.modules.RichPresenceExample;
-import com.lunarclient.apollo.example.modules.ServerRuleExample;
-import com.lunarclient.apollo.example.modules.StaffModExample;
-import com.lunarclient.apollo.example.modules.StopwatchExample;
-import com.lunarclient.apollo.example.modules.TeamExample;
-import com.lunarclient.apollo.example.modules.TebexExample;
-import com.lunarclient.apollo.example.modules.TitleExample;
-import com.lunarclient.apollo.example.modules.TntCountdownExample;
-import com.lunarclient.apollo.example.modules.TransferExample;
-import com.lunarclient.apollo.example.modules.VignetteExample;
-import com.lunarclient.apollo.example.modules.WaypointExample;
+import com.lunarclient.apollo.example.api.examples.BeamApiExample;
+import com.lunarclient.apollo.example.api.examples.BorderApiExample;
+import com.lunarclient.apollo.example.api.examples.ChatApiExample;
+import com.lunarclient.apollo.example.api.examples.ColoredFireApiExample;
+import com.lunarclient.apollo.example.api.examples.CombatApiExample;
+import com.lunarclient.apollo.example.api.examples.CooldownApiExample;
+import com.lunarclient.apollo.example.api.examples.EntityApiExample;
+import com.lunarclient.apollo.example.api.examples.GlowApiExample;
+import com.lunarclient.apollo.example.api.examples.HologramApiExample;
+import com.lunarclient.apollo.example.api.examples.LimbApiExample;
+import com.lunarclient.apollo.example.api.examples.ModSettingsApiExample;
+import com.lunarclient.apollo.example.api.examples.NametagApiExample;
+import com.lunarclient.apollo.example.api.examples.NickHiderApiExample;
+import com.lunarclient.apollo.example.api.examples.NotificationApiExample;
+import com.lunarclient.apollo.example.api.examples.RichPresenceApiExample;
+import com.lunarclient.apollo.example.api.examples.ServerRuleApiExample;
+import com.lunarclient.apollo.example.api.examples.StaffModApiExample;
+import com.lunarclient.apollo.example.api.examples.StopwatchApiExample;
+import com.lunarclient.apollo.example.api.examples.TeamApiExample;
+import com.lunarclient.apollo.example.api.examples.TebexApiExample;
+import com.lunarclient.apollo.example.api.examples.TitleApiExample;
+import com.lunarclient.apollo.example.api.examples.TntCountdownApiExample;
+import com.lunarclient.apollo.example.api.examples.TransferApiExample;
+import com.lunarclient.apollo.example.api.examples.VignetteApiExample;
+import com.lunarclient.apollo.example.api.examples.WaypointApiExample;
+import com.lunarclient.apollo.example.api.listeners.ApolloPlayerApiListener;
+import com.lunarclient.apollo.example.common.commands.SwitchCommand;
+import com.lunarclient.apollo.example.common.commands.module.BeamCommand;
+import com.lunarclient.apollo.example.common.commands.module.BorderCommand;
+import com.lunarclient.apollo.example.common.commands.module.ChatCommand;
+import com.lunarclient.apollo.example.common.commands.module.ColoredFireCommand;
+import com.lunarclient.apollo.example.common.commands.module.CombatCommand;
+import com.lunarclient.apollo.example.common.commands.module.CooldownCommand;
+import com.lunarclient.apollo.example.common.commands.module.EntityCommand;
+import com.lunarclient.apollo.example.common.commands.module.GlowCommand;
+import com.lunarclient.apollo.example.common.commands.module.HologramCommand;
+import com.lunarclient.apollo.example.common.commands.module.LimbCommand;
+import com.lunarclient.apollo.example.common.commands.module.ModSettingsCommand;
+import com.lunarclient.apollo.example.common.commands.module.NametagCommand;
+import com.lunarclient.apollo.example.common.commands.module.NickHiderCommand;
+import com.lunarclient.apollo.example.common.commands.module.NotificationCommand;
+import com.lunarclient.apollo.example.common.commands.module.RichPresenceCommand;
+import com.lunarclient.apollo.example.common.commands.module.ServerRuleCommand;
+import com.lunarclient.apollo.example.common.commands.module.StaffModCommand;
+import com.lunarclient.apollo.example.common.commands.module.StopwatchCommand;
+import com.lunarclient.apollo.example.common.commands.module.TeamCommand;
+import com.lunarclient.apollo.example.common.commands.module.TebexCommand;
+import com.lunarclient.apollo.example.common.commands.module.TitleCommand;
+import com.lunarclient.apollo.example.common.commands.module.TntCountdownCommand;
+import com.lunarclient.apollo.example.common.commands.module.TransferCommand;
+import com.lunarclient.apollo.example.common.commands.module.VignetteCommand;
+import com.lunarclient.apollo.example.common.commands.module.WaypointCommand;
+import com.lunarclient.apollo.example.common.modules.ApolloExampleType;
+import com.lunarclient.apollo.example.common.modules.impl.BeamExample;
+import com.lunarclient.apollo.example.common.modules.impl.BorderExample;
+import com.lunarclient.apollo.example.common.modules.impl.ChatExample;
+import com.lunarclient.apollo.example.common.modules.impl.ColoredFireExample;
+import com.lunarclient.apollo.example.common.modules.impl.CombatExample;
+import com.lunarclient.apollo.example.common.modules.impl.CooldownExample;
+import com.lunarclient.apollo.example.common.modules.impl.EntityExample;
+import com.lunarclient.apollo.example.common.modules.impl.GlowExample;
+import com.lunarclient.apollo.example.common.modules.impl.HologramExample;
+import com.lunarclient.apollo.example.common.modules.impl.LimbExample;
+import com.lunarclient.apollo.example.common.modules.impl.ModSettingsExample;
+import com.lunarclient.apollo.example.common.modules.impl.NametagExample;
+import com.lunarclient.apollo.example.common.modules.impl.NickHiderExample;
+import com.lunarclient.apollo.example.common.modules.impl.NotificationExample;
+import com.lunarclient.apollo.example.common.modules.impl.RichPresenceExample;
+import com.lunarclient.apollo.example.common.modules.impl.ServerRuleExample;
+import com.lunarclient.apollo.example.common.modules.impl.StaffModExample;
+import com.lunarclient.apollo.example.common.modules.impl.StopwatchExample;
+import com.lunarclient.apollo.example.common.modules.impl.TeamExample;
+import com.lunarclient.apollo.example.common.modules.impl.TebexExample;
+import com.lunarclient.apollo.example.common.modules.impl.TitleExample;
+import com.lunarclient.apollo.example.common.modules.impl.TntCountdownExample;
+import com.lunarclient.apollo.example.common.modules.impl.TransferExample;
+import com.lunarclient.apollo.example.common.modules.impl.VignetteExample;
+import com.lunarclient.apollo.example.common.modules.impl.WaypointExample;
+import com.lunarclient.apollo.example.json.examples.BeamJsonExample;
+import com.lunarclient.apollo.example.json.examples.BorderJsonExample;
+import com.lunarclient.apollo.example.json.examples.ChatJsonExample;
+import com.lunarclient.apollo.example.json.examples.ColoredFireJsonExample;
+import com.lunarclient.apollo.example.json.examples.CombatJsonExample;
+import com.lunarclient.apollo.example.json.examples.CooldownJsonExample;
+import com.lunarclient.apollo.example.json.examples.EntityJsonExample;
+import com.lunarclient.apollo.example.json.examples.GlowJsonExample;
+import com.lunarclient.apollo.example.json.examples.HologramJsonExample;
+import com.lunarclient.apollo.example.json.examples.LimbJsonExample;
+import com.lunarclient.apollo.example.json.examples.ModSettingsJsonExample;
+import com.lunarclient.apollo.example.json.examples.NametagJsonExample;
+import com.lunarclient.apollo.example.json.examples.NickHiderJsonExample;
+import com.lunarclient.apollo.example.json.examples.NotificationJsonExample;
+import com.lunarclient.apollo.example.json.examples.RichPresenceJsonExample;
+import com.lunarclient.apollo.example.json.examples.ServerRuleJsonExample;
+import com.lunarclient.apollo.example.json.examples.StaffModJsonExample;
+import com.lunarclient.apollo.example.json.examples.StopwatchJsonExample;
+import com.lunarclient.apollo.example.json.examples.TeamJsonExample;
+import com.lunarclient.apollo.example.json.examples.TebexJsonExample;
+import com.lunarclient.apollo.example.json.examples.TitleJsonExample;
+import com.lunarclient.apollo.example.json.examples.TntCountdownJsonExample;
+import com.lunarclient.apollo.example.json.examples.TransferJsonExample;
+import com.lunarclient.apollo.example.json.examples.VignetteJsonExample;
+import com.lunarclient.apollo.example.json.examples.WaypointJsonExample;
+import com.lunarclient.apollo.example.json.listeners.ApolloPlayerJsonListener;
+import com.lunarclient.apollo.example.proto.examples.BeamProtoExample;
+import com.lunarclient.apollo.example.proto.examples.BorderProtoExample;
+import com.lunarclient.apollo.example.proto.examples.ChatProtoExample;
+import com.lunarclient.apollo.example.proto.examples.ColoredFireProtoExample;
+import com.lunarclient.apollo.example.proto.examples.CombatProtoExample;
+import com.lunarclient.apollo.example.proto.examples.CooldownProtoExample;
+import com.lunarclient.apollo.example.proto.examples.EntityProtoExample;
+import com.lunarclient.apollo.example.proto.examples.GlowProtoExample;
+import com.lunarclient.apollo.example.proto.examples.HologramProtoExample;
+import com.lunarclient.apollo.example.proto.examples.LimbProtoExample;
+import com.lunarclient.apollo.example.proto.examples.ModSettingsProtoExample;
+import com.lunarclient.apollo.example.proto.examples.NametagProtoExample;
+import com.lunarclient.apollo.example.proto.examples.NickHiderProtoExample;
+import com.lunarclient.apollo.example.proto.examples.NotificationProtoExample;
+import com.lunarclient.apollo.example.proto.examples.RichPresenceProtoExample;
+import com.lunarclient.apollo.example.proto.examples.ServerRuleProtoExample;
+import com.lunarclient.apollo.example.proto.examples.StaffModProtoExample;
+import com.lunarclient.apollo.example.proto.examples.StopwatchProtoExample;
+import com.lunarclient.apollo.example.proto.examples.TeamProtoExample;
+import com.lunarclient.apollo.example.proto.examples.TebexProtoExample;
+import com.lunarclient.apollo.example.proto.examples.TitleProtoExample;
+import com.lunarclient.apollo.example.proto.examples.TntCountdownProtoExample;
+import com.lunarclient.apollo.example.proto.examples.TransferProtoExample;
+import com.lunarclient.apollo.example.proto.examples.VignetteProtoExample;
+import com.lunarclient.apollo.example.proto.examples.WaypointProtoExample;
+import com.lunarclient.apollo.example.proto.listeners.ApolloPlayerProtoListener;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
@@ -84,6 +162,12 @@ public class ApolloExamplePlugin extends JavaPlugin {
@Getter
private static ApolloExamplePlugin plugin;
+ public static ApolloExampleType TYPE;
+
+ private ApolloPlayerApiListener playerApiListener;
+ private ApolloPlayerProtoListener playerProtoListener;
+ private ApolloPlayerJsonListener playerJsonListener;
+
private BeamExample beamExample;
private BorderExample borderExample;
private ChatExample chatExample;
@@ -114,9 +198,8 @@ public class ApolloExamplePlugin extends JavaPlugin {
public void onEnable() {
plugin = this;
- this.registerModuleExamples();
+ this.changeImplementationType(ApolloExampleType.API);
this.registerCommands();
- this.registerListeners();
}
@Override
@@ -124,35 +207,9 @@ public void onDisable() {
}
- private void registerModuleExamples() {
- this.beamExample = new BeamExample();
- this.borderExample = new BorderExample();
- this.chatExample = new ChatExample();
- this.coloredFireExample = new ColoredFireExample();
- this.combatExample = new CombatExample();
- this.cooldownExample = new CooldownExample();
- this.entityExample = new EntityExample();
- this.glowExample = new GlowExample();
- this.hologramExample = new HologramExample();
- this.limbExample = new LimbExample();
- this.modSettingsExample = new ModSettingsExample();
- this.nametagExample = new NametagExample();
- this.nickHiderExample = new NickHiderExample();
- this.notificationExample = new NotificationExample();
- this.richPresenceExample = new RichPresenceExample();
- this.serverRuleExample = new ServerRuleExample();
- this.staffModExample = new StaffModExample();
- this.stopwatchExample = new StopwatchExample();
- this.teamExample = new TeamExample();
- this.tebexExample = new TebexExample();
- this.titleExample = new TitleExample();
- this.tntCountdownExample = new TntCountdownExample();
- this.transferExample = new TransferExample();
- this.vignetteExample = new VignetteExample();
- this.waypointExample = new WaypointExample();
- }
-
private void registerCommands() {
+ this.getCommand("switch").setExecutor(new SwitchCommand());
+
this.getCommand("beam").setExecutor(new BeamCommand());
this.getCommand("border").setExecutor(new BorderCommand());
this.getCommand("chat").setExecutor(new ChatCommand());
@@ -180,8 +237,136 @@ private void registerCommands() {
this.getCommand("waypoint").setExecutor(new WaypointCommand());
}
+ public void changeImplementationType(ApolloExampleType type) {
+ TYPE = type;
+
+ if (this.playerApiListener != null) {
+ this.playerApiListener.disable();
+ this.playerApiListener = null;
+ }
+
+ if (this.playerProtoListener != null) {
+ this.playerProtoListener.disable();
+ this.playerProtoListener = null;
+ }
+
+ if (this.playerJsonListener != null) {
+ this.playerJsonListener.disable();
+ this.playerJsonListener = null;
+ }
+
+ this.registerModuleExamples();
+ this.registerListeners();
+ }
+
+ private void registerModuleExamples() {
+ switch (TYPE) {
+ case API: {
+ this.beamExample = new BeamApiExample();
+ this.borderExample = new BorderApiExample();
+ this.chatExample = new ChatApiExample();
+ this.coloredFireExample = new ColoredFireApiExample();
+ this.combatExample = new CombatApiExample();
+ this.cooldownExample = new CooldownApiExample();
+ this.entityExample = new EntityApiExample();
+ this.glowExample = new GlowApiExample();
+ this.hologramExample = new HologramApiExample();
+ this.limbExample = new LimbApiExample();
+ this.modSettingsExample = new ModSettingsApiExample();
+ this.nametagExample = new NametagApiExample();
+ this.nickHiderExample = new NickHiderApiExample();
+ this.notificationExample = new NotificationApiExample();
+ this.richPresenceExample = new RichPresenceApiExample();
+ this.serverRuleExample = new ServerRuleApiExample();
+ this.staffModExample = new StaffModApiExample();
+ this.stopwatchExample = new StopwatchApiExample();
+ this.teamExample = new TeamApiExample();
+ this.tebexExample = new TebexApiExample();
+ this.titleExample = new TitleApiExample();
+ this.tntCountdownExample = new TntCountdownApiExample();
+ this.transferExample = new TransferApiExample();
+ this.vignetteExample = new VignetteApiExample();
+ this.waypointExample = new WaypointApiExample();
+ break;
+ }
+
+ case JSON: {
+ this.beamExample = new BeamJsonExample();
+ this.borderExample = new BorderJsonExample();
+ this.chatExample = new ChatJsonExample();
+ this.coloredFireExample = new ColoredFireJsonExample();
+ this.combatExample = new CombatJsonExample();
+ this.cooldownExample = new CooldownJsonExample();
+ this.entityExample = new EntityJsonExample();
+ this.glowExample = new GlowJsonExample();
+ this.hologramExample = new HologramJsonExample();
+ this.limbExample = new LimbJsonExample();
+ this.modSettingsExample = new ModSettingsJsonExample();
+ this.nametagExample = new NametagJsonExample();
+ this.nickHiderExample = new NickHiderJsonExample();
+ this.notificationExample = new NotificationJsonExample();
+ this.richPresenceExample = new RichPresenceJsonExample();
+ this.serverRuleExample = new ServerRuleJsonExample();
+ this.staffModExample = new StaffModJsonExample();
+ this.stopwatchExample = new StopwatchJsonExample();
+ this.teamExample = new TeamJsonExample();
+ this.tebexExample = new TebexJsonExample();
+ this.titleExample = new TitleJsonExample();
+ this.tntCountdownExample = new TntCountdownJsonExample();
+ this.transferExample = new TransferJsonExample();
+ this.vignetteExample = new VignetteJsonExample();
+ this.waypointExample = new WaypointJsonExample();
+ break;
+ }
+
+ case PROTO: {
+ this.beamExample = new BeamProtoExample();
+ this.borderExample = new BorderProtoExample();
+ this.chatExample = new ChatProtoExample();
+ this.coloredFireExample = new ColoredFireProtoExample();
+ this.combatExample = new CombatProtoExample();
+ this.cooldownExample = new CooldownProtoExample();
+ this.entityExample = new EntityProtoExample();
+ this.glowExample = new GlowProtoExample();
+ this.hologramExample = new HologramProtoExample();
+ this.limbExample = new LimbProtoExample();
+ this.modSettingsExample = new ModSettingsProtoExample();
+ this.nametagExample = new NametagProtoExample();
+ this.nickHiderExample = new NickHiderProtoExample();
+ this.notificationExample = new NotificationProtoExample();
+ this.richPresenceExample = new RichPresenceProtoExample();
+ this.serverRuleExample = new ServerRuleProtoExample();
+ this.staffModExample = new StaffModProtoExample();
+ this.stopwatchExample = new StopwatchProtoExample();
+ this.teamExample = new TeamProtoExample();
+ this.tebexExample = new TebexProtoExample();
+ this.titleExample = new TitleProtoExample();
+ this.tntCountdownExample = new TntCountdownProtoExample();
+ this.transferExample = new TransferProtoExample();
+ this.vignetteExample = new VignetteProtoExample();
+ this.waypointExample = new WaypointProtoExample();
+ break;
+ }
+ }
+ }
+
private void registerListeners() {
- EventBus.getBus().register(new PlayerListener());
+ switch (TYPE) {
+ case API: {
+ this.playerApiListener = new ApolloPlayerApiListener(this);
+ break;
+ }
+
+ case JSON: {
+ this.playerJsonListener = new ApolloPlayerJsonListener(this);
+ break;
+ }
+
+ case PROTO: {
+ this.playerProtoListener = new ApolloPlayerProtoListener(this);
+ break;
+ }
+ }
}
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloGeneralExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/ApolloGeneralExample.java
similarity index 98%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloGeneralExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/ApolloGeneralExample.java
index ec1fa966..1be6f101 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/ApolloGeneralExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/ApolloGeneralExample.java
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example;
+package com.lunarclient.apollo.example.api;
import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.module.border.BorderModule;
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/BeamExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/BeamApiExample.java
similarity index 92%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/BeamExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/BeamApiExample.java
index 0fb01c07..c0abd96a 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/BeamExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/BeamApiExample.java
@@ -21,10 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.location.ApolloBlockLocation;
+import com.lunarclient.apollo.example.common.modules.impl.BeamExample;
import com.lunarclient.apollo.module.beam.Beam;
import com.lunarclient.apollo.module.beam.BeamModule;
import com.lunarclient.apollo.player.ApolloPlayer;
@@ -32,10 +33,11 @@
import java.util.Optional;
import org.bukkit.entity.Player;
-public class BeamExample {
+public class BeamApiExample extends BeamExample {
private final BeamModule beamModule = Apollo.getModuleManager().getModule(BeamModule.class);
+ @Override
public void displayBeamExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -55,11 +57,13 @@ public void displayBeamExample(Player viewer) {
});
}
+ @Override
public void removeBeamExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> this.beamModule.removeBeam(apolloPlayer, "spawn-beacon"));
}
+ @Override
public void resetBeamsExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.beamModule::resetBeams);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/BorderExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/BorderApiExample.java
similarity index 93%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/BorderExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/BorderApiExample.java
index 6ecf854e..1df60349 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/BorderExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/BorderApiExample.java
@@ -21,10 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.cuboid.Cuboid2D;
+import com.lunarclient.apollo.example.common.modules.impl.BorderExample;
import com.lunarclient.apollo.module.border.Border;
import com.lunarclient.apollo.module.border.BorderModule;
import com.lunarclient.apollo.player.ApolloPlayer;
@@ -32,10 +33,11 @@
import java.util.Optional;
import org.bukkit.entity.Player;
-public class BorderExample {
+public class BorderApiExample extends BorderExample {
private final BorderModule borderModule = Apollo.getModuleManager().getModule(BorderModule.class);
+ @Override
public void displayBorderExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -60,11 +62,13 @@ public void displayBorderExample(Player viewer) {
});
}
+ @Override
public void removeBorderExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> this.borderModule.removeBorder(apolloPlayer, "pvp-tagged-spawn"));
}
+ @Override
public void resetBordersExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.borderModule::resetBorders);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ChatExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ChatApiExample.java
similarity index 89%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ChatExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ChatApiExample.java
index 29c71854..25e4a776 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ChatExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ChatApiExample.java
@@ -21,27 +21,27 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.ChatExample;
import com.lunarclient.apollo.module.chat.ChatModule;
import com.lunarclient.apollo.recipients.Recipients;
-import java.util.concurrent.ThreadLocalRandom;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
-public class ChatExample {
+public class ChatApiExample extends ChatExample {
private final ChatModule chatModule = Apollo.getModuleManager().getModule(ChatModule.class);
- private final int messageId = ThreadLocalRandom.current().nextInt(100);
private int countdown = 5;
+ @Override
public void displayLiveChatMessageExample() {
this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(),
Component.text("Game starting in ", NamedTextColor.GREEN)
.append(Component.text(this.countdown, NamedTextColor.BLUE)),
- this.messageId
+ 13
);
if (--this.countdown == 0) {
@@ -49,8 +49,9 @@ public void displayLiveChatMessageExample() {
}
}
+ @Override
public void removeLiveChatMessageExample() {
- this.chatModule.removeLiveChatMessage(Recipients.ofEveryone(), this.messageId);
+ this.chatModule.removeLiveChatMessage(Recipients.ofEveryone(), 13);
}
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ColoredFireExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ColoredFireApiExample.java
similarity index 90%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ColoredFireExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ColoredFireApiExample.java
index 8fe7918c..bfc16dde 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ColoredFireExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ColoredFireApiExample.java
@@ -21,9 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.ColoredFireExample;
import com.lunarclient.apollo.module.coloredfire.ColoredFireModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import com.lunarclient.apollo.recipients.Recipients;
@@ -32,10 +33,11 @@
import java.util.UUID;
import org.bukkit.entity.Player;
-public class ColoredFireExample {
+public class ColoredFireApiExample extends ColoredFireExample {
private final ColoredFireModule coloredFireModule = Apollo.getModuleManager().getModule(ColoredFireModule.class);
+ @Override
public void overrideColoredFireExample(UUID burningPlayer) {
this.coloredFireModule.overrideColoredFire(Recipients.ofEveryone(),
burningPlayer,
@@ -43,10 +45,12 @@ public void overrideColoredFireExample(UUID burningPlayer) {
);
}
+ @Override
public void resetColoredFireExample(UUID burningPlayer) {
this.coloredFireModule.resetColoredFire(Recipients.ofEveryone(), burningPlayer);
}
+ @Override
public void resetColoredFiresExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.coloredFireModule::resetColoredFires);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/CombatExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/CombatApiExample.java
similarity index 88%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/CombatExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/CombatApiExample.java
index 5f811a3a..7d48b4ca 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/CombatExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/CombatApiExample.java
@@ -21,15 +21,17 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.CombatExample;
import com.lunarclient.apollo.module.combat.CombatModule;
-public class CombatExample {
+public class CombatApiExample extends CombatExample {
private final CombatModule combatModule = Apollo.getModuleManager().getModule(CombatModule.class);
+ @Override
public void setDisableMissPenalty(boolean value) {
this.combatModule.getOptions().set(CombatModule.DISABLE_MISS_PENALTY, value);
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/CooldownExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/CooldownApiExample.java
similarity index 93%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/CooldownExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/CooldownApiExample.java
index e01072a3..9c44d982 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/CooldownExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/CooldownApiExample.java
@@ -21,11 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.icon.ItemStackIcon;
import com.lunarclient.apollo.common.icon.SimpleResourceLocationIcon;
+import com.lunarclient.apollo.example.common.modules.impl.CooldownExample;
import com.lunarclient.apollo.module.cooldown.Cooldown;
import com.lunarclient.apollo.module.cooldown.CooldownModule;
import com.lunarclient.apollo.player.ApolloPlayer;
@@ -33,10 +34,11 @@
import java.util.Optional;
import org.bukkit.entity.Player;
-public class CooldownExample {
+public class CooldownApiExample extends CooldownExample {
private final CooldownModule cooldownModule = Apollo.getModuleManager().getModule(CooldownModule.class);
+ @Override
public void displayCooldownItemExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -53,6 +55,7 @@ public void displayCooldownItemExample(Player viewer) {
});
}
+ @Override
public void displayCooldownResourceExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -70,6 +73,7 @@ public void displayCooldownResourceExample(Player viewer) {
});
}
+ @Override
public void removeCooldownExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -79,6 +83,7 @@ public void removeCooldownExample(Player viewer) {
});
}
+ @Override
public void resetCooldownsExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.cooldownModule::resetCooldowns);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/EntityExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/EntityApiExample.java
similarity index 94%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/EntityExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/EntityApiExample.java
index 3d0cece2..4b69d44b 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/EntityExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/EntityApiExample.java
@@ -21,10 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.ApolloEntity;
+import com.lunarclient.apollo.example.common.modules.impl.EntityExample;
import com.lunarclient.apollo.module.entity.EntityModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.List;
@@ -34,10 +35,11 @@
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
-public class EntityExample {
+public class EntityApiExample extends EntityExample {
private final EntityModule entityModule = Apollo.getModuleManager().getModule(EntityModule.class);
+ @Override
public void overrideRainbowSheepExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -51,6 +53,7 @@ public void overrideRainbowSheepExample(Player viewer) {
});
}
+ @Override
public void resetRainbowSheepExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -64,6 +67,7 @@ public void resetRainbowSheepExample(Player viewer) {
});
}
+ @Override
public void flipEntityExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -79,6 +83,7 @@ public void flipEntityExample(Player viewer) {
});
}
+ @Override
public void resetFlippedEntityExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/GlowExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/GlowApiExample.java
similarity index 90%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/GlowExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/GlowApiExample.java
index a3ff090e..a42af2c3 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/GlowExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/GlowApiExample.java
@@ -21,9 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.GlowExample;
import com.lunarclient.apollo.module.glow.GlowModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import com.lunarclient.apollo.recipients.Recipients;
@@ -32,10 +33,11 @@
import java.util.UUID;
import org.bukkit.entity.Player;
-public class GlowExample {
+public class GlowApiExample extends GlowExample {
private final GlowModule glowModule = Apollo.getModuleManager().getModule(GlowModule.class);
+ @Override
public void overrideGlowEffectExample(UUID glowingPlayer) {
this.glowModule.overrideGlow(Recipients.ofEveryone(),
glowingPlayer,
@@ -43,10 +45,12 @@ public void overrideGlowEffectExample(UUID glowingPlayer) {
);
}
+ @Override
public void resetGlowEffectExample(UUID glowingPlayer) {
this.glowModule.resetGlow(Recipients.ofEveryone(), glowingPlayer);
}
+ @Override
public void resetGlowEffectsExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.glowModule::resetGlow);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/HologramExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/HologramApiExample.java
similarity index 93%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/HologramExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/HologramApiExample.java
index e58a15da..fd71257f 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/HologramExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/HologramApiExample.java
@@ -21,11 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.google.common.collect.Lists;
import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.location.ApolloLocation;
+import com.lunarclient.apollo.example.common.modules.impl.HologramExample;
import com.lunarclient.apollo.module.hologram.Hologram;
import com.lunarclient.apollo.module.hologram.HologramModule;
import com.lunarclient.apollo.player.ApolloPlayer;
@@ -36,10 +37,11 @@
import net.kyori.adventure.text.format.TextDecoration;
import org.bukkit.entity.Player;
-public class HologramExample {
+public class HologramApiExample extends HologramExample {
private final HologramModule hologramModule = Apollo.getModuleManager().getModule(HologramModule.class);
+ @Override
public void displayHologramExample() {
this.hologramModule.displayHologram(Recipients.ofEveryone(), Hologram.builder()
.id("welcome-hologram")
@@ -66,10 +68,12 @@ public void displayHologramExample() {
);
}
+ @Override
public void removeHologramExample() {
this.hologramModule.removeHologram(Recipients.ofEveryone(), "welcome-hologram");
}
+ @Override
public void resetHologramsExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.hologramModule::resetHolograms);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/LimbExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/LimbApiExample.java
similarity index 93%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/LimbExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/LimbApiExample.java
index 7f67ba80..a4704fda 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/LimbExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/LimbApiExample.java
@@ -21,9 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.LimbExample;
import com.lunarclient.apollo.module.limb.ArmorPiece;
import com.lunarclient.apollo.module.limb.BodyPart;
import com.lunarclient.apollo.module.limb.LimbModule;
@@ -32,10 +33,11 @@
import java.util.Optional;
import org.bukkit.entity.Player;
-public class LimbExample {
+public class LimbApiExample extends LimbExample {
private final LimbModule limbModule = Apollo.getModuleManager().getModule(LimbModule.class);
+ @Override
public void hideArmorExample(Player viewer, Player target) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -47,6 +49,7 @@ public void hideArmorExample(Player viewer, Player target) {
});
}
+ @Override
public void resetArmorExample(Player viewer, Player target) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -58,6 +61,7 @@ public void resetArmorExample(Player viewer, Player target) {
});
}
+ @Override
public void hideBodyExample(Player viewer, Player target) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -69,6 +73,7 @@ public void hideBodyExample(Player viewer, Player target) {
});
}
+ @Override
public void resetBodyExample(Player viewer, Player target) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ModSettingsExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ModSettingsApiExample.java
similarity index 84%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ModSettingsExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ModSettingsApiExample.java
index 74af2611..9d4fbbdc 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ModSettingsExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ModSettingsApiExample.java
@@ -21,31 +21,35 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.ModSettingsExample;
import com.lunarclient.apollo.mods.impl.ModLighting;
import com.lunarclient.apollo.module.modsetting.ModSettingModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.Optional;
import org.bukkit.entity.Player;
-public class ModSettingsExample {
+public class ModSettingsApiExample extends ModSettingsExample {
private final ModSettingModule modSettingModule = Apollo.getModuleManager().getModule(ModSettingModule.class);
- public void disableLightningModExample(Player viewer) {
+ @Override
+ public void disableLightingModExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModLighting.ENABLED, false));
}
- public void rollbackLightningModEnabledState(Player viewer) {
+ @Override
+ public void rollbackLightingModEnabledState(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
// To rollback the server override value of the setting, simply set the value to "null"
apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModLighting.ENABLED, null));
}
- public void broadcastDisableLightningModExample() {
+ @Override
+ public void broadcastDisableLightingModExample() {
this.modSettingModule.getOptions().set(ModLighting.ENABLED, false);
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/NametagExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/NametagApiExample.java
similarity index 92%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/NametagExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/NametagApiExample.java
index d58940c2..b6bcd544 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/NametagExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/NametagApiExample.java
@@ -21,10 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.google.common.collect.Lists;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.NametagExample;
import com.lunarclient.apollo.module.nametag.Nametag;
import com.lunarclient.apollo.module.nametag.NametagModule;
import com.lunarclient.apollo.player.ApolloPlayer;
@@ -35,10 +36,11 @@
import net.kyori.adventure.text.format.TextDecoration;
import org.bukkit.entity.Player;
-public class NametagExample {
+public class NametagApiExample extends NametagExample {
private final NametagModule nametagModule = Apollo.getModuleManager().getModule(NametagModule.class);
+ @Override
public void overrideNametagExample(Player target) {
this.nametagModule.overrideNametag(Recipients.ofEveryone(), target.getUniqueId(), Nametag.builder()
.lines(Lists.newArrayList(
@@ -56,10 +58,12 @@ public void overrideNametagExample(Player target) {
);
}
+ @Override
public void resetNametagExample(Player target) {
this.nametagModule.resetNametag(Recipients.ofEveryone(), target.getUniqueId());
}
+ @Override
public void resetNametagsExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.nametagModule::resetNametags);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/NickHiderExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/NickHiderApiExample.java
similarity index 90%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/NickHiderExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/NickHiderApiExample.java
index 76d854fe..30341d00 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/NickHiderExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/NickHiderApiExample.java
@@ -21,23 +21,26 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.NickHiderExample;
import com.lunarclient.apollo.module.nickhider.NickHiderModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.Optional;
import org.bukkit.entity.Player;
-public class NickHiderExample {
+public class NickHiderApiExample extends NickHiderExample {
private final NickHiderModule nickHiderModule = Apollo.getModuleManager().getModule(NickHiderModule.class);
+ @Override
public void overrideNickExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> this.nickHiderModule.overrideNick(apolloPlayer, "Notch"));
}
+ @Override
public void resetNickExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.nickHiderModule::resetNick);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/NotificationExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/NotificationApiExample.java
similarity index 67%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/NotificationExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/NotificationApiExample.java
index 56d0f7f8..54ede6f2 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/NotificationExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/NotificationApiExample.java
@@ -21,9 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.NotificationExample;
import com.lunarclient.apollo.module.notification.Notification;
import com.lunarclient.apollo.module.notification.NotificationModule;
import com.lunarclient.apollo.player.ApolloPlayer;
@@ -33,27 +34,30 @@
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.entity.Player;
-public class NotificationExample {
+public class NotificationApiExample extends NotificationExample {
private final NotificationModule notificationModule = Apollo.getModuleManager().getModule(NotificationModule.class);
- private final Notification uhcAnnouncement = Notification.builder()
- .titleComponent(Component.text("UHC Announcement", NamedTextColor.GREEN))
- .descriptionComponent(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))
- )
- .resourceLocation("icons/golden_apple.png") // This field is optional
- .displayTime(Duration.ofSeconds(5))
- .build();
-
+ @Override
public void displayNotificationExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(apolloPlayer -> this.notificationModule.displayNotification(apolloPlayer, this.uhcAnnouncement));
+
+ apolloPlayerOpt.ifPresent(apolloPlayer -> {
+ this.notificationModule.displayNotification(apolloPlayer, Notification.builder()
+ .titleComponent(Component.text("UHC Announcement", NamedTextColor.GREEN))
+ .descriptionComponent(Component.text("UHC starts in 5 minutes...", NamedTextColor.RED)
+ .append(Component.newline())
+ .append(Component.text("Get ready!", NamedTextColor.WHITE))
+ .append(Component.newline())
+ .append(Component.text("Good luck!", NamedTextColor.GOLD))
+ )
+ .resourceLocation("icons/golden_apple.png") // This field is optional
+ .displayTime(Duration.ofSeconds(5))
+ .build());
+ });
}
+ @Override
public void resetNotificationsExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.notificationModule::resetNotifications);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/RichPresenceExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/RichPresenceApiExample.java
similarity index 91%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/RichPresenceExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/RichPresenceApiExample.java
index a4716836..53673969 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/RichPresenceExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/RichPresenceApiExample.java
@@ -21,19 +21,21 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.RichPresenceExample;
import com.lunarclient.apollo.module.richpresence.RichPresenceModule;
import com.lunarclient.apollo.module.richpresence.ServerRichPresence;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.Optional;
import org.bukkit.entity.Player;
-public class RichPresenceExample {
+public class RichPresenceApiExample extends RichPresenceExample {
private final RichPresenceModule richPresenceModule = Apollo.getModuleManager().getModule(RichPresenceModule.class);
+ @Override
public void overrideServerRichPresenceExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -52,6 +54,7 @@ public void overrideServerRichPresenceExample(Player viewer) {
});
}
+ @Override
public void resetServerRichPresenceExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.richPresenceModule::resetServerRichPresence);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ServerRuleExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ServerRuleApiExample.java
similarity index 90%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ServerRuleExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ServerRuleApiExample.java
index c6ed1b66..7f1e7a87 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/ServerRuleExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/ServerRuleApiExample.java
@@ -21,22 +21,25 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.ServerRuleExample;
import com.lunarclient.apollo.module.serverrule.ServerRuleModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.Optional;
import org.bukkit.entity.Player;
-public class ServerRuleExample {
+public class ServerRuleApiExample extends ServerRuleExample {
private final ServerRuleModule serverRuleModule = Apollo.getModuleManager().getModule(ServerRuleModule.class);
+ @Override
public void setAntiPortalTraps(boolean value) {
this.serverRuleModule.getOptions().set(ServerRuleModule.ANTI_PORTAL_TRAPS, value);
}
+ @Override
public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -46,6 +49,7 @@ public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
});
}
+ @Override
public void setNametagRenderDistanceExample(int value) {
this.serverRuleModule.getOptions().set(ServerRuleModule.NAMETAG_RENDER_DISTANCE, value);
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/StaffModExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/StaffModApiExample.java
similarity index 91%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/StaffModExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/StaffModApiExample.java
index 448084f3..67db3782 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/StaffModExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/StaffModApiExample.java
@@ -21,9 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.StaffModExample;
import com.lunarclient.apollo.module.staffmod.StaffMod;
import com.lunarclient.apollo.module.staffmod.StaffModModule;
import com.lunarclient.apollo.player.ApolloPlayer;
@@ -31,10 +32,11 @@
import java.util.Optional;
import org.bukkit.entity.Player;
-public class StaffModExample {
+public class StaffModApiExample extends StaffModExample {
private final StaffModModule staffModModule = Apollo.getModuleManager().getModule(StaffModModule.class);
+ @Override
public void enableStaffModsExample(Player viewer) {
if (!viewer.hasPermission("apollo.staff")) {
return;
@@ -44,6 +46,7 @@ public void enableStaffModsExample(Player viewer) {
apolloPlayerOpt.ifPresent(apolloPlayer -> this.staffModModule.enableStaffMods(apolloPlayer, Collections.singletonList(StaffMod.XRAY)));
}
+ @Override
public void disableStaffModsExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> this.staffModModule.disableStaffMods(apolloPlayer, Collections.singletonList(StaffMod.XRAY)));
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/StopwatchExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/StopwatchApiExample.java
similarity index 90%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/StopwatchExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/StopwatchApiExample.java
index 2668ce1c..1a5bd858 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/StopwatchExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/StopwatchApiExample.java
@@ -21,28 +21,32 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.StopwatchExample;
import com.lunarclient.apollo.module.stopwatch.StopwatchModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.Optional;
import org.bukkit.entity.Player;
-public class StopwatchExample {
+public class StopwatchApiExample extends StopwatchExample {
private final StopwatchModule stopwatchModule = Apollo.getModuleManager().getModule(StopwatchModule.class);
+ @Override
public void startStopwatchExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.stopwatchModule::startStopwatch);
}
+ @Override
public void stopStopwatchExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.stopwatchModule::stopStopwatch);
}
+ @Override
public void resetStopwatchExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.stopwatchModule::resetStopwatch);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TeamExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TeamApiExample.java
similarity index 68%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TeamExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TeamApiExample.java
index 0d3b41c3..943099be 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TeamExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TeamApiExample.java
@@ -21,13 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.location.ApolloLocation;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import com.lunarclient.apollo.example.common.modules.impl.TeamExample;
import com.lunarclient.apollo.module.team.TeamMember;
import com.lunarclient.apollo.module.team.TeamModule;
import java.awt.Color;
@@ -47,14 +48,14 @@
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.scheduler.BukkitRunnable;
-public class TeamExample implements Listener {
+public class TeamApiExample extends TeamExample implements Listener {
private final TeamModule teamModule = Apollo.getModuleManager().getModule(TeamModule.class);
private final Map teamsByTeamId = Maps.newHashMap();
private final Map teamsByPlayerUuid = Maps.newHashMap();
- public TeamExample() {
+ public TeamApiExample() {
new TeamUpdateTask();
Bukkit.getPluginManager().registerEvents(this, ApolloExamplePlugin.getPlugin());
@@ -106,15 +107,15 @@ public Team() {
public void addMember(Player player) {
this.members.add(player);
- TeamExample.this.teamsByPlayerUuid.put(player.getUniqueId(), this);
+ TeamApiExample.this.teamsByPlayerUuid.put(player.getUniqueId(), this);
}
public void removeMember(Player player) {
this.members.remove(player);
- TeamExample.this.teamsByPlayerUuid.remove(player.getUniqueId());
+ TeamApiExample.this.teamsByPlayerUuid.remove(player.getUniqueId());
Apollo.getPlayerManager().getPlayer(player.getUniqueId())
- .ifPresent(TeamExample.this.teamModule::resetTeamMembers);
+ .ifPresent(TeamApiExample.this.teamModule::resetTeamMembers);
}
private TeamMember createTeamMember(Player member) {
@@ -143,7 +144,7 @@ public void refresh() {
.collect(Collectors.toList());
this.members.forEach(member -> Apollo.getPlayerManager().getPlayer(member.getUniqueId())
- .ifPresent(apolloPlayer -> TeamExample.this.teamModule.updateTeamMembers(apolloPlayer, teammates)));
+ .ifPresent(apolloPlayer -> TeamApiExample.this.teamModule.updateTeamMembers(apolloPlayer, teammates)));
}
public UUID getTeamId() {
@@ -183,7 +184,74 @@ public TeamUpdateTask() {
@Override
public void run() {
- TeamExample.this.teamsByTeamId.values().forEach(Team::refresh);
+ TeamApiExample.this.teamsByTeamId.values().forEach(Team::refresh);
}
}
+
+ @Override
+ public void createTeam(Player player) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+
+ if (teamOpt.isPresent()) {
+ player.sendMessage("You already have a team...");
+ return;
+ }
+
+ Team team = this.createTeam();
+ team.addMember(player);
+
+ player.sendMessage("Creating team...");
+ }
+
+ @Override
+ public void deleteTeam(Player player) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+
+ if (teamOpt.isPresent()) {
+ this.deleteTeam(teamOpt.get().getTeamId());
+ player.sendMessage("Deleting team...");
+ return;
+ }
+
+ player.sendMessage("No team found...");
+ }
+
+ @Override
+ public void addMember(Player player, Player target) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+ Optional targetTeamOpt = this.getByPlayerUuid(target.getUniqueId());
+
+ if (targetTeamOpt.isPresent()) {
+ player.sendMessage("Player " + target.getName() + " already has a team...");
+ return;
+ }
+
+ if (teamOpt.isPresent()) {
+ teamOpt.get().addMember(target);
+ player.sendMessage("Added " + target.getName() + " to your team...");
+ return;
+ }
+
+ player.sendMessage("No team found...");
+ }
+
+ @Override
+ public void removeMember(Player player, Player target) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+ Optional targetTeamOpt = this.getByPlayerUuid(target.getUniqueId());
+
+ if (!targetTeamOpt.isPresent()) {
+ player.sendMessage("Player " + target.getName() + " doesn't have a team...");
+ return;
+ }
+
+ if (teamOpt.isPresent()) {
+ teamOpt.get().removeMember(target);
+ player.sendMessage("Removed " + target.getName() + " from your team...");
+ return;
+ }
+
+ player.sendMessage("No team found...");
+ }
+
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TebexExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TebexApiExample.java
similarity index 91%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TebexExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TebexApiExample.java
index eec4e15e..36829578 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TebexExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TebexApiExample.java
@@ -21,19 +21,21 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.TebexExample;
import com.lunarclient.apollo.module.tebex.TebexEmbeddedCheckoutSupport;
import com.lunarclient.apollo.module.tebex.TebexModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.Optional;
import org.bukkit.entity.Player;
-public class TebexExample {
+public class TebexApiExample extends TebexExample {
private final TebexModule tebexModule = Apollo.getModuleManager().getModule(TebexModule.class);
+ @Override
public void displayTebexEmbeddedCheckoutExample(Player viewer, String basketIdent, String locale) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> {
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TitleExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TitleApiExample.java
similarity index 60%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TitleExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TitleApiExample.java
index cc933988..e57bcff7 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TitleExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TitleApiExample.java
@@ -21,9 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.TitleExample;
import com.lunarclient.apollo.module.title.Title;
import com.lunarclient.apollo.module.title.TitleModule;
import com.lunarclient.apollo.module.title.TitleType;
@@ -35,43 +36,47 @@
import net.kyori.adventure.text.format.TextDecoration;
import org.bukkit.entity.Player;
-public class TitleExample {
+public class TitleApiExample extends TitleExample {
private final TitleModule titleModule = Apollo.getModuleManager().getModule(TitleModule.class);
- private final Title helloTitle = Title.builder()
- .type(TitleType.TITLE)
- .message(Component.text()
- .content("Hello, player!")
- .color(NamedTextColor.GREEN)
- .decorate(TextDecoration.BOLD)
- .build())
- .scale(1.0f)
- .displayTime(Duration.ofMillis(1500L))
- .fadeInTime(Duration.ofMillis(250))
- .fadeOutTime(Duration.ofMillis(300))
- .build();
-
- private final Title interpolatedTitle = Title.builder()
- .type(TitleType.TITLE)
- .message(Component.text()
- .content("This title expands!")
- .color(NamedTextColor.GREEN)
- .decorate(TextDecoration.BOLD)
- .build())
- .scale(0.1f)
- .interpolationScale(1.0f)
- .interpolationRate(0.01f)
- .displayTime(Duration.ofMillis(5000L))
- .fadeInTime(Duration.ofMillis(250))
- .fadeOutTime(Duration.ofMillis(300))
- .build();
-
+ @Override
public void displayTitleExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(apolloPlayer -> this.titleModule.displayTitle(apolloPlayer, this.helloTitle));
+ apolloPlayerOpt.ifPresent(apolloPlayer -> this.titleModule.displayTitle(apolloPlayer, Title.builder()
+ .type(TitleType.TITLE)
+ .message(Component.text()
+ .content("Hello, player!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build())
+ .scale(1.0f)
+ .displayTime(Duration.ofMillis(1500L))
+ .fadeInTime(Duration.ofMillis(250))
+ .fadeOutTime(Duration.ofMillis(300))
+ .build()));
+ }
+
+ @Override
+ public void displayTitleInterpolatedExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(apolloPlayer -> this.titleModule.displayTitle(apolloPlayer, Title.builder()
+ .type(TitleType.TITLE)
+ .message(Component.text()
+ .content("This title expands!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build())
+ .scale(0.1f)
+ .interpolationScale(1.0f)
+ .interpolationRate(0.01f)
+ .displayTime(Duration.ofMillis(5000L))
+ .fadeInTime(Duration.ofMillis(250))
+ .fadeOutTime(Duration.ofMillis(300))
+ .build()));
}
+ @Override
public void resetTitlesExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.titleModule::resetTitles);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TntCountdownExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TntCountdownApiExample.java
similarity index 89%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TntCountdownExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TntCountdownApiExample.java
index 3fab40c2..d2f8a609 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TntCountdownExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TntCountdownApiExample.java
@@ -21,10 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.ApolloEntity;
+import com.lunarclient.apollo.example.common.modules.impl.TntCountdownExample;
import com.lunarclient.apollo.module.tntcountdown.TntCountdownModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.Optional;
@@ -34,14 +35,16 @@
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.Listener;
-public class TntCountdownExample implements Listener {
+public class TntCountdownApiExample extends TntCountdownExample implements Listener {
private final TntCountdownModule tntCountdownModule = Apollo.getModuleManager().getModule(TntCountdownModule.class);
+ @Override
public void setTntCountdownExample() {
this.tntCountdownModule.getOptions().set(TntCountdownModule.TNT_TICKS, 160);
}
+ @Override
public void overrideTntCountdownExample(Player viewer) {
Location location = viewer.getLocation();
World world = viewer.getWorld();
@@ -55,8 +58,9 @@ public void overrideTntCountdownExample(Player viewer) {
});
}
+ @Override
public void clearTntCountdownOptionExample() {
- this.tntCountdownModule.getOptions().remove(TntCountdownModule.TNT_TICKS, 160);
+ this.tntCountdownModule.getOptions().remove(TntCountdownModule.TNT_TICKS, 80);
}
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TransferExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TransferApiExample.java
similarity index 95%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TransferExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TransferApiExample.java
index 111fd5fa..252dc74d 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TransferExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/TransferApiExample.java
@@ -21,20 +21,22 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.google.common.collect.Lists;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.TransferExample;
import com.lunarclient.apollo.module.transfer.PingResponse;
import com.lunarclient.apollo.module.transfer.TransferModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.Optional;
import org.bukkit.entity.Player;
-public class TransferExample {
+public class TransferApiExample extends TransferExample {
private final TransferModule transferModule = Apollo.getModuleManager().getModule(TransferModule.class);
+ @Override
public void transferExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -68,6 +70,7 @@ public void transferExample(Player viewer) {
});
}
+ @Override
public void pingExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/VignetteExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/VignetteApiExample.java
similarity index 91%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/VignetteExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/VignetteApiExample.java
index 13c929bf..36c1edef 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/VignetteExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/VignetteApiExample.java
@@ -21,19 +21,21 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
+import com.lunarclient.apollo.example.common.modules.impl.VignetteExample;
import com.lunarclient.apollo.module.vignette.Vignette;
import com.lunarclient.apollo.module.vignette.VignetteModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.Optional;
import org.bukkit.entity.Player;
-public class VignetteExample {
+public class VignetteApiExample extends VignetteExample {
private final VignetteModule vignetteModule = Apollo.getModuleManager().getModule(VignetteModule.class);
+ @Override
public void displayVignetteExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -46,6 +48,7 @@ public void displayVignetteExample(Player viewer) {
});
}
+ @Override
public void resetVignetteExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.vignetteModule::resetVignette);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/WaypointExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/WaypointApiExample.java
similarity index 92%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/WaypointExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/WaypointApiExample.java
index 03b37424..eb5b8e6a 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/WaypointExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/examples/WaypointApiExample.java
@@ -21,10 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.modules;
+package com.lunarclient.apollo.example.api.examples;
import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.location.ApolloBlockLocation;
+import com.lunarclient.apollo.example.common.modules.impl.WaypointExample;
import com.lunarclient.apollo.module.waypoint.Waypoint;
import com.lunarclient.apollo.module.waypoint.WaypointModule;
import com.lunarclient.apollo.player.ApolloPlayer;
@@ -32,10 +33,11 @@
import java.util.Optional;
import org.bukkit.entity.Player;
-public class WaypointExample {
+public class WaypointApiExample extends WaypointExample {
private final WaypointModule waypointModule = Apollo.getModuleManager().getModule(WaypointModule.class);
+ @Override
public void displayWaypointExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -57,11 +59,13 @@ public void displayWaypointExample(Player viewer) {
});
}
+ @Override
public void removeWaypointExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> this.waypointModule.removeWaypoint(apolloPlayer, "KoTH"));
}
+ @Override
public void resetWaypointsExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.waypointModule::resetWaypoints);
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/listeners/GeneralListenerExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/listeners/ApolloGeneralApiListener.java
similarity index 97%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/listeners/GeneralListenerExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/listeners/ApolloGeneralApiListener.java
index 4b129839..afe1c0c1 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/listeners/GeneralListenerExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/listeners/ApolloGeneralApiListener.java
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.listeners;
+package com.lunarclient.apollo.example.api.listeners;
import com.lunarclient.apollo.event.ApolloListener;
import com.lunarclient.apollo.event.Event;
@@ -32,7 +32,7 @@
import com.lunarclient.apollo.player.ApolloPlayer;
import org.bukkit.entity.Player;
-public class GeneralListenerExample {
+public class ApolloGeneralApiListener {
// Method 1
public class GeneralExample1 implements ApolloListener {
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/listeners/PlayerListener.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/listeners/ApolloPlayerApiListener.java
similarity index 76%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/listeners/PlayerListener.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/listeners/ApolloPlayerApiListener.java
index 4ab8e097..47e7bf04 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/listeners/PlayerListener.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/listeners/ApolloPlayerApiListener.java
@@ -21,20 +21,32 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.listeners;
+package com.lunarclient.apollo.example.api.listeners;
import com.lunarclient.apollo.event.ApolloListener;
+import com.lunarclient.apollo.event.EventBus;
import com.lunarclient.apollo.event.Listen;
import com.lunarclient.apollo.event.player.ApolloRegisterPlayerEvent;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.TeamExample;
+import com.lunarclient.apollo.example.api.examples.TeamApiExample;
import com.lunarclient.apollo.player.ApolloPlayer;
import org.bukkit.entity.Player;
-public class PlayerListener implements ApolloListener {
+public class ApolloPlayerApiListener implements ApolloListener {
- private final ApolloExamplePlugin plugin = ApolloExamplePlugin.getPlugin();
- private final TeamExample.Team defaultTeam = this.plugin.getTeamExample().createTeam();
+ private final ApolloExamplePlugin plugin;
+ private final TeamApiExample.Team defaultTeam;
+
+ public ApolloPlayerApiListener(ApolloExamplePlugin plugin) {
+ this.plugin = plugin;
+ this.defaultTeam = ((TeamApiExample) this.plugin.getTeamExample()).createTeam();
+
+ EventBus.getBus().register(this);
+ }
+
+ public void disable() {
+ EventBus.getBus().unregister(this);
+ }
@Listen
private void onApolloRegister(ApolloRegisterPlayerEvent event) {
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/BukkitApolloExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/BukkitApolloExample.java
similarity index 98%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/BukkitApolloExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/BukkitApolloExample.java
index 64024fc3..12abb7b4 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/BukkitApolloExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/BukkitApolloExample.java
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.utilities;
+package com.lunarclient.apollo.example.api.utilities;
import com.google.common.collect.Lists;
import com.lunarclient.apollo.Apollo;
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/ComponentExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/ComponentExample.java
similarity index 97%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/ComponentExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/ComponentExample.java
index 3e3b7f95..f9bfc005 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/ComponentExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/ComponentExample.java
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.utilities;
+package com.lunarclient.apollo.example.api.utilities;
import com.google.common.collect.Lists;
import net.kyori.adventure.text.Component;
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/CuboidExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/CuboidExample.java
similarity index 97%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/CuboidExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/CuboidExample.java
index 1af50583..241a27e6 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/CuboidExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/CuboidExample.java
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.utilities;
+package com.lunarclient.apollo.example.api.utilities;
import com.lunarclient.apollo.common.cuboid.Cuboid2D;
import com.lunarclient.apollo.common.cuboid.Cuboid3D;
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/IconExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/IconExample.java
similarity index 97%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/IconExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/IconExample.java
index 23d90eb8..f7bfe085 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/IconExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/IconExample.java
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.utilities;
+package com.lunarclient.apollo.example.api.utilities;
import com.lunarclient.apollo.common.icon.AdvancedResourceLocationIcon;
import com.lunarclient.apollo.common.icon.ItemStackIcon;
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/LocationExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/LocationExample.java
similarity index 97%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/LocationExample.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/LocationExample.java
index 015f2545..f8d3486d 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/utilities/LocationExample.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/api/utilities/LocationExample.java
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.utilities;
+package com.lunarclient.apollo.example.api.utilities;
import com.lunarclient.apollo.common.location.ApolloBlockLocation;
import com.lunarclient.apollo.common.location.ApolloLocation;
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/SwitchCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/SwitchCommand.java
new file mode 100644
index 00000000..2a960e15
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/SwitchCommand.java
@@ -0,0 +1,76 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.commands;
+
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import com.lunarclient.apollo.example.common.modules.ApolloExampleType;
+import java.util.NoSuchElementException;
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.plugin.Plugin;
+import org.jetbrains.annotations.NotNull;
+
+public class SwitchCommand implements CommandExecutor {
+
+ @Override
+ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
+ if (args.length != 1) {
+ sender.sendMessage("Usage: /switch ");
+ sender.sendMessage("Current implementation: " + ApolloExamplePlugin.TYPE.name());
+ return true;
+ }
+
+ ApolloExampleType type;
+ try {
+ type = ApolloExampleType.valueOf(args[0].toUpperCase());
+ } catch (NoSuchElementException e) {
+ sender.sendMessage("No implementation '" + args[0] + "' found!");
+ return false;
+ }
+
+ if (type == ApolloExamplePlugin.TYPE) {
+ sender.sendMessage("The implementation type is already set to " + ApolloExamplePlugin.TYPE.name());
+ return true;
+ }
+
+ Plugin plugin = Bukkit.getPluginManager().getPlugin("Apollo-Bukkit");
+ if (type == ApolloExampleType.API && plugin == null) {
+ sender.sendMessage("Can't switch implementation to API, the Apollo-Bukkit plugin must be running.");
+ return true;
+ }
+
+ if (type != ApolloExampleType.API && plugin != null) {
+ sender.sendMessage("Can't switch implementation to " + ApolloExamplePlugin.TYPE.name() + ", the Apollo-Bukkit must be deleted.");
+ return true;
+ }
+
+ ApolloExamplePlugin.getPlugin().changeImplementationType(type);
+ sender.sendMessage("Successfully switched example implementation to " + type.name() + "!");
+ sender.sendMessage("Re-join the server to apply the changes!");
+ return true;
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/BeamCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/BeamCommand.java
similarity index 86%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/BeamCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/BeamCommand.java
index 3611c337..d070d7e2 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/BeamCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/BeamCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.BeamExample;
+import com.lunarclient.apollo.example.common.modules.impl.BeamExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class BeamCommand implements CommandExecutor {
- private final BeamExample beamExample = ApolloExamplePlugin.getPlugin().getBeamExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,21 +47,23 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ BeamExample beamExample = ApolloExamplePlugin.getPlugin().getBeamExample();
+
switch (args[0].toLowerCase()) {
case "display": {
- this.beamExample.displayBeamExample(player);
+ beamExample.displayBeamExample(player);
player.sendMessage("Displaying beam....");
break;
}
case "remove": {
- this.beamExample.removeBeamExample(player);
+ beamExample.removeBeamExample(player);
player.sendMessage("Removing beam....");
break;
}
case "reset": {
- this.beamExample.resetBeamsExample(player);
+ beamExample.resetBeamsExample(player);
player.sendMessage("Resetting beams...");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/BorderCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/BorderCommand.java
similarity index 86%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/BorderCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/BorderCommand.java
index 56b2b43b..da532482 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/BorderCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/BorderCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.BorderExample;
+import com.lunarclient.apollo.example.common.modules.impl.BorderExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class BorderCommand implements CommandExecutor {
- private final BorderExample borderExample = ApolloExamplePlugin.getPlugin().getBorderExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,21 +47,23 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ BorderExample borderExample = ApolloExamplePlugin.getPlugin().getBorderExample();
+
switch (args[0].toLowerCase()) {
case "display": {
- this.borderExample.displayBorderExample(player);
+ borderExample.displayBorderExample(player);
player.sendMessage("Displaying border....");
break;
}
case "remove": {
- this.borderExample.removeBorderExample(player);
+ borderExample.removeBorderExample(player);
player.sendMessage("Removing border....");
break;
}
case "reset": {
- this.borderExample.resetBordersExample(player);
+ borderExample.resetBordersExample(player);
player.sendMessage("Resetting borders...");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ChatCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ChatCommand.java
similarity index 87%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ChatCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ChatCommand.java
index b502375f..6c0dff5d 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ChatCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ChatCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.ChatExample;
+import com.lunarclient.apollo.example.common.modules.impl.ChatExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class ChatCommand implements CommandExecutor {
- private final ChatExample chatExample = ApolloExamplePlugin.getPlugin().getChatExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,15 +47,17 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ ChatExample chatExample = ApolloExamplePlugin.getPlugin().getChatExample();
+
switch (args[0].toLowerCase()) {
case "display": {
- this.chatExample.displayLiveChatMessageExample();
+ chatExample.displayLiveChatMessageExample();
player.sendMessage("Displaying live message....");
break;
}
case "remove": {
- this.chatExample.removeLiveChatMessageExample();
+ chatExample.removeLiveChatMessageExample();
player.sendMessage("Removing live message....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ColoredFireCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ColoredFireCommand.java
similarity index 85%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ColoredFireCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ColoredFireCommand.java
index ce0aa8ed..cd61c305 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ColoredFireCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ColoredFireCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.ColoredFireExample;
+import com.lunarclient.apollo.example.common.modules.impl.ColoredFireExample;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -34,8 +34,6 @@
public class ColoredFireCommand implements CommandExecutor {
- private final ColoredFireExample coloredFireExample = ApolloExamplePlugin.getPlugin().getColoredFireExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -44,9 +42,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
}
Player player = (Player) sender;
+ ColoredFireExample coloredFireExample = ApolloExamplePlugin.getPlugin().getColoredFireExample();
if (args.length == 1 && args[0].equalsIgnoreCase("clear")) {
- this.coloredFireExample.resetColoredFiresExample(player);
+ coloredFireExample.resetColoredFiresExample(player);
player.sendMessage("Resetting colored fires...");
return true;
}
@@ -65,13 +64,13 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
switch (args[0].toLowerCase()) {
case "override": {
- this.coloredFireExample.overrideColoredFireExample(target.getUniqueId());
+ coloredFireExample.overrideColoredFireExample(target.getUniqueId());
player.sendMessage("Displaying colored fire....");
break;
}
case "reset": {
- this.coloredFireExample.resetColoredFireExample(target.getUniqueId());
+ coloredFireExample.resetColoredFireExample(target.getUniqueId());
player.sendMessage("Resetting colored fire....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/CombatCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/CombatCommand.java
similarity index 89%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/CombatCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/CombatCommand.java
index a06198f2..b6f9e839 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/CombatCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/CombatCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.CombatExample;
+import com.lunarclient.apollo.example.common.modules.impl.CombatExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class CombatCommand implements CommandExecutor {
- private final CombatExample combatExample = ApolloExamplePlugin.getPlugin().getCombatExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,9 +47,11 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ CombatExample combatExample = ApolloExamplePlugin.getPlugin().getCombatExample();
+
if (args[0].equalsIgnoreCase("disablemisspenalty")) {
boolean value = Boolean.parseBoolean(args[1]);
- this.combatExample.setDisableMissPenalty(value);
+ combatExample.setDisableMissPenalty(value);
player.sendMessage("Disable miss penalty rule has been set to " + value);
} else {
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/CooldownCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/CooldownCommand.java
similarity index 84%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/CooldownCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/CooldownCommand.java
index 003ce99b..36535ee0 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/CooldownCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/CooldownCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.CooldownExample;
+import com.lunarclient.apollo.example.common.modules.impl.CooldownExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class CooldownCommand implements CommandExecutor {
- private final CooldownExample cooldownExample = ApolloExamplePlugin.getPlugin().getCooldownExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,27 +47,29 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ CooldownExample cooldownExample = ApolloExamplePlugin.getPlugin().getCooldownExample();
+
switch (args[0].toLowerCase()) {
case "displayitem": {
- this.cooldownExample.displayCooldownItemExample(player);
+ cooldownExample.displayCooldownItemExample(player);
player.sendMessage("Displaying cooldown item....");
break;
}
case "displayresource": {
- this.cooldownExample.displayCooldownResourceExample(player);
+ cooldownExample.displayCooldownResourceExample(player);
player.sendMessage("Displaying cooldown resource....");
break;
}
case "remove": {
- this.cooldownExample.removeCooldownExample(player);
+ cooldownExample.removeCooldownExample(player);
player.sendMessage("Removing cooldown....");
break;
}
case "reset": {
- this.cooldownExample.resetCooldownsExample(player);
+ cooldownExample.resetCooldownsExample(player);
player.sendMessage("Resetting cooldowns...");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/EntityCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/EntityCommand.java
similarity index 85%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/EntityCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/EntityCommand.java
index f8492bed..64c0db1a 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/EntityCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/EntityCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.EntityExample;
+import com.lunarclient.apollo.example.common.modules.impl.EntityExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class EntityCommand implements CommandExecutor {
- private final EntityExample entityExample = ApolloExamplePlugin.getPlugin().getEntityExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,27 +47,29 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ EntityExample entityExample = ApolloExamplePlugin.getPlugin().getEntityExample();
+
switch (args[0].toLowerCase()) {
case "overridesheep": {
- this.entityExample.overrideRainbowSheepExample(player);
+ entityExample.overrideRainbowSheepExample(player);
player.sendMessage("Overriding rainbow sheep....");
break;
}
case "resetsheep": {
- this.entityExample.resetRainbowSheepExample(player);
+ entityExample.resetRainbowSheepExample(player);
player.sendMessage("Resetting rainbow sheep....");
break;
}
case "flipentities": {
- this.entityExample.flipEntityExample(player);
+ entityExample.flipEntityExample(player);
player.sendMessage("Flipping entities....");
break;
}
case "resetflippedentities": {
- this.entityExample.resetFlippedEntityExample(player);
+ entityExample.resetFlippedEntityExample(player);
player.sendMessage("Resetting flipped entities....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/GlowCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/GlowCommand.java
similarity index 86%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/GlowCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/GlowCommand.java
index c5eb2d79..abff7295 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/GlowCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/GlowCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.GlowExample;
+import com.lunarclient.apollo.example.common.modules.impl.GlowExample;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -34,8 +34,6 @@
public class GlowCommand implements CommandExecutor {
- private final GlowExample glowExample = ApolloExamplePlugin.getPlugin().getGlowExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -44,9 +42,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
}
Player player = (Player) sender;
+ GlowExample glowExample = ApolloExamplePlugin.getPlugin().getGlowExample();
if (args.length == 1 && args[0].equalsIgnoreCase("clear")) {
- this.glowExample.resetGlowEffectsExample(player);
+ glowExample.resetGlowEffectsExample(player);
player.sendMessage("Resetting glow effects...");
return true;
}
@@ -65,13 +64,13 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
switch (args[0].toLowerCase()) {
case "override": {
- this.glowExample.overrideGlowEffectExample(target.getUniqueId());
+ glowExample.overrideGlowEffectExample(target.getUniqueId());
player.sendMessage("Displaying glow effect....");
break;
}
case "reset": {
- this.glowExample.resetGlowEffectExample(target.getUniqueId());
+ glowExample.resetGlowEffectExample(target.getUniqueId());
player.sendMessage("Resetting glow effect....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/HologramCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/HologramCommand.java
similarity index 86%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/HologramCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/HologramCommand.java
index 86967315..62c9dea6 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/HologramCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/HologramCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.HologramExample;
+import com.lunarclient.apollo.example.common.modules.impl.HologramExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class HologramCommand implements CommandExecutor {
- private final HologramExample hologramExample = ApolloExamplePlugin.getPlugin().getHologramExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,21 +47,23 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ HologramExample hologramExample = ApolloExamplePlugin.getPlugin().getHologramExample();
+
switch (args[0].toLowerCase()) {
case "display": {
- this.hologramExample.displayHologramExample();
+ hologramExample.displayHologramExample();
player.sendMessage("Displaying hologram....");
break;
}
case "remove": {
- this.hologramExample.removeHologramExample();
+ hologramExample.removeHologramExample();
player.sendMessage("Removing hologram....");
break;
}
case "reset": {
- this.hologramExample.resetHologramsExample(player);
+ hologramExample.resetHologramsExample(player);
player.sendMessage("Resetting holograms...");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/LimbCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/LimbCommand.java
similarity index 86%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/LimbCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/LimbCommand.java
index 5e90b52f..19df9cd8 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/LimbCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/LimbCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.LimbExample;
+import com.lunarclient.apollo.example.common.modules.impl.LimbExample;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -34,8 +34,6 @@
public class LimbCommand implements CommandExecutor {
- private final LimbExample limbExample = ApolloExamplePlugin.getPlugin().getLimbExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -57,27 +55,29 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ LimbExample limbExample = ApolloExamplePlugin.getPlugin().getLimbExample();
+
switch (args[0].toLowerCase()) {
case "hidearmor": {
- this.limbExample.hideArmorExample(player, target);
+ limbExample.hideArmorExample(player, target);
player.sendMessage("Hiding armor....");
break;
}
case "resetarmor": {
- this.limbExample.resetArmorExample(player, target);
+ limbExample.resetArmorExample(player, target);
player.sendMessage("Resetting armor....");
break;
}
case "hidebody": {
- this.limbExample.hideBodyExample(player, target);
+ limbExample.hideBodyExample(player, target);
player.sendMessage("Hiding body....");
break;
}
case "resetbody": {
- this.limbExample.resetBodyExample(player, target);
+ limbExample.resetBodyExample(player, target);
player.sendMessage("Resetting body....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ModSettingsCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ModSettingsCommand.java
similarity index 77%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ModSettingsCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ModSettingsCommand.java
index f8d44fe2..1346054d 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ModSettingsCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ModSettingsCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.ModSettingsExample;
+import com.lunarclient.apollo.example.common.modules.impl.ModSettingsExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class ModSettingsCommand implements CommandExecutor {
- private final ModSettingsExample modSettingsExample = ApolloExamplePlugin.getPlugin().getModSettingsExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,22 +47,24 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ ModSettingsExample modSettingsExample = ApolloExamplePlugin.getPlugin().getModSettingsExample();
+
switch (args[0].toLowerCase()) {
case "disable": {
- this.modSettingsExample.disableLightningModExample(player);
- player.sendMessage("Disabling lightning mod....");
+ modSettingsExample.disableLightingModExample(player);
+ player.sendMessage("Disabling lighting mod....");
break;
}
case "reset": {
- this.modSettingsExample.rollbackLightningModEnabledState(player);
- player.sendMessage("Rollbacking lightning mod enabled state....");
+ modSettingsExample.rollbackLightingModEnabledState(player);
+ player.sendMessage("Rollbacking lighting mod enabled state....");
break;
}
case "broadcast": {
- this.modSettingsExample.broadcastDisableLightningModExample();
- player.sendMessage("Broadcasting disable lightning mod....");
+ modSettingsExample.broadcastDisableLightingModExample();
+ player.sendMessage("Broadcasting disable lighting mod....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/NametagCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/NametagCommand.java
similarity index 86%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/NametagCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/NametagCommand.java
index d346a36f..a1443cd2 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/NametagCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/NametagCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.NametagExample;
+import com.lunarclient.apollo.example.common.modules.impl.NametagExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class NametagCommand implements CommandExecutor {
- private final NametagExample nametagExample = ApolloExamplePlugin.getPlugin().getNametagExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,21 +47,23 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ NametagExample nametagExample = ApolloExamplePlugin.getPlugin().getNametagExample();
+
switch (args[0].toLowerCase()) {
case "override": {
- this.nametagExample.overrideNametagExample(player);
+ nametagExample.overrideNametagExample(player);
player.sendMessage("Overriding nametag....");
break;
}
case "reset": {
- this.nametagExample.resetNametagExample(player);
+ nametagExample.resetNametagExample(player);
player.sendMessage("Resetting nametag....");
break;
}
case "clear": {
- this.nametagExample.resetNametagsExample(player);
+ nametagExample.resetNametagsExample(player);
player.sendMessage("Clearing nametags...");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/NickHiderCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/NickHiderCommand.java
similarity index 87%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/NickHiderCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/NickHiderCommand.java
index 368e8e8d..5e42f6a8 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/NickHiderCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/NickHiderCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.NickHiderExample;
+import com.lunarclient.apollo.example.common.modules.impl.NickHiderExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class NickHiderCommand implements CommandExecutor {
- private final NickHiderExample nickHiderExample = ApolloExamplePlugin.getPlugin().getNickHiderExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,15 +47,17 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ NickHiderExample nickHiderExample = ApolloExamplePlugin.getPlugin().getNickHiderExample();
+
switch (args[0].toLowerCase()) {
case "override": {
- this.nickHiderExample.overrideNickExample(player);
+ nickHiderExample.overrideNickExample(player);
player.sendMessage("Overriding nick....");
break;
}
case "reset": {
- this.nickHiderExample.resetNickExample(player);
+ nickHiderExample.resetNickExample(player);
player.sendMessage("Resetting nick...");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/NotificationCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/NotificationCommand.java
similarity index 86%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/NotificationCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/NotificationCommand.java
index 289307bd..bb4eb8f4 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/NotificationCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/NotificationCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.NotificationExample;
+import com.lunarclient.apollo.example.common.modules.impl.NotificationExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class NotificationCommand implements CommandExecutor {
- private final NotificationExample notificationExample = ApolloExamplePlugin.getPlugin().getNotificationExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,15 +47,17 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ NotificationExample notificationExample = ApolloExamplePlugin.getPlugin().getNotificationExample();
+
switch (args[0].toLowerCase()) {
case "display": {
- this.notificationExample.displayNotificationExample(player);
+ notificationExample.displayNotificationExample(player);
player.sendMessage("Displaying notification....");
break;
}
case "reset": {
- this.notificationExample.resetNotificationsExample(player);
+ notificationExample.resetNotificationsExample(player);
player.sendMessage("Resetting notifications...");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/RichPresenceCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/RichPresenceCommand.java
similarity index 85%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/RichPresenceCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/RichPresenceCommand.java
index 9f6e49c6..30b547e2 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/RichPresenceCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/RichPresenceCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.RichPresenceExample;
+import com.lunarclient.apollo.example.common.modules.impl.RichPresenceExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class RichPresenceCommand implements CommandExecutor {
- private final RichPresenceExample richPresenceExample = ApolloExamplePlugin.getPlugin().getRichPresenceExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,15 +47,17 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ RichPresenceExample richPresenceExample = ApolloExamplePlugin.getPlugin().getRichPresenceExample();
+
switch (args[0].toLowerCase()) {
case "override": {
- this.richPresenceExample.overrideServerRichPresenceExample(player);
+ richPresenceExample.overrideServerRichPresenceExample(player);
player.sendMessage("Overriding rich presence....");
break;
}
case "reset": {
- this.richPresenceExample.resetServerRichPresenceExample(player);
+ richPresenceExample.resetServerRichPresenceExample(player);
player.sendMessage("Resetting rich presence...");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ServerRuleCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ServerRuleCommand.java
similarity index 87%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ServerRuleCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ServerRuleCommand.java
index a5b67af2..beac095e 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/ServerRuleCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/ServerRuleCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.ServerRuleExample;
+import com.lunarclient.apollo.example.common.modules.impl.ServerRuleExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class ServerRuleCommand implements CommandExecutor {
- private final ServerRuleExample serverRuleExample = ApolloExamplePlugin.getPlugin().getServerRuleExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,10 +47,12 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ ServerRuleExample serverRuleExample = ApolloExamplePlugin.getPlugin().getServerRuleExample();
+
switch (args[0].toLowerCase()) {
case "antiportaltraps": {
boolean value = Boolean.parseBoolean(args[1]);
- this.serverRuleExample.setAntiPortalTraps(value);
+ serverRuleExample.setAntiPortalTraps(value);
player.sendMessage("Anti portal traps rule has been set to " + value);
break;
@@ -60,7 +60,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
case "overridenametagrenderdistance": {
boolean value = Boolean.parseBoolean(args[1]);
- this.serverRuleExample.setOverrideNametagRenderDistance(player, value);
+ serverRuleExample.setOverrideNametagRenderDistance(player, value);
player.sendMessage("Override nametag render distance rule has been set to " + value);
break;
@@ -76,7 +76,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
- this.serverRuleExample.setNametagRenderDistanceExample(value);
+ serverRuleExample.setNametagRenderDistanceExample(value);
player.sendMessage("Nametag render distance has been set to " + value);
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/StaffModCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/StaffModCommand.java
similarity index 86%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/StaffModCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/StaffModCommand.java
index 54b07b46..2ffaf2bc 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/StaffModCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/StaffModCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.StaffModExample;
+import com.lunarclient.apollo.example.common.modules.impl.StaffModExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class StaffModCommand implements CommandExecutor {
- private final StaffModExample staffModExample = ApolloExamplePlugin.getPlugin().getStaffModExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,15 +47,17 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ StaffModExample staffModExample = ApolloExamplePlugin.getPlugin().getStaffModExample();
+
switch (args[0].toLowerCase()) {
case "enable": {
- this.staffModExample.enableStaffModsExample(player);
+ staffModExample.enableStaffModsExample(player);
player.sendMessage("Enabling staff mods....");
break;
}
case "disable": {
- this.staffModExample.disableStaffModsExample(player);
+ staffModExample.disableStaffModsExample(player);
player.sendMessage("Disabling staff mods....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/StopwatchCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/StopwatchCommand.java
similarity index 85%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/StopwatchCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/StopwatchCommand.java
index 17dd34d7..86cb2c50 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/StopwatchCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/StopwatchCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.StopwatchExample;
+import com.lunarclient.apollo.example.common.modules.impl.StopwatchExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class StopwatchCommand implements CommandExecutor {
- private final StopwatchExample stopwatchExample = ApolloExamplePlugin.getPlugin().getStopwatchExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,21 +47,23 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ StopwatchExample stopwatchExample = ApolloExamplePlugin.getPlugin().getStopwatchExample();
+
switch (args[0].toLowerCase()) {
case "start": {
- this.stopwatchExample.startStopwatchExample(player);
+ stopwatchExample.startStopwatchExample(player);
player.sendMessage("Starting stopwatch....");
break;
}
case "stop": {
- this.stopwatchExample.stopStopwatchExample(player);
+ stopwatchExample.stopStopwatchExample(player);
player.sendMessage("Stopping stopwatch....");
break;
}
case "reset": {
- this.stopwatchExample.resetStopwatchExample(player);
+ stopwatchExample.resetStopwatchExample(player);
player.sendMessage("Resetting stopwatch....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TeamCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TeamCommand.java
similarity index 57%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TeamCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TeamCommand.java
index cd1eb101..d62ad942 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TeamCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TeamCommand.java
@@ -21,11 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.TeamExample;
-import java.util.Optional;
+import com.lunarclient.apollo.example.common.modules.impl.TeamExample;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -35,8 +34,6 @@
public class TeamCommand implements CommandExecutor {
- private final TeamExample teamExample = ApolloExamplePlugin.getPlugin().getTeamExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -45,34 +42,17 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
}
Player player = (Player) sender;
+ TeamExample teamExample = ApolloExamplePlugin.getPlugin().getTeamExample();
if (args.length == 1) {
switch (args[0].toLowerCase()) {
case "create": {
- Optional teamOpt = this.teamExample.getByPlayerUuid(player.getUniqueId());
-
- if (teamOpt.isPresent()) {
- player.sendMessage("You already have a team...");
- break;
- }
-
- TeamExample.Team team = this.teamExample.createTeam();
- team.addMember(player);
-
- player.sendMessage("Creating team...");
+ teamExample.createTeam(player);
break;
}
case "delete": {
- Optional teamOpt = this.teamExample.getByPlayerUuid(player.getUniqueId());
-
- if (teamOpt.isPresent()) {
- this.teamExample.deleteTeam(teamOpt.get().getTeamId());
- player.sendMessage("Deleting team...");
- break;
- }
-
- player.sendMessage("No team found...");
+ teamExample.deleteTeam(player);
break;
}
@@ -94,39 +74,14 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
- Optional teamOpt = this.teamExample.getByPlayerUuid(player.getUniqueId());
- Optional targetTeamOpt = this.teamExample.getByPlayerUuid(target.getUniqueId());
-
switch (args[0].toLowerCase()) {
case "addmember": {
- if (targetTeamOpt.isPresent()) {
- player.sendMessage("Player " + target.getName() + " already has a team...");
- break;
- }
-
- if (teamOpt.isPresent()) {
- teamOpt.get().addMember(target);
- player.sendMessage("Added " + target.getName() + " to your team...");
- break;
- }
-
- player.sendMessage("No team found...");
+ teamExample.addMember(player, target);
break;
}
case "removemember": {
- if (!targetTeamOpt.isPresent()) {
- player.sendMessage("Player " + target.getName() + " doesn't have a team...");
- break;
- }
-
- if (teamOpt.isPresent()) {
- teamOpt.get().removeMember(target);
- player.sendMessage("Removed " + target.getName() + " from your team...");
- break;
- }
-
- player.sendMessage("No team found...");
+ teamExample.removeMember(player, target);
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TebexCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TebexCommand.java
similarity index 88%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TebexCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TebexCommand.java
index 99fc5fd2..c26d2d34 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TebexCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TebexCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.TebexExample;
+import com.lunarclient.apollo.example.common.modules.impl.TebexExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class TebexCommand implements CommandExecutor {
- private final TebexExample tebexExample = ApolloExamplePlugin.getPlugin().getTebexExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,11 +47,12 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ TebexExample tebexExample = ApolloExamplePlugin.getPlugin().getTebexExample();
String locale = args.length == 3 ? args[2] : null;
switch (args[0].toLowerCase()) {
case "display": {
- this.tebexExample.displayTebexEmbeddedCheckoutExample(player, args[1], locale);
+ tebexExample.displayTebexEmbeddedCheckoutExample(player, args[1], locale);
player.sendMessage("Displaying checkout....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TitleCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TitleCommand.java
similarity index 75%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TitleCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TitleCommand.java
index 338bc5b4..f8f191df 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TitleCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TitleCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.TitleExample;
+import com.lunarclient.apollo.example.common.modules.impl.TitleExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class TitleCommand implements CommandExecutor {
- private final TitleExample titleExample = ApolloExamplePlugin.getPlugin().getTitleExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -45,25 +43,33 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
Player player = (Player) sender;
if (args.length != 1) {
- player.sendMessage("Usage: /title ");
+ player.sendMessage("Usage: /title ");
return true;
}
+ TitleExample titleExample = ApolloExamplePlugin.getPlugin().getTitleExample();
+
switch (args[0].toLowerCase()) {
case "display": {
- this.titleExample.displayTitleExample(player);
+ titleExample.displayTitleExample(player);
player.sendMessage("Displaying title....");
break;
}
+ case "displayinterpolated": {
+ titleExample.displayTitleInterpolatedExample(player);
+ player.sendMessage("Displaying interpolated title...");
+ break;
+ }
+
case "reset": {
- this.titleExample.resetTitlesExample(player);
+ titleExample.resetTitlesExample(player);
player.sendMessage("Resetting titles....");
break;
}
default: {
- player.sendMessage("Usage: /title ");
+ player.sendMessage("Usage: /title ");
break;
}
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TntCountdownCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TntCountdownCommand.java
similarity index 85%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TntCountdownCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TntCountdownCommand.java
index 78f64908..67871040 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TntCountdownCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TntCountdownCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.TntCountdownExample;
+import com.lunarclient.apollo.example.common.modules.impl.TntCountdownExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class TntCountdownCommand implements CommandExecutor {
- private final TntCountdownExample tntCountdownExample = ApolloExamplePlugin.getPlugin().getTntCountdownExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,21 +47,23 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ TntCountdownExample tntCountdownExample = ApolloExamplePlugin.getPlugin().getTntCountdownExample();
+
switch (args[0].toLowerCase()) {
case "override": {
- this.tntCountdownExample.overrideTntCountdownExample(player);
+ tntCountdownExample.overrideTntCountdownExample(player);
player.sendMessage("Overriding custom tnt countdown option...");
break;
}
case "set": {
- this.tntCountdownExample.setTntCountdownExample();
+ tntCountdownExample.setTntCountdownExample();
player.sendMessage("Setting custom tnt countdown option....");
break;
}
case "clear": {
- this.tntCountdownExample.clearTntCountdownOptionExample();
+ tntCountdownExample.clearTntCountdownOptionExample();
player.sendMessage("Removing custom tnt countdown option....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TransferCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TransferCommand.java
similarity index 87%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TransferCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TransferCommand.java
index d5c08aec..1e316472 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TransferCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/TransferCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.TransferExample;
+import com.lunarclient.apollo.example.common.modules.impl.TransferExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class TransferCommand implements CommandExecutor {
- private final TransferExample transferExample = ApolloExamplePlugin.getPlugin().getTransferExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,15 +47,17 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ TransferExample transferExample = ApolloExamplePlugin.getPlugin().getTransferExample();
+
switch (args[0].toLowerCase()) {
case "transfer": {
- this.transferExample.transferExample(player);
+ transferExample.transferExample(player);
player.sendMessage("Transferring player...");
break;
}
case "ping": {
- this.transferExample.pingExample(player);
+ transferExample.pingExample(player);
player.sendMessage("Pinging....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/VignetteCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/VignetteCommand.java
similarity index 87%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/VignetteCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/VignetteCommand.java
index 61e133f4..b25fe357 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/VignetteCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/VignetteCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.VignetteExample;
+import com.lunarclient.apollo.example.common.modules.impl.VignetteExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class VignetteCommand implements CommandExecutor {
- private final VignetteExample vignetteExample = ApolloExamplePlugin.getPlugin().getVignetteExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,15 +47,17 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ VignetteExample vignetteExample = ApolloExamplePlugin.getPlugin().getVignetteExample();
+
switch (args[0].toLowerCase()) {
case "display": {
- this.vignetteExample.displayVignetteExample(player);
+ vignetteExample.displayVignetteExample(player);
player.sendMessage("Displaying vignette....");
break;
}
case "reset": {
- this.vignetteExample.resetVignetteExample(player);
+ vignetteExample.resetVignetteExample(player);
player.sendMessage("Resetting vignette....");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/WaypointCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/WaypointCommand.java
similarity index 85%
rename from bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/WaypointCommand.java
rename to bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/WaypointCommand.java
index 28bd0b4e..af4942d6 100644
--- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/WaypointCommand.java
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/commands/module/WaypointCommand.java
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.lunarclient.apollo.example.commands;
+package com.lunarclient.apollo.example.common.commands.module;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
-import com.lunarclient.apollo.example.modules.WaypointExample;
+import com.lunarclient.apollo.example.common.modules.impl.WaypointExample;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -33,8 +33,6 @@
public class WaypointCommand implements CommandExecutor {
- private final WaypointExample waypointExample = ApolloExamplePlugin.getPlugin().getWaypointExample();
-
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) {
@@ -49,20 +47,22 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
+ WaypointExample waypointExample = ApolloExamplePlugin.getPlugin().getWaypointExample();
+
switch (args[0].toLowerCase()) {
case "display": {
- this.waypointExample.displayWaypointExample(player);
+ waypointExample.displayWaypointExample(player);
player.sendMessage("Displaying waypoint....");
break;
}
case "remove": {
- this.waypointExample.removeWaypointExample(player);
+ waypointExample.removeWaypointExample(player);
player.sendMessage("Removing waypoint....");
break;
}
case "reset": {
- this.waypointExample.resetWaypointsExample(player);
+ waypointExample.resetWaypointsExample(player);
player.sendMessage("Resetting waypoints...");
break;
}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/ApolloExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/ApolloExample.java
new file mode 100644
index 00000000..f69f6a5a
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/ApolloExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules;
+
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+
+public abstract class ApolloExample {
+
+ protected void sendNotImplemented(Player player) {
+ player.sendMessage(ChatColor.RED + "This command is not available with the " +
+ ApolloExamplePlugin.TYPE.name().toLowerCase() + " implementation!");
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/ApolloExampleType.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/ApolloExampleType.java
new file mode 100644
index 00000000..9eedd2e3
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/ApolloExampleType.java
@@ -0,0 +1,30 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules;
+
+public enum ApolloExampleType {
+
+ API, PROTO, JSON
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/BeamExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/BeamExample.java
new file mode 100644
index 00000000..7dd40427
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/BeamExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class BeamExample extends ApolloExample {
+
+ public abstract void displayBeamExample(Player viewer);
+
+ public abstract void removeBeamExample(Player viewer);
+
+ public abstract void resetBeamsExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/BorderExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/BorderExample.java
new file mode 100644
index 00000000..d24c606c
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/BorderExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class BorderExample extends ApolloExample {
+
+ public abstract void displayBorderExample(Player viewer);
+
+ public abstract void removeBorderExample(Player viewer);
+
+ public abstract void resetBordersExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ChatExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ChatExample.java
new file mode 100644
index 00000000..9108a1d5
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ChatExample.java
@@ -0,0 +1,34 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+
+public abstract class ChatExample extends ApolloExample {
+
+ public abstract void displayLiveChatMessageExample();
+
+ public abstract void removeLiveChatMessageExample();
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ColoredFireExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ColoredFireExample.java
new file mode 100644
index 00000000..88d2a92b
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ColoredFireExample.java
@@ -0,0 +1,38 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import java.util.UUID;
+import org.bukkit.entity.Player;
+
+public abstract class ColoredFireExample extends ApolloExample {
+
+ public abstract void overrideColoredFireExample(UUID burningPlayer);
+
+ public abstract void resetColoredFireExample(UUID burningPlayer);
+
+ public abstract void resetColoredFiresExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/CombatExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/CombatExample.java
new file mode 100644
index 00000000..4d3bfc50
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/CombatExample.java
@@ -0,0 +1,32 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+
+public abstract class CombatExample extends ApolloExample {
+
+ public abstract void setDisableMissPenalty(boolean value);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/CooldownExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/CooldownExample.java
new file mode 100644
index 00000000..b68190ef
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/CooldownExample.java
@@ -0,0 +1,39 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class CooldownExample extends ApolloExample {
+
+ public abstract void displayCooldownItemExample(Player viewer);
+
+ public abstract void displayCooldownResourceExample(Player viewer);
+
+ public abstract void removeCooldownExample(Player viewer);
+
+ public abstract void resetCooldownsExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/EntityExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/EntityExample.java
new file mode 100644
index 00000000..bfd12ce1
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/EntityExample.java
@@ -0,0 +1,39 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class EntityExample extends ApolloExample {
+
+ public abstract void overrideRainbowSheepExample(Player viewer);
+
+ public abstract void resetRainbowSheepExample(Player viewer);
+
+ public abstract void flipEntityExample(Player viewer);
+
+ public abstract void resetFlippedEntityExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/GlowExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/GlowExample.java
new file mode 100644
index 00000000..d94bf83e
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/GlowExample.java
@@ -0,0 +1,38 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import java.util.UUID;
+import org.bukkit.entity.Player;
+
+public abstract class GlowExample extends ApolloExample {
+
+ public abstract void overrideGlowEffectExample(UUID glowingPlayer);
+
+ public abstract void resetGlowEffectExample(UUID glowingPlayer);
+
+ public abstract void resetGlowEffectsExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/HologramExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/HologramExample.java
new file mode 100644
index 00000000..47514208
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/HologramExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class HologramExample extends ApolloExample {
+
+ public abstract void displayHologramExample();
+
+ public abstract void removeHologramExample();
+
+ public abstract void resetHologramsExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/LimbExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/LimbExample.java
new file mode 100644
index 00000000..a7b1af2c
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/LimbExample.java
@@ -0,0 +1,39 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class LimbExample extends ApolloExample {
+
+ public abstract void hideArmorExample(Player viewer, Player target);
+
+ public abstract void resetArmorExample(Player viewer, Player target);
+
+ public abstract void hideBodyExample(Player viewer, Player target);
+
+ public abstract void resetBodyExample(Player viewer, Player target);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ModSettingsExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ModSettingsExample.java
new file mode 100644
index 00000000..e5f39512
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ModSettingsExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class ModSettingsExample extends ApolloExample {
+
+ public abstract void disableLightingModExample(Player viewer);
+
+ public abstract void rollbackLightingModEnabledState(Player viewer);
+
+ public abstract void broadcastDisableLightingModExample();
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NametagExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NametagExample.java
new file mode 100644
index 00000000..a1887109
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NametagExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class NametagExample extends ApolloExample {
+
+ public abstract void overrideNametagExample(Player target);
+
+ public abstract void resetNametagExample(Player target);
+
+ public abstract void resetNametagsExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NickHiderExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NickHiderExample.java
new file mode 100644
index 00000000..1a5dbdb5
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NickHiderExample.java
@@ -0,0 +1,35 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class NickHiderExample extends ApolloExample {
+
+ public abstract void overrideNickExample(Player viewer);
+
+ public abstract void resetNickExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NotificationExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NotificationExample.java
new file mode 100644
index 00000000..3cdb8937
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/NotificationExample.java
@@ -0,0 +1,35 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class NotificationExample extends ApolloExample {
+
+ public abstract void displayNotificationExample(Player viewer);
+
+ public abstract void resetNotificationsExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/RichPresenceExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/RichPresenceExample.java
new file mode 100644
index 00000000..221b2a58
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/RichPresenceExample.java
@@ -0,0 +1,35 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class RichPresenceExample extends ApolloExample {
+
+ public abstract void overrideServerRichPresenceExample(Player viewer);
+
+ public abstract void resetServerRichPresenceExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ServerRuleExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ServerRuleExample.java
new file mode 100644
index 00000000..a7ea8776
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/ServerRuleExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class ServerRuleExample extends ApolloExample {
+
+ public abstract void setAntiPortalTraps(boolean value);
+
+ public abstract void setOverrideNametagRenderDistance(Player viewer, boolean value);
+
+ public abstract void setNametagRenderDistanceExample(int value);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/StaffModExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/StaffModExample.java
new file mode 100644
index 00000000..05c20f55
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/StaffModExample.java
@@ -0,0 +1,35 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class StaffModExample extends ApolloExample {
+
+ public abstract void enableStaffModsExample(Player viewer);
+
+ public abstract void disableStaffModsExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/StopwatchExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/StopwatchExample.java
new file mode 100644
index 00000000..92417caa
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/StopwatchExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class StopwatchExample extends ApolloExample {
+
+ public abstract void startStopwatchExample(Player viewer);
+
+ public abstract void stopStopwatchExample(Player viewer);
+
+ public abstract void resetStopwatchExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TeamExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TeamExample.java
new file mode 100644
index 00000000..3da27f9e
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TeamExample.java
@@ -0,0 +1,39 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class TeamExample extends ApolloExample {
+
+ public abstract void createTeam(Player player);
+
+ public abstract void deleteTeam(Player player);
+
+ public abstract void addMember(Player player, Player target);
+
+ public abstract void removeMember(Player player, Player target);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TebexExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TebexExample.java
new file mode 100644
index 00000000..ba23761e
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TebexExample.java
@@ -0,0 +1,33 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class TebexExample extends ApolloExample {
+
+ public abstract void displayTebexEmbeddedCheckoutExample(Player viewer, String basketIdent, String locale);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TitleExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TitleExample.java
new file mode 100644
index 00000000..063afd4b
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TitleExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class TitleExample extends ApolloExample {
+
+ public abstract void displayTitleExample(Player viewer);
+
+ public abstract void displayTitleInterpolatedExample(Player viewer);
+
+ public abstract void resetTitlesExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TntCountdownExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TntCountdownExample.java
new file mode 100644
index 00000000..46796516
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TntCountdownExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class TntCountdownExample extends ApolloExample {
+
+ public abstract void setTntCountdownExample();
+
+ public abstract void overrideTntCountdownExample(Player viewer);
+
+ public abstract void clearTntCountdownOptionExample();
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TransferExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TransferExample.java
new file mode 100644
index 00000000..5bdf38d1
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/TransferExample.java
@@ -0,0 +1,35 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class TransferExample extends ApolloExample {
+
+ public abstract void transferExample(Player player);
+
+ public abstract void pingExample(Player player);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/VignetteExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/VignetteExample.java
new file mode 100644
index 00000000..fc6b8520
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/VignetteExample.java
@@ -0,0 +1,35 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class VignetteExample extends ApolloExample {
+
+ public abstract void displayVignetteExample(Player viewer);
+
+ public abstract void resetVignetteExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/WaypointExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/WaypointExample.java
new file mode 100644
index 00000000..9859b498
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/common/modules/impl/WaypointExample.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.common.modules.impl;
+
+import com.lunarclient.apollo.example.common.modules.ApolloExample;
+import org.bukkit.entity.Player;
+
+public abstract class WaypointExample extends ApolloExample {
+
+ public abstract void displayWaypointExample(Player viewer);
+
+ public abstract void removeWaypointExample(Player viewer);
+
+ public abstract void resetWaypointsExample(Player viewer);
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/AdventureUtil.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/AdventureUtil.java
new file mode 100644
index 00000000..91e172d2
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/AdventureUtil.java
@@ -0,0 +1,39 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json;
+
+import lombok.NonNull;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
+
+public final class AdventureUtil {
+
+ public static String toJson(@NonNull Component component) {
+ return GsonComponentSerializer.gson().serialize(component);
+ }
+
+ private AdventureUtil() {
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/JsonPacketUtil.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/JsonPacketUtil.java
new file mode 100644
index 00000000..585cf7d8
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/JsonPacketUtil.java
@@ -0,0 +1,134 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json;
+
+import com.google.common.collect.HashBasedTable;
+import com.google.common.collect.Table;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonNull;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+public final class JsonPacketUtil {
+
+ private static final List APOLLO_MODULES = Arrays.asList("limb", "beam", "border", "chat", "colored_fire", "combat", "cooldown",
+ "entity", "glow", "hologram", "mod_setting", "nametag", "nick_hider", "notification", "packet_enrichment", "rich_presence",
+ "server_rule", "staff_mod", "stopwatch", "team", "title", "tnt_countdown", "transfer", "vignette", "waypoint"
+ );
+
+ // Module Id -> Option key -> Object
+ private static final Table CONFIG_MODULE_PROPERTIES = HashBasedTable.create();
+
+ static {
+ // Module Options that the client needs to notified about, these properties are sent with the enable module packet
+ // While using the Apollo plugin this would be equivalent to modifying the config.yml
+ CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "competitive-game", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "competitive-commands", Arrays.asList("/server", "/servers", "/hub"));
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-shaders", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-chunk-reloading", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-broadcasting", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "anti-portal-traps", true);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-brightness", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "brightness", 50);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-nametag-render-distance", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "nametag-render-distance", 64);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-max-chat-length", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "max-chat-length", 256);
+ CONFIG_MODULE_PROPERTIES.put("tnt_countdown", "tnt-ticks", 80);
+ CONFIG_MODULE_PROPERTIES.put("waypoint", "server-handles-waypoints", false);
+ }
+
+ public static void sendPacket(Player player, JsonObject message) {
+ player.sendPluginMessage(ApolloExamplePlugin.getPlugin(), "apollo:json", message.toString().getBytes());
+ }
+
+ public static void broadcastPacket(JsonObject message) {
+ byte[] data = message.toString().getBytes();
+
+ Bukkit.getOnlinePlayers().forEach(player ->
+ player.sendPluginMessage(ApolloExamplePlugin.getPlugin(), "apollo:json", data));
+ }
+
+ public static JsonObject createEnableModuleObject(@NotNull String module, Map properties) {
+ JsonObject enableModuleObject = new JsonObject();
+ enableModuleObject.addProperty("apollo_module", module);
+ enableModuleObject.addProperty("enable", true);
+
+ if (properties != null) {
+ JsonObject propertiesObject = new JsonObject();
+ for (Map.Entry entry : properties.entrySet()) {
+ propertiesObject.add(entry.getKey(), JsonPacketUtil.convertToJsonElement(entry.getValue()));
+ }
+
+ enableModuleObject.add("properties", propertiesObject);
+ }
+
+ return enableModuleObject;
+ }
+
+ private static JsonElement convertToJsonElement(Object value) {
+ if (value == null) {
+ return JsonNull.INSTANCE;
+ } else if (value instanceof String) {
+ return new JsonPrimitive((String) value);
+ } else if (value instanceof Number) {
+ return new JsonPrimitive((Number) value);
+ } else if (value instanceof Boolean) {
+ return new JsonPrimitive((Boolean) value);
+ } else if (value instanceof List) {
+ JsonArray jsonArray = new JsonArray();
+ for (Object item : (List>) value) {
+ jsonArray.add(JsonPacketUtil.convertToJsonElement(item));
+ }
+ return jsonArray;
+ }
+
+ throw new RuntimeException("Unable to wrap value of type '" + value.getClass().getSimpleName() + "'!");
+ }
+
+ public static void enableModules(Player player) {
+ JsonArray settings = APOLLO_MODULES.stream()
+ .map(module -> JsonPacketUtil.createEnableModuleObject(module, CONFIG_MODULE_PROPERTIES.row(module)))
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.configurable.v1.OverrideConfigurableSettingsMessage");
+ message.add("configurable_settings", settings);
+
+ JsonPacketUtil.sendPacket(player, message);
+ }
+
+ private JsonPacketUtil() {
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/JsonUtil.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/JsonUtil.java
new file mode 100644
index 00000000..bc494929
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/JsonUtil.java
@@ -0,0 +1,154 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json;
+
+import com.google.gson.JsonObject;
+import java.awt.Color;
+import java.time.Duration;
+import java.util.Map;
+import java.util.UUID;
+import org.bukkit.Location;
+import org.bukkit.entity.Entity;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public final class JsonUtil {
+
+ public static JsonObject createEnableModuleObjectWithType(@NotNull String module, Map properties) {
+ JsonObject enableModuleObject = JsonPacketUtil.createEnableModuleObject(module, properties);
+ enableModuleObject.addProperty("@type", "type.googleapis.com/lunarclient.apollo.configurable.v1.ConfigurableSettings");
+ return enableModuleObject;
+ }
+
+ public static JsonObject createUuidObject(@NotNull UUID uuid) {
+ JsonObject uuidObject = new JsonObject();
+ uuidObject.addProperty("high64", Long.toUnsignedString(uuid.getMostSignificantBits()));
+ uuidObject.addProperty("low64", Long.toUnsignedString(uuid.getLeastSignificantBits()));
+ return uuidObject;
+ }
+
+ public static JsonObject createColorObject(@NotNull Color color) {
+ JsonObject colorObject = new JsonObject();
+ colorObject.addProperty("color", color.getRGB());
+ return colorObject;
+ }
+
+ public static String createDurationObject(@NotNull Duration duration) {
+ long seconds = duration.getSeconds();
+ int nanos = duration.getNano();
+
+ // Is there a better way to do this?
+ String durationString;
+ if (nanos == 0) {
+ durationString = seconds + "s";
+ } else {
+ durationString = String.format("%d.%09ds", seconds, nanos)
+ .replaceAll("0+$", "")
+ .replaceAll("\\.$", "");
+ }
+
+ return durationString;
+ }
+
+ public static JsonObject createCuboid2DObject(double minX, double minZ, double maxX, double maxZ) {
+ JsonObject cuboid2DObject = new JsonObject();
+ cuboid2DObject.addProperty("min_x", minX);
+ cuboid2DObject.addProperty("min_z", minZ);
+ cuboid2DObject.addProperty("max_x", maxX);
+ cuboid2DObject.addProperty("max_z", maxZ);
+ return cuboid2DObject;
+ }
+
+ public static JsonObject createEntityIdObject(@NotNull Entity entity) {
+ JsonObject entityIdObject = new JsonObject();
+ entityIdObject.addProperty("entity_id", entity.getEntityId());
+ entityIdObject.add("entity_uuid", JsonUtil.createUuidObject(entity.getUniqueId()));
+ return entityIdObject;
+ }
+
+ public static JsonObject createLocationObject(@NotNull Location location) {
+ JsonObject locationObject = new JsonObject();
+ locationObject.addProperty("world", location.getWorld().getName());
+ locationObject.addProperty("x", location.getX());
+ locationObject.addProperty("y", location.getY());
+ locationObject.addProperty("z", location.getZ());
+ return locationObject;
+ }
+
+ public static JsonObject createBlockLocationObject(@NotNull Location location) {
+ JsonObject locationObject = new JsonObject();
+ locationObject.addProperty("world", location.getWorld().getName());
+ locationObject.addProperty("x", location.getBlockX());
+ locationObject.addProperty("y", location.getBlockY());
+ locationObject.addProperty("z", location.getBlockZ());
+ return locationObject;
+ }
+
+ public static JsonObject createItemStackIconObject(@Nullable String itemName, int itemId, int customModelData) {
+ JsonObject itemIconObject = new JsonObject();
+ if (itemName != null) {
+ itemIconObject.addProperty("item_name", itemName);
+ } else {
+ itemIconObject.addProperty("item_id", itemId);
+ }
+
+ itemIconObject.addProperty("custom_model_data", customModelData);
+
+ JsonObject iconObject = new JsonObject();
+ iconObject.add("item_stack", itemIconObject);
+ return iconObject;
+ }
+
+ public static JsonObject createSimpleResourceLocationIconObject(@NotNull String resourceLocation, int size) {
+ JsonObject simpleIconObject = new JsonObject();
+ simpleIconObject.addProperty("resource_location", resourceLocation);
+ simpleIconObject.addProperty("size", size);
+
+ JsonObject iconObject = new JsonObject();
+ iconObject.add("simple_resource_location", simpleIconObject);
+
+ return iconObject;
+ }
+
+ public static JsonObject createAdvancedResourceLocationIconObject(@NotNull String resourceLocation, float width, float height,
+ float minU, float maxU, float minV, float maxV) {
+ JsonObject advancedIcon = new JsonObject();
+ advancedIcon.addProperty("resource_location", resourceLocation);
+ advancedIcon.addProperty("width", width);
+ advancedIcon.addProperty("height", height);
+ advancedIcon.addProperty("min_u", minU);
+ advancedIcon.addProperty("max_u", maxU);
+ advancedIcon.addProperty("min_v", minV);
+ advancedIcon.addProperty("max_v", maxV);
+
+ JsonObject iconObject = new JsonObject();
+ iconObject.add("advanced_resource_location", advancedIcon);
+
+ return iconObject;
+ }
+
+ private JsonUtil() {
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/BeamJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/BeamJsonExample.java
new file mode 100644
index 00000000..2446e73c
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/BeamJsonExample.java
@@ -0,0 +1,67 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.BeamExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.awt.Color;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+public class BeamJsonExample extends BeamExample {
+
+ @Override
+ public void displayBeamExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.beam.v1.DisplayBeaconBeamMessage");
+ message.addProperty("id", "spawn-beacon");
+ message.add("location", JsonUtil.createBlockLocationObject(
+ new Location(Bukkit.getWorld("world"), 0, 60, 0)
+ ));
+ message.add("color", JsonUtil.createColorObject(Color.CYAN));
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void removeBeamExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.beam.v1.RemoveBeaconBeamMessage");
+ message.addProperty("id", "spawn-beacon");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetBeamsExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.beam.v1.ResetBeaconBeamsMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/BorderJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/BorderJsonExample.java
new file mode 100644
index 00000000..317f2856
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/BorderJsonExample.java
@@ -0,0 +1,68 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.BorderExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.awt.Color;
+import org.bukkit.entity.Player;
+
+public class BorderJsonExample extends BorderExample {
+
+ @Override
+ public void displayBorderExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.border.v1.DisplayBorderMessage");
+ message.addProperty("id", "pvp-tagged-spawn");
+ message.addProperty("world", "world");
+ message.addProperty("cancel_entry", true);
+ message.addProperty("cancel_exit", true);
+ message.addProperty("can_shrink_or_expand", false);
+ message.add("color", JsonUtil.createColorObject(Color.RED));
+ message.add("bounds", JsonUtil.createCuboid2DObject(-50, -50, 50, 50));
+ message.addProperty("duration_ticks", 1000);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void removeBorderExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.border.v1.RemoveBorderMessage");
+ message.addProperty("id", "pvp-tagged-spawn");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetBordersExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.border.v1.ResetBordersMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ChatJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ChatJsonExample.java
new file mode 100644
index 00000000..092285e6
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ChatJsonExample.java
@@ -0,0 +1,63 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.ChatExample;
+import com.lunarclient.apollo.example.json.AdventureUtil;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+
+public class ChatJsonExample extends ChatExample {
+
+ private int countdown = 5;
+
+ @Override
+ public void displayLiveChatMessageExample() {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.chat.v1.DisplayLiveChatMessageMessage");
+ message.addProperty("message_id", 13);
+ message.addProperty("adventure_json_lines", AdventureUtil.toJson(
+ Component.text("Game starting in ", NamedTextColor.GREEN)
+ .append(Component.text(this.countdown, NamedTextColor.BLUE))
+ ));
+
+ if (--this.countdown == 0) {
+ this.countdown = 5;
+ }
+
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void removeLiveChatMessageExample() {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.chat.v1.RemoveLiveChatMessageMessage");
+ message.addProperty("message_id", 13);
+
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ColoredFireJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ColoredFireJsonExample.java
new file mode 100644
index 00000000..662335b0
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ColoredFireJsonExample.java
@@ -0,0 +1,63 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.ColoredFireExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.awt.Color;
+import java.util.UUID;
+import org.bukkit.entity.Player;
+
+public class ColoredFireJsonExample extends ColoredFireExample {
+
+ @Override
+ public void overrideColoredFireExample(UUID burningPlayer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.coloredfire.v1.OverrideColoredFireMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(burningPlayer));
+ message.add("color", JsonUtil.createColorObject(Color.BLUE));
+
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetColoredFireExample(UUID burningPlayer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.coloredfire.v1.ResetColoredFireMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(burningPlayer));
+
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetColoredFiresExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.coloredfire.v1.ResetColoredFiresMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/CombatJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/CombatJsonExample.java
new file mode 100644
index 00000000..94e32230
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/CombatJsonExample.java
@@ -0,0 +1,44 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.CombatExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.util.HashMap;
+import java.util.Map;
+
+public class CombatJsonExample extends CombatExample {
+
+ @Override
+ public void setDisableMissPenalty(boolean value) {
+ Map properties = new HashMap<>();
+ properties.put("disable-miss-penalty", value);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("combat", properties);
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/CooldownJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/CooldownJsonExample.java
new file mode 100644
index 00000000..2bf52d19
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/CooldownJsonExample.java
@@ -0,0 +1,74 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.CooldownExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.time.Duration;
+import org.bukkit.entity.Player;
+
+public class CooldownJsonExample extends CooldownExample {
+
+ @Override
+ public void displayCooldownItemExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.cooldown.v1.DisplayCooldownMessage");
+ message.addProperty("name", "enderpearl-cooldown");
+ message.addProperty("duration", JsonUtil.createDurationObject(Duration.ofSeconds(15)));
+ message.add("icon", JsonUtil.createItemStackIconObject("ENDER_PEARL", 0, 0));
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void displayCooldownResourceExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.cooldown.v1.DisplayCooldownMessage");
+ message.addProperty("name", "lunar-cooldown");
+ message.addProperty("duration", JsonUtil.createDurationObject(Duration.ofSeconds(15)));
+ message.add("icon", JsonUtil.createSimpleResourceLocationIconObject("lunar:logo/logo-200x182.svg", 12));
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void removeCooldownExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.cooldown.v1.RemoveCooldownMessage");
+ message.addProperty("name", "enderpearl-cooldown");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetCooldownsExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.cooldown.v1.ResetCooldownsMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/EntityJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/EntityJsonExample.java
new file mode 100644
index 00000000..9094fc3b
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/EntityJsonExample.java
@@ -0,0 +1,93 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.EntityExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import org.bukkit.entity.Cow;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Sheep;
+
+public class EntityJsonExample extends EntityExample {
+
+ @Override
+ public void overrideRainbowSheepExample(Player viewer) {
+ JsonArray entityIds = viewer.getWorld().getEntitiesByClass(Sheep.class).stream()
+ .map(JsonUtil::createEntityIdObject)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.entity.v1.OverrideRainbowSheepMessage");
+ message.add("entity_ids", entityIds);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetRainbowSheepExample(Player viewer) {
+ JsonArray entityIds = viewer.getWorld().getEntitiesByClass(Sheep.class).stream()
+ .map(JsonUtil::createEntityIdObject)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.entity.v1.ResetRainbowSheepMessage");
+ message.add("entity_ids", entityIds);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void flipEntityExample(Player viewer) {
+ JsonArray entityIds = viewer.getWorld()
+ .getNearbyEntities(viewer.getLocation(), 10, 10, 10)
+ .stream().filter(entity -> entity instanceof Cow)
+ .map(JsonUtil::createEntityIdObject)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.entity.v1.FlipEntityMessage");
+ message.add("entity_ids", entityIds);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetFlippedEntityExample(Player viewer) {
+ JsonArray entityIds = viewer.getWorld()
+ .getNearbyEntities(viewer.getLocation(), 10, 10, 10)
+ .stream().filter(entity -> entity instanceof Cow)
+ .map(JsonUtil::createEntityIdObject)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.entity.v1.ResetFlipedEntityMessage");
+ message.add("entity_ids", entityIds);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/GlowJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/GlowJsonExample.java
new file mode 100644
index 00000000..fef33533
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/GlowJsonExample.java
@@ -0,0 +1,63 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.GlowExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.awt.Color;
+import java.util.UUID;
+import org.bukkit.entity.Player;
+
+public class GlowJsonExample extends GlowExample {
+
+ @Override
+ public void overrideGlowEffectExample(UUID glowingPlayer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.glow.v1.OverrideGlowEffectMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(glowingPlayer));
+ message.add("color", JsonUtil.createColorObject(Color.RED));
+
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetGlowEffectExample(UUID glowingPlayer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.glow.v1.ResetGlowEffectMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(glowingPlayer));
+
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetGlowEffectsExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.glow.v1.ResetGlowEffectsMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/HologramJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/HologramJsonExample.java
new file mode 100644
index 00000000..101e498b
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/HologramJsonExample.java
@@ -0,0 +1,88 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.common.collect.Lists;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.lunarclient.apollo.example.common.modules.impl.HologramExample;
+import com.lunarclient.apollo.example.json.AdventureUtil;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextDecoration;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+public class HologramJsonExample extends HologramExample {
+
+ @Override
+ public void displayHologramExample() {
+ JsonArray lines = Lists.newArrayList(
+ 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()
+ ).stream().map(AdventureUtil::toJson).map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.hologram.v1.DisplayHologramMessage");
+ message.addProperty("id", "welcome-hologram");
+ message.add("location", JsonUtil.createLocationObject(
+ new Location(Bukkit.getWorld("world"), 5, 105, 0)
+ ));
+ message.add("adventure_json_lines", lines);
+ message.addProperty("show_through_walls", true);
+ message.addProperty("show_shadow", false);
+ message.addProperty("show_background", true);
+
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void removeHologramExample() {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.hologram.v1.RemoveHologramMessage");
+ message.addProperty("id", "welcome-hologram");
+
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetHologramsExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.hologram.v1.ResetHologramsMessage");
+
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/LimbJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/LimbJsonExample.java
new file mode 100644
index 00000000..9790e81e
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/LimbJsonExample.java
@@ -0,0 +1,97 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.common.collect.Lists;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.lunarclient.apollo.example.common.modules.impl.LimbExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import org.bukkit.entity.Player;
+
+public class LimbJsonExample extends LimbExample {
+
+ @Override
+ public void hideArmorExample(Player viewer, Player target) {
+ // 1 = helmet, 2 = chestplate, 3 = leggings, 4 = boots
+ JsonArray armorPieces = Lists.newArrayList(1, 3)
+ .stream().map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.limb.v1.HideArmorPiecesMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(target.getUniqueId()));
+ message.add("armor_pieces", armorPieces);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetArmorExample(Player viewer, Player target) {
+ // 1 = helmet, 2 = chestplate, 3 = leggings, 4 = boots
+ JsonArray armorPieces = Lists.newArrayList(1, 3)
+ .stream().map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.limb.v1.ResetArmorPiecesMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(target.getUniqueId()));
+ message.add("armor_pieces", armorPieces);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void hideBodyExample(Player viewer, Player target) {
+ // 1 = head, 2 = torso, 3 = left arm, 4 = right arm, 5 = left leg, 6 = right leg
+ JsonArray bodyParts = Lists.newArrayList(1, 4)
+ .stream().map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.limb.v1.HideBodyPartMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(target.getUniqueId()));
+ message.add("body_parts", bodyParts);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetBodyExample(Player viewer, Player target) {
+ // 1 = head, 2 = torso, 3 = left arm, 4 = right arm, 5 = left leg, 6 = right leg
+ JsonArray bodyParts = Lists.newArrayList(1, 4)
+ .stream().map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.limb.v1.ResetBodyPartMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(target.getUniqueId()));
+ message.add("body_parts", bodyParts);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ModSettingsJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ModSettingsJsonExample.java
new file mode 100644
index 00000000..6982ad1e
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ModSettingsJsonExample.java
@@ -0,0 +1,64 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.ModSettingsExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.util.HashMap;
+import java.util.Map;
+import org.bukkit.entity.Player;
+
+public class ModSettingsJsonExample extends ModSettingsExample {
+
+ @Override
+ public void disableLightingModExample(Player viewer) {
+ Map properties = new HashMap<>();
+ properties.put("lighting.enabled", false);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("mod_setting", properties);
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void rollbackLightingModEnabledState(Player viewer) {
+ Map properties = new HashMap<>();
+ // To rollback the server override value of the setting, simply set the value to "null"
+ properties.put("lighting.enabled", null);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("mod_setting", properties);
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void broadcastDisableLightingModExample() {
+ Map properties = new HashMap<>();
+ properties.put("lighting.enabled", false);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("mod_setting", properties);
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NametagJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NametagJsonExample.java
new file mode 100644
index 00000000..74283938
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NametagJsonExample.java
@@ -0,0 +1,82 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.common.collect.Lists;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.lunarclient.apollo.example.common.modules.impl.NametagExample;
+import com.lunarclient.apollo.example.json.AdventureUtil;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextDecoration;
+import org.bukkit.entity.Player;
+
+public class NametagJsonExample extends NametagExample {
+
+ @Override
+ 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).map(JsonPrimitive::new)
+ .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);
+ }
+
+ @Override
+ 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);
+ }
+
+ @Override
+ 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/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NickHiderJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NickHiderJsonExample.java
new file mode 100644
index 00000000..c93cca16
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NickHiderJsonExample.java
@@ -0,0 +1,50 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.NickHiderExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import org.bukkit.entity.Player;
+
+public class NickHiderJsonExample extends NickHiderExample {
+
+ @Override
+ 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);
+ }
+
+ @Override
+ 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/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NotificationJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NotificationJsonExample.java
new file mode 100644
index 00000000..13c860ca
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/NotificationJsonExample.java
@@ -0,0 +1,67 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.NotificationExample;
+import com.lunarclient.apollo.example.json.AdventureUtil;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.time.Duration;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import org.bukkit.entity.Player;
+
+public class NotificationJsonExample extends NotificationExample {
+
+ @Override
+ 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)
+ .append(Component.newline())
+ .append(Component.text("Get ready!", NamedTextColor.WHITE))
+ .append(Component.newline())
+ .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);
+ }
+
+ @Override
+ public void resetNotificationsExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.notification.v1.ResetNotificationsMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/RichPresenceJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/RichPresenceJsonExample.java
new file mode 100644
index 00000000..855f6283
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/RichPresenceJsonExample.java
@@ -0,0 +1,57 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.RichPresenceExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import org.bukkit.entity.Player;
+
+public class RichPresenceJsonExample extends RichPresenceExample {
+
+ @Override
+ public void overrideServerRichPresenceExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.richpresence.v1.OverrideServerRichPresenceMessage");
+ message.addProperty("game_name", "BedWars");
+ message.addProperty("game_variant_name", "Solo");
+ message.addProperty("game_state", "In Game");
+ message.addProperty("player_state", "Playing");
+ message.addProperty("map_name", "Winter");
+ message.addProperty("sub_server", "BW02");
+ message.addProperty("team_current_size", 3);
+ message.addProperty("team_max_size", 4);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetServerRichPresenceExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.richpresence.v1.ResetServerRichPresenceMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ServerRuleJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ServerRuleJsonExample.java
new file mode 100644
index 00000000..ea6ab10d
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/ServerRuleJsonExample.java
@@ -0,0 +1,63 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.ServerRuleExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.util.HashMap;
+import java.util.Map;
+import org.bukkit.entity.Player;
+
+public class ServerRuleJsonExample extends ServerRuleExample {
+
+ @Override
+ public void setAntiPortalTraps(boolean value) {
+ Map properties = new HashMap<>();
+ properties.put("anti-portal-traps", value);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("server_rule", properties);
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
+ Map properties = new HashMap<>();
+ properties.put("override-nametag-render-distance", value);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("server_rule", properties);
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void setNametagRenderDistanceExample(int value) {
+ Map properties = new HashMap<>();
+ properties.put("nametag-render-distance", value);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("server_rule", properties);
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/StaffModJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/StaffModJsonExample.java
new file mode 100644
index 00000000..88c45481
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/StaffModJsonExample.java
@@ -0,0 +1,68 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.lunarclient.apollo.example.common.modules.impl.StaffModExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import java.util.stream.Stream;
+import org.bukkit.entity.Player;
+
+public class StaffModJsonExample extends StaffModExample {
+
+ @Override
+ public void enableStaffModsExample(Player viewer) {
+ if (!viewer.hasPermission("apollo.staff")) {
+ return;
+ }
+
+ // 1 = xray
+ JsonArray staffMods = Stream.of(1)
+ .map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.staffmod.v1.EnableStaffModsMessage");
+ message.add("staff_mods", staffMods);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void disableStaffModsExample(Player viewer) {
+ // 1 = xray
+ JsonArray staffMods = Stream.of(1)
+ .map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.staffmod.v1.DisableStaffModsMessage");
+ message.add("staff_mods", staffMods);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/StopwatchJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/StopwatchJsonExample.java
new file mode 100644
index 00000000..3d64539c
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/StopwatchJsonExample.java
@@ -0,0 +1,57 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.StopwatchExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import org.bukkit.entity.Player;
+
+public class StopwatchJsonExample extends StopwatchExample {
+
+ @Override
+ public void startStopwatchExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.stopwatch.v1.StartStopwatchMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void stopStopwatchExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.stopwatch.v1.StopStopwatchMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetStopwatchExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.stopwatch.v1.ResetStopwatchMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TeamJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TeamJsonExample.java
new file mode 100644
index 00000000..61d933e0
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TeamJsonExample.java
@@ -0,0 +1,255 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import com.lunarclient.apollo.example.common.modules.impl.TeamExample;
+import com.lunarclient.apollo.example.json.AdventureUtil;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.awt.Color;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.UUID;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.scheduler.BukkitRunnable;
+
+public class TeamJsonExample extends TeamExample implements Listener {
+
+ private final Map teamsByTeamId = Maps.newHashMap();
+ private final Map teamsByPlayerUuid = Maps.newHashMap();
+
+ public TeamJsonExample() {
+ new TeamUpdateTask();
+
+ Bukkit.getPluginManager().registerEvents(this, ApolloExamplePlugin.getPlugin());
+ }
+
+ @EventHandler
+ private void onPlayerQuit(PlayerQuitEvent event) {
+ Player player = event.getPlayer();
+
+ this.getByPlayerUuid(player.getUniqueId()).ifPresent(team -> {
+ if (team.getMembers().size() == 1) {
+ this.deleteTeam(team.getTeamId());
+ }
+ });
+ }
+
+ public Optional getByPlayerUuid(UUID playerUuid) {
+ return Optional.ofNullable(this.teamsByPlayerUuid.get(playerUuid));
+ }
+
+ public Optional getByTeamId(UUID teamId) {
+ return Optional.ofNullable(this.teamsByTeamId.get(teamId));
+ }
+
+ public Team createTeam() {
+ Team team = new Team();
+ this.teamsByTeamId.put(team.getTeamId(), team);
+
+ return team;
+ }
+
+ public void deleteTeam(UUID teamId) {
+ Team team = this.teamsByTeamId.remove(teamId);
+
+ if (team != null) {
+ team.getMembers().forEach(team::removeMember);
+ }
+ }
+
+ public class Team {
+
+ private final UUID teamId;
+ private final Set members;
+
+ public Team() {
+ this.teamId = UUID.randomUUID();
+ this.members = Sets.newHashSet();
+ }
+
+ public void addMember(Player player) {
+ this.members.add(player);
+ TeamJsonExample.this.teamsByPlayerUuid.put(player.getUniqueId(), this);
+ }
+
+ public void removeMember(Player player) {
+ this.members.remove(player);
+ TeamJsonExample.this.teamsByPlayerUuid.remove(player.getUniqueId());
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.team.v1.ResetTeamMembersMessage");
+
+ JsonPacketUtil.sendPacket(player, message);
+ }
+
+ private JsonObject createTeamMember(Player member) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.team.v1.TeamMember");
+ message.add("player_uuid", JsonUtil.createUuidObject(member.getUniqueId()));
+ message.addProperty("adventure_json_player_name", AdventureUtil.toJson(
+ Component.text()
+ .content(member.getName())
+ .color(NamedTextColor.WHITE)
+ .build()
+ ));
+ message.add("marker_color", JsonUtil.createColorObject(Color.WHITE));
+ message.add("location", JsonUtil.createLocationObject(member.getLocation()));
+
+ return message;
+ }
+
+ // The refresh method used for updating members locations
+ public void refresh() {
+ JsonArray teammates = this.members.stream().filter(Player::isOnline)
+ .map(this::createTeamMember)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.team.v1.UpdateTeamMembersMessage");
+ message.add("members", teammates);
+
+ this.members.forEach(member -> JsonPacketUtil.sendPacket(member, message));
+ }
+
+ public UUID getTeamId() {
+ return this.teamId;
+ }
+
+ public Set getMembers() {
+ return this.members;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+
+ if (other == null || other.getClass() != this.getClass()) {
+ return false;
+ }
+
+ Team team = (Team) other;
+ return this.teamId.equals(team.getTeamId());
+ }
+
+ @Override
+ public int hashCode() {
+ return this.teamId.hashCode();
+ }
+ }
+
+ // Updates players location every 1 tick (50ms)
+ public class TeamUpdateTask extends BukkitRunnable {
+
+ public TeamUpdateTask() {
+ this.runTaskTimerAsynchronously(ApolloExamplePlugin.getPlugin(), 1L, 1L);
+ }
+
+ @Override
+ public void run() {
+ TeamJsonExample.this.teamsByTeamId.values().forEach(Team::refresh);
+ }
+ }
+
+ @Override
+ public void createTeam(Player player) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+
+ if (teamOpt.isPresent()) {
+ player.sendMessage("You already have a team...");
+ return;
+ }
+
+ Team team = this.createTeam();
+ team.addMember(player);
+
+ player.sendMessage("Creating team...");
+ }
+
+ @Override
+ public void deleteTeam(Player player) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+
+ if (teamOpt.isPresent()) {
+ this.deleteTeam(teamOpt.get().getTeamId());
+ player.sendMessage("Deleting team...");
+ return;
+ }
+
+ player.sendMessage("No team found...");
+ }
+
+ @Override
+ public void addMember(Player player, Player target) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+ Optional targetTeamOpt = this.getByPlayerUuid(target.getUniqueId());
+
+ if (targetTeamOpt.isPresent()) {
+ player.sendMessage("Player " + target.getName() + " already has a team...");
+ return;
+ }
+
+ if (teamOpt.isPresent()) {
+ teamOpt.get().addMember(target);
+ player.sendMessage("Added " + target.getName() + " to your team...");
+ return;
+ }
+
+ player.sendMessage("No team found...");
+ }
+
+ @Override
+ public void removeMember(Player player, Player target) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+ Optional targetTeamOpt = this.getByPlayerUuid(target.getUniqueId());
+
+ if (!targetTeamOpt.isPresent()) {
+ player.sendMessage("Player " + target.getName() + " doesn't have a team...");
+ return;
+ }
+
+ if (teamOpt.isPresent()) {
+ teamOpt.get().removeMember(target);
+ player.sendMessage("Removed " + target.getName() + " from your team...");
+ return;
+ }
+
+ player.sendMessage("No team found...");
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TebexJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TebexJsonExample.java
new file mode 100644
index 00000000..ff740125
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TebexJsonExample.java
@@ -0,0 +1,46 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.TebexExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import org.bukkit.entity.Player;
+
+public class TebexJsonExample extends TebexExample {
+
+ @Override
+ public void displayTebexEmbeddedCheckoutExample(Player viewer, String basketIdent, String locale) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.tebex.v1.OpenTebexEmbeddedCheckoutMessage");
+ message.addProperty("basket_ident", basketIdent);
+
+ if (locale != null) {
+ message.addProperty("locale", locale);
+ }
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TitleJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TitleJsonExample.java
new file mode 100644
index 00000000..184a6a89
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TitleJsonExample.java
@@ -0,0 +1,89 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.TitleExample;
+import com.lunarclient.apollo.example.json.AdventureUtil;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.time.Duration;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextDecoration;
+import org.bukkit.entity.Player;
+
+public class TitleJsonExample extends TitleExample {
+
+ @Override
+ public void displayTitleExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.title.v1.DisplayTitleMessage");
+ message.addProperty("title_type", 1); // 1 = title, 2 = subtitle
+ message.addProperty("adventure_json_message", AdventureUtil.toJson(
+ Component.text()
+ .content("Hello, player!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build()
+ ));
+ message.addProperty("scale", 1.0f);
+ message.addProperty("fade_in_time", JsonUtil.createDurationObject(Duration.ofMillis(1500)));
+ message.addProperty("display_time", JsonUtil.createDurationObject(Duration.ofMillis(250)));
+ message.addProperty("fade_out_time", JsonUtil.createDurationObject(Duration.ofMillis(300)));
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void displayTitleInterpolatedExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.title.v1.DisplayTitleMessage");
+ message.addProperty("title_type", 1); // 1 = title, 2 = subtitle
+ message.addProperty("adventure_json_message", AdventureUtil.toJson(
+ Component.text()
+ .content("This title expands!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build()
+ ));
+ message.addProperty("scale", 0.1f);
+ message.addProperty("interpolation_scale", 1.0f);
+ message.addProperty("interpolation_rate", 0.01f);
+ message.addProperty("fade_in_time", JsonUtil.createDurationObject(Duration.ofMillis(5000)));
+ message.addProperty("display_time", JsonUtil.createDurationObject(Duration.ofMillis(250)));
+ message.addProperty("fade_out_time", JsonUtil.createDurationObject(Duration.ofMillis(300)));
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetTitlesExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.title.v1.ResetTitlesMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TntCountdownJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TntCountdownJsonExample.java
new file mode 100644
index 00000000..6abac834
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TntCountdownJsonExample.java
@@ -0,0 +1,140 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import com.lunarclient.apollo.example.common.modules.impl.TntCountdownExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.TNTPrimed;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntitySpawnEvent;
+
+public class TntCountdownJsonExample extends TntCountdownExample implements Listener {
+
+ private static Method entityGetter;
+
+ static {
+ try {
+ TntCountdownJsonExample.entityGetter = Bukkit.class.getDeclaredMethod("getEntity", UUID.class);
+ } catch (Throwable throwable) {
+ // Ignore for legacy versions.
+ }
+ }
+
+ public TntCountdownJsonExample() {
+ Bukkit.getPluginManager().registerEvents(this, ApolloExamplePlugin.getPlugin());
+ }
+
+ @Override
+ public void setTntCountdownExample() {
+ Map properties = new HashMap<>();
+ properties.put("tnt-ticks", 160);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("tnt_countdown", properties);
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void overrideTntCountdownExample(Player viewer) {
+ Location location = viewer.getLocation();
+ TNTPrimed entity = viewer.getWorld().spawn(location, TNTPrimed.class);
+ int customTicks = 200;
+
+ TNTPrimed target = null;
+ if (TntCountdownJsonExample.entityGetter != null) {
+ try {
+ target = (TNTPrimed) TntCountdownJsonExample.entityGetter.invoke(null, entity.getUniqueId());
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
+ } else {
+ for (World world : Bukkit.getWorlds()) {
+ for (TNTPrimed compare : world.getEntitiesByClass(TNTPrimed.class)) {
+ if (compare.getUniqueId().equals(entity.getUniqueId())) {
+ target = compare;
+ break;
+ }
+ }
+ }
+ }
+
+ if (target != null) {
+ target.setFuseTicks(customTicks);
+ }
+
+ JsonPacketUtil.sendPacket(viewer, this.createTNTCountdownMessage(entity, customTicks));
+ }
+
+ @Override
+ public void clearTntCountdownOptionExample() {
+ Map properties = new HashMap<>();
+ properties.put("tnt-ticks", 80);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("tnt_countdown", properties);
+ JsonPacketUtil.broadcastPacket(message);
+ }
+
+ private JsonObject createTNTCountdownMessage(Entity entity, int ticks) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.tntcountdown.v1.SetTntCountdownMessage");
+ message.add("entity_id", JsonUtil.createEntityIdObject(entity));
+ message.addProperty("duration_ticks", ticks);
+ return message;
+ }
+
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ private void onTntSpawn(EntitySpawnEvent event) {
+ String entityName = event.getEntityType().name();
+ if (!entityName.equals("PRIMED_TNT") && !entityName.equals("TNT")) {
+ return;
+ }
+
+ TNTPrimed primed = (TNTPrimed) event.getEntity();
+ int customTicks = 200;
+ int defaultTicks = 80;
+ int currentTicks = primed.getFuseTicks();
+
+ if (currentTicks != defaultTicks) {
+ customTicks = currentTicks;
+
+ JsonPacketUtil.broadcastPacket(this.createTNTCountdownMessage(primed, customTicks));
+ }
+
+ primed.setFuseTicks(customTicks);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TransferJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TransferJsonExample.java
new file mode 100644
index 00000000..8fdc2719
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/TransferJsonExample.java
@@ -0,0 +1,41 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.TransferExample;
+import org.bukkit.entity.Player;
+
+public class TransferJsonExample extends TransferExample {
+
+ @Override
+ public void transferExample(Player player) {
+ this.sendNotImplemented(player);
+ }
+
+ @Override
+ public void pingExample(Player player) {
+ this.sendNotImplemented(player);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/VignetteJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/VignetteJsonExample.java
new file mode 100644
index 00000000..8a227562
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/VignetteJsonExample.java
@@ -0,0 +1,51 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.VignetteExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import org.bukkit.entity.Player;
+
+public class VignetteJsonExample extends VignetteExample {
+
+ @Override
+ public void displayVignetteExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.vignette.v1.DisplayVignetteMessage");
+ message.addProperty("resource_location", "textures/misc/pumpkinblur.png");
+ message.addProperty("opacity", 0.75f);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetVignetteExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.vignette.v1.ResetVignetteMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/WaypointJsonExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/WaypointJsonExample.java
new file mode 100644
index 00000000..1d206699
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/examples/WaypointJsonExample.java
@@ -0,0 +1,69 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.examples;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.common.modules.impl.WaypointExample;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import com.lunarclient.apollo.example.json.JsonUtil;
+import java.awt.Color;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+public class WaypointJsonExample extends WaypointExample {
+
+ @Override
+ public void displayWaypointExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.waypoint.v1.DisplayWaypointMessage");
+ message.addProperty("name", "KoTH");
+ message.add("location", JsonUtil.createBlockLocationObject(
+ new Location(Bukkit.getWorld("world"), 500, 100, 500)
+ ));
+ message.add("color", JsonUtil.createColorObject(Color.ORANGE));
+ message.addProperty("prevent_removal", false);
+ message.addProperty("hidden", false);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void removeWaypointExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.waypoint.v1.RemoveWaypointMessage");
+ message.addProperty("name", "KoTH");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetWaypointsExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.waypoint.v1.ResetWaypointsMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/listeners/ApolloPlayerJsonListener.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/listeners/ApolloPlayerJsonListener.java
new file mode 100644
index 00000000..1df631db
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/json/listeners/ApolloPlayerJsonListener.java
@@ -0,0 +1,107 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.json.listeners;
+
+import com.google.gson.JsonObject;
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import com.lunarclient.apollo.example.json.JsonPacketUtil;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerChangedWorldEvent;
+import org.bukkit.event.player.PlayerRegisterChannelEvent;
+import org.bukkit.plugin.messaging.Messenger;
+
+public class ApolloPlayerJsonListener implements Listener {
+
+ private final ApolloExamplePlugin plugin;
+
+ private final Set playersRunningApollo = new HashSet<>();
+
+ public ApolloPlayerJsonListener(ApolloExamplePlugin plugin) {
+ this.plugin = plugin;
+
+ Messenger messenger = Bukkit.getServer().getMessenger();
+ messenger.registerIncomingPluginChannel(plugin, "lunar:apollo", (s, player, bytes) -> { });
+ messenger.registerIncomingPluginChannel(plugin, "apollo:json", (s, player, bytes) -> { });
+ messenger.registerOutgoingPluginChannel(plugin, "apollo:json");
+
+ Bukkit.getPluginManager().registerEvents(this, plugin);
+ }
+
+ public void disable() {
+ this.playersRunningApollo.clear();
+
+ Messenger messenger = Bukkit.getServer().getMessenger();
+ messenger.unregisterIncomingPluginChannel(this.plugin, "lunar:apollo");
+ messenger.unregisterIncomingPluginChannel(this.plugin, "apollo:json");
+ messenger.unregisterOutgoingPluginChannel(this.plugin, "apollo:json");
+
+ HandlerList.unregisterAll(this);
+ }
+
+ @EventHandler
+ private void onRegisterChannel(PlayerRegisterChannelEvent event) {
+ if (!event.getChannel().equalsIgnoreCase("lunar:apollo")) {
+ return;
+ }
+
+ this.onApolloRegister(event.getPlayer());
+ }
+
+ @EventHandler
+ private void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
+ Player player = event.getPlayer();
+
+ // Sending the player's world name to the client is required for some modules
+ JsonPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player));
+ }
+
+ private JsonObject createUpdatePlayerWorldMessage(Player player) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.player.v1.UpdatePlayerWorldMessage");
+ message.addProperty("world", player.getWorld().getName());
+ return message;
+ }
+
+ private boolean isPlayerRunningApollo(Player player) {
+ return this.playersRunningApollo.contains(player.getUniqueId());
+ }
+
+ private void onApolloRegister(Player player) {
+ JsonPacketUtil.enableModules(player);
+
+ // Sending the player's world name to the client is required for some modules
+ JsonPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player));
+
+ this.playersRunningApollo.add(player.getUniqueId());
+ player.sendMessage("You are using LunarClient!");
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/AdventureUtil.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/AdventureUtil.java
new file mode 100644
index 00000000..aaab531d
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/AdventureUtil.java
@@ -0,0 +1,39 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto;
+
+import lombok.NonNull;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
+
+public final class AdventureUtil {
+
+ public static String toJson(@NonNull Component component) {
+ return GsonComponentSerializer.gson().serialize(component);
+ }
+
+ private AdventureUtil() {
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/ProtobufPacketUtil.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/ProtobufPacketUtil.java
new file mode 100644
index 00000000..4810dfcb
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/ProtobufPacketUtil.java
@@ -0,0 +1,118 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto;
+
+import com.google.common.collect.HashBasedTable;
+import com.google.common.collect.Table;
+import com.google.protobuf.Any;
+import com.google.protobuf.GeneratedMessageV3;
+import com.google.protobuf.ListValue;
+import com.google.protobuf.Value;
+import com.lunarclient.apollo.configurable.v1.ConfigurableSettings;
+import com.lunarclient.apollo.configurable.v1.OverrideConfigurableSettingsMessage;
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+public final class ProtobufPacketUtil {
+
+ private static final List APOLLO_MODULES = Arrays.asList("limb", "beam", "border", "chat", "colored_fire", "combat", "cooldown",
+ "entity", "glow", "hologram", "mod_setting", "nametag", "nick_hider", "notification", "packet_enrichment", "rich_presence",
+ "server_rule", "staff_mod", "stopwatch", "team", "title", "tnt_countdown", "transfer", "vignette", "waypoint"
+ );
+
+ // Module Id -> Option key -> Value
+ private static final Table CONFIG_MODULE_PROPERTIES = HashBasedTable.create();
+
+ static {
+ // Module Options that the client needs to notified about, these properties are sent with the enable module packet
+ // While using the Apollo plugin this would be equivalent to modifying the config.yml
+ CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "competitive-game", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "competitive-commands", Value.newBuilder().setListValue(
+ ListValue.newBuilder().addAllValues(Arrays.asList(
+ Value.newBuilder().setStringValue("/server").build(),
+ Value.newBuilder().setStringValue("/servers").build(),
+ Value.newBuilder().setStringValue("/hub").build()))
+ .build()
+ ).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-shaders", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-chunk-reloading", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-broadcasting", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "anti-portal-traps", Value.newBuilder().setBoolValue(true).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-brightness", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "brightness", Value.newBuilder().setNumberValue(50).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-nametag-render-distance", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "nametag-render-distance", Value.newBuilder().setNumberValue(64).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-max-chat-length", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "max-chat-length", Value.newBuilder().setNumberValue(256).build());
+ CONFIG_MODULE_PROPERTIES.put("tnt_countdown", "tnt-ticks", Value.newBuilder().setNumberValue(80).build());
+ CONFIG_MODULE_PROPERTIES.put("waypoint", "server-handles-waypoints", Value.newBuilder().setBoolValue(false).build());
+ }
+
+ public static void enableModules(Player player) {
+ List settings = APOLLO_MODULES.stream()
+ .map(module -> createModuleMessage(module, CONFIG_MODULE_PROPERTIES.row(module)))
+ .collect(Collectors.toList());
+
+ OverrideConfigurableSettingsMessage message = OverrideConfigurableSettingsMessage
+ .newBuilder()
+ .addAllConfigurableSettings(settings)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(player, message);
+ }
+
+ public static ConfigurableSettings createModuleMessage(String module, Map properties) {
+ ConfigurableSettings.Builder moduleBuilder = ConfigurableSettings.newBuilder()
+ .setApolloModule(module)
+ .setEnable(true);
+
+ if (properties != null) {
+ moduleBuilder.putAllProperties(properties);
+ }
+
+ return moduleBuilder.build();
+ }
+
+ public static void sendPacket(Player player, GeneratedMessageV3 message) {
+ byte[] bytes = Any.pack(message).toByteArray();
+ player.sendPluginMessage(ApolloExamplePlugin.getPlugin(), "lunar:apollo", bytes);
+ }
+
+ public static void broadcastPacket(GeneratedMessageV3 message) {
+ byte[] bytes = Any.pack(message).toByteArray();
+
+ Bukkit.getOnlinePlayers().forEach(player ->
+ player.sendPluginMessage(ApolloExamplePlugin.getPlugin(), "lunar:apollo", bytes));
+ }
+
+ private ProtobufPacketUtil() {
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/ProtobufUtil.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/ProtobufUtil.java
new file mode 100644
index 00000000..a8ea6dfe
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/ProtobufUtil.java
@@ -0,0 +1,156 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto;
+
+import com.google.protobuf.Timestamp;
+import com.lunarclient.apollo.common.v1.AdvancedResourceLocationIcon;
+import com.lunarclient.apollo.common.v1.BlockLocation;
+import com.lunarclient.apollo.common.v1.Cuboid2D;
+import com.lunarclient.apollo.common.v1.EntityId;
+import com.lunarclient.apollo.common.v1.Icon;
+import com.lunarclient.apollo.common.v1.ItemStackIcon;
+import com.lunarclient.apollo.common.v1.SimpleResourceLocationIcon;
+import com.lunarclient.apollo.common.v1.Uuid;
+import java.awt.Color;
+import java.time.Duration;
+import java.util.UUID;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.jetbrains.annotations.Nullable;
+
+public final class ProtobufUtil {
+
+ public static UUID toJavaUuid(Uuid message) {
+ return new UUID(message.getHigh64(), message.getLow64());
+ }
+
+ public static long toJavaTimestamp(Timestamp message) {
+ return message.getSeconds() * 1000 + message.getNanos() / 1000000;
+ }
+
+ public static Uuid createUuidProto(UUID object) {
+ return Uuid.newBuilder()
+ .setHigh64(object.getMostSignificantBits())
+ .setLow64(object.getLeastSignificantBits())
+ .build();
+ }
+
+ public static com.lunarclient.apollo.common.v1.Color createColorProto(Color object) {
+ return com.lunarclient.apollo.common.v1.Color.newBuilder()
+ .setColor(object.getRGB())
+ .build();
+ }
+
+ public static com.google.protobuf.Duration createDurationProto(Duration object) {
+ return com.google.protobuf.Duration.newBuilder()
+ .setSeconds(object.getSeconds())
+ .setNanos(object.getNano())
+ .build();
+ }
+
+ public static Cuboid2D createCuboid2DProto(double minX, double minZ, double maxX, double maxZ) {
+ return Cuboid2D.newBuilder()
+ .setMinX(minX)
+ .setMinZ(minZ)
+ .setMaxX(maxX)
+ .setMaxZ(maxZ)
+ .build();
+ }
+
+ public static EntityId createEntityIdProto(int id, UUID uuid) {
+ return EntityId.newBuilder()
+ .setEntityId(id)
+ .setEntityUuid(ProtobufUtil.createUuidProto(uuid))
+ .build();
+ }
+
+ public static com.lunarclient.apollo.common.v1.Location createLocationProto(Location location) {
+ return com.lunarclient.apollo.common.v1.Location.newBuilder()
+ .setWorld(location.getWorld().getName())
+ .setX(location.getX())
+ .setY(location.getY())
+ .setZ(location.getZ())
+ .build();
+ }
+
+ public static BlockLocation createBlockLocationProto(Location location) {
+ return BlockLocation.newBuilder()
+ .setWorld(location.getWorld().getName())
+ .setX(location.getBlockX())
+ .setY(location.getBlockY())
+ .setZ(location.getBlockZ())
+ .build();
+ }
+
+ public static Location toBukkitLocation(com.lunarclient.apollo.common.v1.Location message) {
+ return new Location(Bukkit.getWorld(message.getWorld()), message.getX(), message.getY(), message.getZ());
+ }
+
+ public static Location toBukkitLocation(com.lunarclient.apollo.common.v1.PlayerLocation message) {
+ Location location = ProtobufUtil.toBukkitLocation(message.getLocation());
+ location.setYaw(message.getYaw());
+ location.setPitch(message.getPitch());
+ return location;
+ }
+
+ public static Icon createItemStackIconProto(@Nullable String itemName, int itemId, int customModelData) {
+ ItemStackIcon.Builder iconBuilder = ItemStackIcon.newBuilder()
+ .setItemId(itemId)
+ .setCustomModelData(customModelData);
+
+ if (itemName != null) {
+ iconBuilder.setItemName(itemName);
+ }
+
+ return Icon.newBuilder().setItemStack(iconBuilder.build()).build();
+ }
+
+ public static Icon createSimpleResourceLocationIconProto(String resourceLocation, int size) {
+ SimpleResourceLocationIcon icon = SimpleResourceLocationIcon.newBuilder()
+ .setResourceLocation(resourceLocation)
+ .setSize(size)
+ .build();
+
+ return Icon.newBuilder().setSimpleResourceLocation(icon).build();
+ }
+
+ public static Icon createAdvancedResourceLocationIconProto(String resourceLocation, float width, float height,
+ float minU, float maxU, float minV, float maxV) {
+ AdvancedResourceLocationIcon icon = AdvancedResourceLocationIcon.newBuilder()
+ .setResourceLocation(resourceLocation)
+ .setWidth(width)
+ .setHeight(height)
+ .setMinU(minU)
+ .setMaxU(maxU)
+ .setMinV(minV)
+ .setMaxV(maxV)
+ .build();
+
+ return Icon.newBuilder().setAdvancedResourceLocation(icon).build();
+ }
+
+ private ProtobufUtil() {
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/BeamProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/BeamProtoExample.java
new file mode 100644
index 00000000..0eba19f7
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/BeamProtoExample.java
@@ -0,0 +1,64 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.beam.v1.DisplayBeaconBeamMessage;
+import com.lunarclient.apollo.beam.v1.RemoveBeaconBeamMessage;
+import com.lunarclient.apollo.beam.v1.ResetBeaconBeamsMessage;
+import com.lunarclient.apollo.example.common.modules.impl.BeamExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import java.awt.Color;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+public class BeamProtoExample extends BeamExample {
+
+ @Override
+ public void displayBeamExample(Player viewer) {
+ DisplayBeaconBeamMessage message = DisplayBeaconBeamMessage.newBuilder()
+ .setId("spawn-beacon")
+ .setColor(ProtobufUtil.createColorProto(Color.CYAN))
+ .setLocation(ProtobufUtil.createBlockLocationProto(new Location(viewer.getWorld(), 0, 60, 0)))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void removeBeamExample(Player viewer) {
+ RemoveBeaconBeamMessage message = RemoveBeaconBeamMessage.newBuilder()
+ .setId("spawn-beacon")
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetBeamsExample(Player viewer) {
+ ResetBeaconBeamsMessage message = ResetBeaconBeamsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/BorderProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/BorderProtoExample.java
new file mode 100644
index 00000000..03f1d934
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/BorderProtoExample.java
@@ -0,0 +1,68 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.border.v1.DisplayBorderMessage;
+import com.lunarclient.apollo.border.v1.RemoveBorderMessage;
+import com.lunarclient.apollo.border.v1.ResetBordersMessage;
+import com.lunarclient.apollo.example.common.modules.impl.BorderExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import java.awt.Color;
+import org.bukkit.entity.Player;
+
+public class BorderProtoExample extends BorderExample {
+
+ @Override
+ public void displayBorderExample(Player viewer) {
+ DisplayBorderMessage message = DisplayBorderMessage.newBuilder()
+ .setId("pvp-tagged-spawn")
+ .setWorld("world")
+ .setCancelEntry(true)
+ .setCancelExit(true)
+ .setCanShrinkOrExpand(false)
+ .setColor(ProtobufUtil.createColorProto(Color.RED))
+ .setBounds(ProtobufUtil.createCuboid2DProto(-50, -50, 50, 50))
+ .setDurationTicks(1000)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void removeBorderExample(Player viewer) {
+ RemoveBorderMessage message = RemoveBorderMessage.newBuilder()
+ .setId("pvp-tagged-spawn")
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetBordersExample(Player viewer) {
+ ResetBordersMessage message = ResetBordersMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ChatProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ChatProtoExample.java
new file mode 100644
index 00000000..adda6d26
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ChatProtoExample.java
@@ -0,0 +1,64 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.chat.v1.DisplayLiveChatMessageMessage;
+import com.lunarclient.apollo.chat.v1.RemoveLiveChatMessageMessage;
+import com.lunarclient.apollo.example.common.modules.impl.ChatExample;
+import com.lunarclient.apollo.example.proto.AdventureUtil;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+
+public class ChatProtoExample extends ChatExample {
+
+ private int countdown = 5;
+
+ @Override
+ public void displayLiveChatMessageExample() {
+ DisplayLiveChatMessageMessage message = DisplayLiveChatMessageMessage.newBuilder()
+ .setAdventureJsonLines(AdventureUtil.toJson(
+ Component.text("Game starting in ", NamedTextColor.GREEN)
+ .append(Component.text(this.countdown, NamedTextColor.BLUE)))
+ )
+ .setMessageId(13)
+ .build();
+
+ if (--this.countdown == 0) {
+ this.countdown = 5;
+ }
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void removeLiveChatMessageExample() {
+ RemoveLiveChatMessageMessage message = RemoveLiveChatMessageMessage.newBuilder()
+ .setMessageId(13)
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ColoredFireProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ColoredFireProtoExample.java
new file mode 100644
index 00000000..7c201692
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ColoredFireProtoExample.java
@@ -0,0 +1,63 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.coloredfire.v1.OverrideColoredFireMessage;
+import com.lunarclient.apollo.coloredfire.v1.ResetColoredFireMessage;
+import com.lunarclient.apollo.coloredfire.v1.ResetColoredFiresMessage;
+import com.lunarclient.apollo.example.common.modules.impl.ColoredFireExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import java.awt.Color;
+import java.util.UUID;
+import org.bukkit.entity.Player;
+
+public class ColoredFireProtoExample extends ColoredFireExample {
+
+ @Override
+ public void overrideColoredFireExample(UUID burningPlayer) {
+ OverrideColoredFireMessage message = OverrideColoredFireMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(burningPlayer))
+ .setColor(ProtobufUtil.createColorProto(Color.BLUE))
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetColoredFireExample(UUID burningPlayer) {
+ ResetColoredFireMessage message = ResetColoredFireMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(burningPlayer))
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetColoredFiresExample(Player viewer) {
+ ResetColoredFiresMessage message = ResetColoredFiresMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/CombatProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/CombatProtoExample.java
new file mode 100644
index 00000000..69d5b67f
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/CombatProtoExample.java
@@ -0,0 +1,44 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.google.protobuf.Value;
+import com.lunarclient.apollo.configurable.v1.ConfigurableSettings;
+import com.lunarclient.apollo.example.common.modules.impl.CombatExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import java.util.HashMap;
+import java.util.Map;
+
+public class CombatProtoExample extends CombatExample {
+
+ @Override
+ public void setDisableMissPenalty(boolean value) {
+ Map properties = new HashMap<>();
+ properties.put("disable-miss-penalty", Value.newBuilder().setBoolValue(value).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("combat", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/CooldownProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/CooldownProtoExample.java
new file mode 100644
index 00000000..9746ec35
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/CooldownProtoExample.java
@@ -0,0 +1,74 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.cooldown.v1.DisplayCooldownMessage;
+import com.lunarclient.apollo.cooldown.v1.RemoveCooldownMessage;
+import com.lunarclient.apollo.cooldown.v1.ResetCooldownsMessage;
+import com.lunarclient.apollo.example.common.modules.impl.CooldownExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import java.time.Duration;
+import org.bukkit.entity.Player;
+
+public class CooldownProtoExample extends CooldownExample {
+
+ @Override
+ public void displayCooldownItemExample(Player viewer) {
+ DisplayCooldownMessage message = DisplayCooldownMessage.newBuilder()
+ .setName("enderpearl-cooldown")
+ .setDuration(ProtobufUtil.createDurationProto(Duration.ofSeconds(15)))
+ .setIcon(ProtobufUtil.createItemStackIconProto("ENDER_PEARL", 0, 0))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void displayCooldownResourceExample(Player viewer) {
+ DisplayCooldownMessage message = DisplayCooldownMessage.newBuilder()
+ .setName("lunar-cooldown")
+ .setDuration(ProtobufUtil.createDurationProto(Duration.ofSeconds(15)))
+ .setIcon(ProtobufUtil.createSimpleResourceLocationIconProto("lunar:logo/logo-200x182.svg", 12))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void removeCooldownExample(Player viewer) {
+ RemoveCooldownMessage enderpearlMessage = RemoveCooldownMessage.newBuilder()
+ .setName("enderpearl-cooldown")
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, enderpearlMessage);
+ }
+
+ @Override
+ public void resetCooldownsExample(Player viewer) {
+ ResetCooldownsMessage message = ResetCooldownsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/EntityProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/EntityProtoExample.java
new file mode 100644
index 00000000..80c450c9
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/EntityProtoExample.java
@@ -0,0 +1,98 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.common.v1.EntityId;
+import com.lunarclient.apollo.entity.v1.FlipEntityMessage;
+import com.lunarclient.apollo.entity.v1.OverrideRainbowSheepMessage;
+import com.lunarclient.apollo.entity.v1.ResetFlipedEntityMessage;
+import com.lunarclient.apollo.entity.v1.ResetRainbowSheepMessage;
+import com.lunarclient.apollo.example.common.modules.impl.EntityExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.bukkit.entity.Cow;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Sheep;
+
+public class EntityProtoExample extends EntityExample {
+
+ @Override
+ public void overrideRainbowSheepExample(Player viewer) {
+ Set sheepUuidsProto = viewer.getWorld().getEntitiesByClass(Sheep.class).stream()
+ .map(sheep -> ProtobufUtil.createEntityIdProto(sheep.getEntityId(), sheep.getUniqueId()))
+ .collect(Collectors.toSet());
+
+ OverrideRainbowSheepMessage message = OverrideRainbowSheepMessage.newBuilder()
+ .addAllEntityIds(sheepUuidsProto)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetRainbowSheepExample(Player viewer) {
+ Set sheepUuidsProto = viewer.getWorld().getEntitiesByClass(Sheep.class).stream()
+ .map(sheep -> ProtobufUtil.createEntityIdProto(sheep.getEntityId(), sheep.getUniqueId()))
+ .collect(Collectors.toSet());
+
+ ResetRainbowSheepMessage message = ResetRainbowSheepMessage.newBuilder()
+ .addAllEntityIds(sheepUuidsProto)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void flipEntityExample(Player viewer) {
+ Set entityUuidsProto = viewer.getWorld()
+ .getNearbyEntities(viewer.getLocation(), 10, 10, 10)
+ .stream().filter(entity -> entity instanceof Cow)
+ .map(sheep -> ProtobufUtil.createEntityIdProto(sheep.getEntityId(), sheep.getUniqueId()))
+ .collect(Collectors.toSet());
+
+ FlipEntityMessage message = FlipEntityMessage.newBuilder()
+ .addAllEntityIds(entityUuidsProto)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetFlippedEntityExample(Player viewer) {
+ Set entityUuidsProto = viewer.getWorld()
+ .getNearbyEntities(viewer.getLocation(), 10, 10, 10)
+ .stream().filter(entity -> entity instanceof Cow)
+ .map(sheep -> ProtobufUtil.createEntityIdProto(sheep.getEntityId(), sheep.getUniqueId()))
+ .collect(Collectors.toSet());
+
+ ResetFlipedEntityMessage message = ResetFlipedEntityMessage.newBuilder()
+ .addAllEntityIds(entityUuidsProto)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/GlowProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/GlowProtoExample.java
new file mode 100644
index 00000000..94546c5a
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/GlowProtoExample.java
@@ -0,0 +1,63 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.GlowExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import com.lunarclient.apollo.glow.v1.OverrideGlowEffectMessage;
+import com.lunarclient.apollo.glow.v1.ResetGlowEffectMessage;
+import com.lunarclient.apollo.glow.v1.ResetGlowEffectsMessage;
+import java.awt.Color;
+import java.util.UUID;
+import org.bukkit.entity.Player;
+
+public class GlowProtoExample extends GlowExample {
+
+ @Override
+ public void overrideGlowEffectExample(UUID glowingPlayer) {
+ OverrideGlowEffectMessage message = OverrideGlowEffectMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(glowingPlayer))
+ .setColor(ProtobufUtil.createColorProto(Color.RED))
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetGlowEffectExample(UUID glowingPlayer) {
+ ResetGlowEffectMessage message = ResetGlowEffectMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(glowingPlayer))
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetGlowEffectsExample(Player viewer) {
+ ResetGlowEffectsMessage message = ResetGlowEffectsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/HologramProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/HologramProtoExample.java
new file mode 100644
index 00000000..2756b97b
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/HologramProtoExample.java
@@ -0,0 +1,89 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.google.common.collect.Lists;
+import com.lunarclient.apollo.example.common.modules.impl.HologramExample;
+import com.lunarclient.apollo.example.proto.AdventureUtil;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import com.lunarclient.apollo.hologram.v1.DisplayHologramMessage;
+import com.lunarclient.apollo.hologram.v1.RemoveHologramMessage;
+import com.lunarclient.apollo.hologram.v1.ResetHologramsMessage;
+import java.util.List;
+import java.util.stream.Collectors;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextDecoration;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+public class HologramProtoExample extends HologramExample {
+
+ @Override
+ public void displayHologramExample() {
+ List lines = Lists.newArrayList(
+ 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()
+ )
+ .stream().map(AdventureUtil::toJson)
+ .collect(Collectors.toList());
+
+ DisplayHologramMessage message = DisplayHologramMessage.newBuilder()
+ .setId("welcome-hologram")
+ .setLocation(ProtobufUtil.createLocationProto(
+ new Location(Bukkit.getWorld("world"), 5, 105, 0)
+ ))
+ .addAllAdventureJsonLines(lines)
+ .setShowThroughWalls(true)
+ .setShowShadow(false)
+ .setShowBackground(true)
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void removeHologramExample() {
+ RemoveHologramMessage message = RemoveHologramMessage.newBuilder()
+ .setId("welcome-hologram")
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetHologramsExample(Player viewer) {
+ ResetHologramsMessage message = ResetHologramsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/LimbProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/LimbProtoExample.java
new file mode 100644
index 00000000..ee22585d
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/LimbProtoExample.java
@@ -0,0 +1,80 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.LimbExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import com.lunarclient.apollo.limb.v1.ArmorPiece;
+import com.lunarclient.apollo.limb.v1.BodyPart;
+import com.lunarclient.apollo.limb.v1.HideArmorPiecesMessage;
+import com.lunarclient.apollo.limb.v1.HideBodyPartMessage;
+import com.lunarclient.apollo.limb.v1.ResetArmorPiecesMessage;
+import com.lunarclient.apollo.limb.v1.ResetBodyPartMessage;
+import java.util.EnumSet;
+import org.bukkit.entity.Player;
+
+public class LimbProtoExample extends LimbExample {
+
+ @Override
+ public void hideArmorExample(Player viewer, Player target) {
+ HideArmorPiecesMessage message = HideArmorPiecesMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId()))
+ .addAllArmorPieces(EnumSet.of(ArmorPiece.ARMOR_PIECE_HELMET, ArmorPiece.ARMOR_PIECE_LEGGINGS))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetArmorExample(Player viewer, Player target) {
+ ResetArmorPiecesMessage message = ResetArmorPiecesMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId()))
+ .addAllArmorPieces(EnumSet.of(ArmorPiece.ARMOR_PIECE_HELMET, ArmorPiece.ARMOR_PIECE_LEGGINGS))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void hideBodyExample(Player viewer, Player target) {
+ HideBodyPartMessage message = HideBodyPartMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId()))
+ .addAllBodyParts(EnumSet.of(BodyPart.BODY_PART_HEAD, BodyPart.BODY_PART_RIGHT_ARM))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);;
+ }
+
+ @Override
+ public void resetBodyExample(Player viewer, Player target) {
+ ResetBodyPartMessage message = ResetBodyPartMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId()))
+ .addAllBodyParts(EnumSet.of(BodyPart.BODY_PART_HEAD, BodyPart.BODY_PART_RIGHT_ARM))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);;
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ModSettingsProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ModSettingsProtoExample.java
new file mode 100644
index 00000000..e9056e7e
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ModSettingsProtoExample.java
@@ -0,0 +1,65 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.google.protobuf.NullValue;
+import com.google.protobuf.Value;
+import com.lunarclient.apollo.configurable.v1.ConfigurableSettings;
+import com.lunarclient.apollo.example.common.modules.impl.ModSettingsExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import java.util.HashMap;
+import java.util.Map;
+import org.bukkit.entity.Player;
+
+public class ModSettingsProtoExample extends ModSettingsExample {
+
+ @Override
+ public void disableLightingModExample(Player viewer) {
+ Map properties = new HashMap<>();
+ properties.put("lighting.enabled", Value.newBuilder().setBoolValue(false).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("mod_setting", properties);
+ ProtobufPacketUtil.sendPacket(viewer, settings);
+ }
+
+ @Override
+ public void rollbackLightingModEnabledState(Player viewer) {
+ Map properties = new HashMap<>();
+ // To rollback the server override value of the setting, simply set the value to "null"
+ properties.put("lighting.enabled", Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("mod_setting", properties);
+ ProtobufPacketUtil.sendPacket(viewer, settings);
+ }
+
+ @Override
+ public void broadcastDisableLightingModExample() {
+ Map properties = new HashMap<>();
+ properties.put("lighting.enabled", Value.newBuilder().setBoolValue(false).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("mod_setting", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NametagProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NametagProtoExample.java
new file mode 100644
index 00000000..8bafd5f8
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NametagProtoExample.java
@@ -0,0 +1,82 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.google.common.collect.Lists;
+import com.lunarclient.apollo.example.common.modules.impl.NametagExample;
+import com.lunarclient.apollo.example.proto.AdventureUtil;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import com.lunarclient.apollo.nametag.v1.OverrideNametagMessage;
+import com.lunarclient.apollo.nametag.v1.ResetNametagMessage;
+import com.lunarclient.apollo.nametag.v1.ResetNametagsMessage;
+import java.util.List;
+import java.util.stream.Collectors;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextDecoration;
+import org.bukkit.entity.Player;
+
+public class NametagProtoExample extends NametagExample {
+
+ @Override
+ 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);
+ }
+
+ @Override
+ public void resetNametagExample(Player target) {
+ ResetNametagMessage message = ResetNametagMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId()))
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+ @Override
+ public void resetNametagsExample(Player viewer) {
+ ResetNametagsMessage message = ResetNametagsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NickHiderProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NickHiderProtoExample.java
new file mode 100644
index 00000000..9fb7dc47
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NickHiderProtoExample.java
@@ -0,0 +1,49 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.NickHiderExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.nickhider.v1.OverrideNickHiderMessage;
+import com.lunarclient.apollo.nickhider.v1.ResetNickHiderMessage;
+import org.bukkit.entity.Player;
+
+public class NickHiderProtoExample extends NickHiderExample {
+
+ @Override
+ public void overrideNickExample(Player viewer) {
+ OverrideNickHiderMessage message = OverrideNickHiderMessage.newBuilder()
+ .setNick("Notch")
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetNickExample(Player viewer) {
+ ResetNickHiderMessage message = ResetNickHiderMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NotificationProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NotificationProtoExample.java
new file mode 100644
index 00000000..6ee666da
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/NotificationProtoExample.java
@@ -0,0 +1,66 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.NotificationExample;
+import com.lunarclient.apollo.example.proto.AdventureUtil;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import com.lunarclient.apollo.notification.v1.DisplayNotificationMessage;
+import com.lunarclient.apollo.notification.v1.ResetNotificationsMessage;
+import java.time.Duration;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import org.bukkit.entity.Player;
+
+public class NotificationProtoExample extends NotificationExample {
+
+ @Override
+ 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)
+ .append(Component.newline())
+ .append(Component.text("Get ready!", NamedTextColor.WHITE))
+ .append(Component.newline())
+ .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);
+ }
+
+ @Override
+ public void resetNotificationsExample(Player viewer) {
+ ResetNotificationsMessage message = ResetNotificationsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/RichPresenceProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/RichPresenceProtoExample.java
new file mode 100644
index 00000000..d407941a
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/RichPresenceProtoExample.java
@@ -0,0 +1,56 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.RichPresenceExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.richpresence.v1.OverrideServerRichPresenceMessage;
+import com.lunarclient.apollo.richpresence.v1.ResetServerRichPresenceMessage;
+import org.bukkit.entity.Player;
+
+public class RichPresenceProtoExample extends RichPresenceExample {
+
+ @Override
+ public void overrideServerRichPresenceExample(Player viewer) {
+ OverrideServerRichPresenceMessage message = OverrideServerRichPresenceMessage.newBuilder()
+ .setGameName("BedWars")
+ .setGameVariantName("Solo")
+ .setGameState("In Game")
+ .setPlayerState("Playing")
+ .setMapName("Winter")
+ .setSubServer("BW02")
+ .setTeamCurrentSize(3)
+ .setTeamMaxSize(4)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetServerRichPresenceExample(Player viewer) {
+ ResetServerRichPresenceMessage message = ResetServerRichPresenceMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ServerRuleProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ServerRuleProtoExample.java
new file mode 100644
index 00000000..32f8c9a4
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/ServerRuleProtoExample.java
@@ -0,0 +1,63 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.google.protobuf.Value;
+import com.lunarclient.apollo.configurable.v1.ConfigurableSettings;
+import com.lunarclient.apollo.example.common.modules.impl.ServerRuleExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import java.util.HashMap;
+import java.util.Map;
+import org.bukkit.entity.Player;
+
+public class ServerRuleProtoExample extends ServerRuleExample {
+
+ @Override
+ public void setAntiPortalTraps(boolean value) {
+ Map properties = new HashMap<>();
+ properties.put("anti-portal-traps", Value.newBuilder().setBoolValue(value).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("server_rule", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+ }
+
+ @Override
+ public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
+ Map properties = new HashMap<>();
+ properties.put("override-nametag-render-distance", Value.newBuilder().setBoolValue(value).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("server_rule", properties);
+ ProtobufPacketUtil.sendPacket(viewer, settings);
+ }
+
+ @Override
+ public void setNametagRenderDistanceExample(int value) {
+ Map properties = new HashMap<>();
+ properties.put("nametag-render-distance", Value.newBuilder().setNumberValue(value).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("server_rule", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/StaffModProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/StaffModProtoExample.java
new file mode 100644
index 00000000..9e6a8299
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/StaffModProtoExample.java
@@ -0,0 +1,58 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.StaffModExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.staffmod.v1.DisableStaffModsMessage;
+import com.lunarclient.apollo.staffmod.v1.EnableStaffModsMessage;
+import com.lunarclient.apollo.staffmod.v1.StaffMod;
+import java.util.Collections;
+import org.bukkit.entity.Player;
+
+public class StaffModProtoExample extends StaffModExample {
+
+ @Override
+ public void enableStaffModsExample(Player viewer) {
+ if (!viewer.hasPermission("apollo.staff")) {
+ return;
+ }
+
+ EnableStaffModsMessage message = EnableStaffModsMessage.newBuilder()
+ .addAllStaffMods(Collections.singletonList(StaffMod.STAFF_MOD_XRAY))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void disableStaffModsExample(Player viewer) {
+ DisableStaffModsMessage message = DisableStaffModsMessage.newBuilder()
+ .addAllStaffMods(Collections.singletonList(StaffMod.STAFF_MOD_XRAY))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/StopwatchProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/StopwatchProtoExample.java
new file mode 100644
index 00000000..67ea1840
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/StopwatchProtoExample.java
@@ -0,0 +1,53 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.StopwatchExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.stopwatch.v1.ResetStopwatchMessage;
+import com.lunarclient.apollo.stopwatch.v1.StartStopwatchMessage;
+import com.lunarclient.apollo.stopwatch.v1.StopStopwatchMessage;
+import org.bukkit.entity.Player;
+
+public class StopwatchProtoExample extends StopwatchExample {
+
+ @Override
+ public void startStopwatchExample(Player viewer) {
+ StartStopwatchMessage message = StartStopwatchMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void stopStopwatchExample(Player viewer) {
+ StopStopwatchMessage message = StopStopwatchMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetStopwatchExample(Player viewer) {
+ ResetStopwatchMessage message = ResetStopwatchMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TeamProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TeamProtoExample.java
new file mode 100644
index 00000000..5837c985
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TeamProtoExample.java
@@ -0,0 +1,254 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import com.lunarclient.apollo.example.common.modules.impl.TeamExample;
+import com.lunarclient.apollo.example.proto.AdventureUtil;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import com.lunarclient.apollo.team.v1.ResetTeamMembersMessage;
+import com.lunarclient.apollo.team.v1.TeamMember;
+import com.lunarclient.apollo.team.v1.UpdateTeamMembersMessage;
+import java.awt.Color;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.scheduler.BukkitRunnable;
+
+public class TeamProtoExample extends TeamExample implements Listener {
+
+ private final Map teamsByTeamId = Maps.newHashMap();
+ private final Map teamsByPlayerUuid = Maps.newHashMap();
+
+ public TeamProtoExample() {
+ new TeamUpdateTask();
+
+ Bukkit.getPluginManager().registerEvents(this, ApolloExamplePlugin.getPlugin());
+ }
+
+ @EventHandler
+ private void onPlayerQuit(PlayerQuitEvent event) {
+ Player player = event.getPlayer();
+
+ this.getByPlayerUuid(player.getUniqueId()).ifPresent(team -> {
+ if (team.getMembers().size() == 1) {
+ this.deleteTeam(team.getTeamId());
+ }
+ });
+ }
+
+ public Optional getByPlayerUuid(UUID playerUuid) {
+ return Optional.ofNullable(this.teamsByPlayerUuid.get(playerUuid));
+ }
+
+ public Optional getByTeamId(UUID teamId) {
+ return Optional.ofNullable(this.teamsByTeamId.get(teamId));
+ }
+
+ public Team createTeam() {
+ Team team = new Team();
+ this.teamsByTeamId.put(team.getTeamId(), team);
+
+ return team;
+ }
+
+ public void deleteTeam(UUID teamId) {
+ Team team = this.teamsByTeamId.remove(teamId);
+
+ if (team != null) {
+ team.getMembers().forEach(team::removeMember);
+ }
+ }
+
+ public class Team {
+
+ private final UUID teamId;
+ private final Set members;
+
+ public Team() {
+ this.teamId = UUID.randomUUID();
+ this.members = Sets.newHashSet();
+ }
+
+ public void addMember(Player player) {
+ this.members.add(player);
+ TeamProtoExample.this.teamsByPlayerUuid.put(player.getUniqueId(), this);
+ }
+
+ public void removeMember(Player player) {
+ this.members.remove(player);
+ TeamProtoExample.this.teamsByPlayerUuid.remove(player.getUniqueId());
+
+ ResetTeamMembersMessage message = ResetTeamMembersMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(player, message);
+ }
+
+ private TeamMember createTeamMember(Player member) {
+ return TeamMember.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(member.getUniqueId()))
+ .setAdventureJsonPlayerName(AdventureUtil.toJson(
+ Component.text()
+ .content(member.getName())
+ .color(NamedTextColor.WHITE)
+ .build()
+ ))
+ .setMarkerColor(ProtobufUtil.createColorProto(Color.WHITE))
+ .setLocation(ProtobufUtil.createLocationProto(member.getLocation()))
+ .build();
+ }
+
+ // The refresh method used for updating members locations
+ public void refresh() {
+ List teammates = this.members.stream().filter(Player::isOnline)
+ .map(this::createTeamMember)
+ .collect(Collectors.toList());
+
+ UpdateTeamMembersMessage message = UpdateTeamMembersMessage.newBuilder()
+ .addAllMembers(teammates)
+ .build();
+
+ this.members.forEach(member -> ProtobufPacketUtil.sendPacket(member, message));
+ }
+
+ public UUID getTeamId() {
+ return this.teamId;
+ }
+
+ public Set getMembers() {
+ return this.members;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+
+ if (other == null || other.getClass() != this.getClass()) {
+ return false;
+ }
+
+ Team team = (Team) other;
+ return this.teamId.equals(team.getTeamId());
+ }
+
+ @Override
+ public int hashCode() {
+ return this.teamId.hashCode();
+ }
+ }
+
+ // Updates players location every 1 tick (50ms)
+ public class TeamUpdateTask extends BukkitRunnable {
+
+ public TeamUpdateTask() {
+ this.runTaskTimerAsynchronously(ApolloExamplePlugin.getPlugin(), 1L, 1L);
+ }
+
+ @Override
+ public void run() {
+ TeamProtoExample.this.teamsByTeamId.values().forEach(Team::refresh);
+ }
+ }
+
+ @Override
+ public void createTeam(Player player) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+
+ if (teamOpt.isPresent()) {
+ player.sendMessage("You already have a team...");
+ return;
+ }
+
+ Team team = this.createTeam();
+ team.addMember(player);
+
+ player.sendMessage("Creating team...");
+ }
+
+ @Override
+ public void deleteTeam(Player player) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+
+ if (teamOpt.isPresent()) {
+ this.deleteTeam(teamOpt.get().getTeamId());
+ player.sendMessage("Deleting team...");
+ return;
+ }
+
+ player.sendMessage("No team found...");
+ }
+
+ @Override
+ public void addMember(Player player, Player target) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+ Optional targetTeamOpt = this.getByPlayerUuid(target.getUniqueId());
+
+ if (targetTeamOpt.isPresent()) {
+ player.sendMessage("Player " + target.getName() + " already has a team...");
+ return;
+ }
+
+ if (teamOpt.isPresent()) {
+ teamOpt.get().addMember(target);
+ player.sendMessage("Added " + target.getName() + " to your team...");
+ return;
+ }
+
+ player.sendMessage("No team found...");
+ }
+
+ @Override
+ public void removeMember(Player player, Player target) {
+ Optional teamOpt = this.getByPlayerUuid(player.getUniqueId());
+ Optional targetTeamOpt = this.getByPlayerUuid(target.getUniqueId());
+
+ if (!targetTeamOpt.isPresent()) {
+ player.sendMessage("Player " + target.getName() + " doesn't have a team...");
+ return;
+ }
+
+ if (teamOpt.isPresent()) {
+ teamOpt.get().removeMember(target);
+ player.sendMessage("Removed " + target.getName() + " from your team...");
+ return;
+ }
+
+ player.sendMessage("No team found...");
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TebexProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TebexProtoExample.java
new file mode 100644
index 00000000..d547ead0
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TebexProtoExample.java
@@ -0,0 +1,46 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.TebexExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.tebex.v1.OpenTebexEmbeddedCheckoutMessage;
+import org.bukkit.entity.Player;
+
+public class TebexProtoExample extends TebexExample {
+
+ @Override
+ public void displayTebexEmbeddedCheckoutExample(Player viewer, String basketIdent, String locale) {
+ OpenTebexEmbeddedCheckoutMessage.Builder builder = OpenTebexEmbeddedCheckoutMessage.newBuilder()
+ .setBasketIdent(basketIdent);
+
+ if (locale != null) {
+ builder.setLocale(locale);
+ }
+
+ OpenTebexEmbeddedCheckoutMessage message = builder.build();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TitleProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TitleProtoExample.java
new file mode 100644
index 00000000..705752a0
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TitleProtoExample.java
@@ -0,0 +1,89 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.json.examples.TitleJsonExample;
+import com.lunarclient.apollo.example.proto.AdventureUtil;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import com.lunarclient.apollo.title.v1.DisplayTitleMessage;
+import com.lunarclient.apollo.title.v1.ResetTitlesMessage;
+import com.lunarclient.apollo.title.v1.TitleType;
+import java.time.Duration;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextDecoration;
+import org.bukkit.entity.Player;
+
+public class TitleProtoExample extends TitleJsonExample {
+
+ @Override
+ public void displayTitleExample(Player viewer) {
+ DisplayTitleMessage message = DisplayTitleMessage.newBuilder()
+ .setTitleType(TitleType.TITLE_TYPE_TITLE)
+ .setAdventureJsonMessage(AdventureUtil.toJson(
+ Component.text()
+ .content("Hello, player!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build()
+ ))
+ .setScale(1.0f)
+ .setFadeInTime(ProtobufUtil.createDurationProto(Duration.ofMillis(1500)))
+ .setDisplayTime(ProtobufUtil.createDurationProto(Duration.ofMillis(250)))
+ .setFadeOutTime(ProtobufUtil.createDurationProto(Duration.ofMillis(300)))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void displayTitleInterpolatedExample(Player viewer) {
+ DisplayTitleMessage message = DisplayTitleMessage.newBuilder()
+ .setTitleType(TitleType.TITLE_TYPE_TITLE)
+ .setAdventureJsonMessage(AdventureUtil.toJson(
+ Component.text()
+ .content("This title expands!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build()
+ ))
+ .setScale(0.1f)
+ .setInterpolationScale(1.0f)
+ .setInterpolationRate(0.01f)
+ .setFadeInTime(ProtobufUtil.createDurationProto(Duration.ofMillis(5000)))
+ .setDisplayTime(ProtobufUtil.createDurationProto(Duration.ofMillis(250)))
+ .setFadeOutTime(ProtobufUtil.createDurationProto(Duration.ofMillis(300)))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetTitlesExample(Player viewer) {
+ ResetTitlesMessage message = ResetTitlesMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TntCountdownProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TntCountdownProtoExample.java
new file mode 100644
index 00000000..16ef01c3
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TntCountdownProtoExample.java
@@ -0,0 +1,143 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.google.protobuf.Value;
+import com.lunarclient.apollo.configurable.v1.ConfigurableSettings;
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import com.lunarclient.apollo.example.common.modules.impl.TntCountdownExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import com.lunarclient.apollo.tntcountdown.v1.SetTntCountdownMessage;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.TNTPrimed;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntitySpawnEvent;
+
+public class TntCountdownProtoExample extends TntCountdownExample implements Listener {
+
+ private static Method entityGetter;
+
+ static {
+ try {
+ TntCountdownProtoExample.entityGetter = Bukkit.class.getDeclaredMethod("getEntity", UUID.class);
+ } catch (Throwable throwable) {
+ // Ignore for legacy versions.
+ }
+ }
+
+ public TntCountdownProtoExample() {
+ Bukkit.getPluginManager().registerEvents(this, ApolloExamplePlugin.getPlugin());
+ }
+
+ @Override
+ public void setTntCountdownExample() {
+ Map properties = new HashMap<>();
+ properties.put("tnt-ticks", Value.newBuilder().setNumberValue(160).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("tnt_countdown", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+ }
+
+ @Override
+ public void overrideTntCountdownExample(Player viewer) {
+ Location location = viewer.getLocation();
+ TNTPrimed entity = viewer.getWorld().spawn(location, TNTPrimed.class);
+ int customTicks = 200;
+
+ TNTPrimed target = null;
+ if (TntCountdownProtoExample.entityGetter != null) {
+ try {
+ target = (TNTPrimed) TntCountdownProtoExample.entityGetter.invoke(null, entity.getUniqueId());
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
+ } else {
+ for (World world : Bukkit.getWorlds()) {
+ for (TNTPrimed compare : world.getEntitiesByClass(TNTPrimed.class)) {
+ if (compare.getUniqueId().equals(entity.getUniqueId())) {
+ target = compare;
+ break;
+ }
+ }
+ }
+ }
+
+ if (target != null) {
+ target.setFuseTicks(customTicks);
+ }
+
+ SetTntCountdownMessage message = SetTntCountdownMessage.newBuilder()
+ .setEntityId(ProtobufUtil.createEntityIdProto(entity.getEntityId(), entity.getUniqueId()))
+ .setDurationTicks(customTicks)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void clearTntCountdownOptionExample() {
+ Map properties = new HashMap<>();
+ properties.put("tnt-ticks", Value.newBuilder().setNumberValue(80).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("tnt_countdown", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+ }
+
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ private void onTntSpawn(EntitySpawnEvent event) {
+ String entityName = event.getEntityType().name();
+ if (!entityName.equals("PRIMED_TNT") && !entityName.equals("TNT")) {
+ return;
+ }
+
+ TNTPrimed primed = (TNTPrimed) event.getEntity();
+ int customTicks = 200;
+ int defaultTicks = 80;
+ int currentTicks = primed.getFuseTicks();
+
+ if (currentTicks != defaultTicks) {
+ customTicks = currentTicks;
+
+ SetTntCountdownMessage message = SetTntCountdownMessage.newBuilder()
+ .setEntityId(ProtobufUtil.createEntityIdProto(primed.getEntityId(), primed.getUniqueId()))
+ .setDurationTicks(customTicks)
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+ primed.setFuseTicks(customTicks);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TransferProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TransferProtoExample.java
new file mode 100644
index 00000000..f674601b
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/TransferProtoExample.java
@@ -0,0 +1,110 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.google.common.collect.Lists;
+import com.google.protobuf.ByteString;
+import com.lunarclient.apollo.example.common.modules.impl.TransferExample;
+import com.lunarclient.apollo.example.proto.listeners.ApolloRoundtripProtoListener;
+import com.lunarclient.apollo.transfer.v1.PingData;
+import com.lunarclient.apollo.transfer.v1.PingRequest;
+import com.lunarclient.apollo.transfer.v1.PingResponse;
+import com.lunarclient.apollo.transfer.v1.TransferRequest;
+import com.lunarclient.apollo.transfer.v1.TransferResponse;
+import java.util.UUID;
+import org.bukkit.entity.Player;
+
+public class TransferProtoExample extends TransferExample {
+
+ @Override
+ public void transferExample(Player player) {
+ UUID requestId = UUID.randomUUID();
+
+ TransferRequest transferRequestMessage = TransferRequest.newBuilder()
+ .setRequestId(ByteString.copyFromUtf8(requestId.toString()))
+ .setServerIp("mc.hypixel.net")
+ .build();
+
+ ApolloRoundtripProtoListener.getInstance()
+ .sendRequest(player, requestId, transferRequestMessage, TransferResponse.class)
+ .thenAccept(response -> {
+ String message = "";
+
+ switch (response.getStatus()) {
+ case STATUS_ACCEPTED: {
+ message = "Transfer accepted! Goodbye!";
+ break;
+ }
+
+ case STATUS_REJECTED: {
+ message = "Transfer rejected by client!";
+ break;
+ }
+ }
+
+ player.sendMessage(message);
+ }).exceptionally(throwable -> {
+ player.sendMessage("Failed to receive a response in time.");
+ return null;
+ });
+ }
+
+ @Override
+ public void pingExample(Player player) {
+ UUID requestId = UUID.randomUUID();
+
+ PingRequest pingRequestMessage = PingRequest.newBuilder()
+ .setRequestId(ByteString.copyFromUtf8(requestId.toString()))
+ .addAllServerIps(Lists.newArrayList("mc.hypixel.net", "minehut.com"))
+ .build();
+
+ ApolloRoundtripProtoListener.getInstance()
+ .sendRequest(player, requestId, pingRequestMessage, PingResponse.class)
+ .thenAccept(response -> {
+ for (PingData pingData : response.getPingDataList()) {
+ String message = "";
+
+ switch (pingData.getStatus()) {
+ // Displays successful ping request to display the server IP and the players ping to that server.
+ case STATUS_SUCCESS: {
+ message = String.format("Ping to %s is %d ms.", pingData.getServerIp(), pingData.getPing());
+ break;
+ }
+
+ // If the ping request times-out
+ case STATUS_TIMED_OUT: {
+ message = String.format("Failed to ping %s", pingData.getServerIp());
+ break;
+ }
+ }
+
+ player.sendMessage(message);
+ }
+ }).exceptionally(throwable -> {
+ player.sendMessage("Failed to receive a response in time.");
+ return null;
+ });
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/VignetteProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/VignetteProtoExample.java
new file mode 100644
index 00000000..3cb665c9
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/VignetteProtoExample.java
@@ -0,0 +1,50 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.VignetteExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.vignette.v1.DisplayVignetteMessage;
+import com.lunarclient.apollo.vignette.v1.ResetVignetteMessage;
+import org.bukkit.entity.Player;
+
+public class VignetteProtoExample extends VignetteExample {
+
+ @Override
+ public void displayVignetteExample(Player viewer) {
+ DisplayVignetteMessage message = DisplayVignetteMessage.newBuilder()
+ .setResourceLocation("textures/misc/pumpkinblur.png")
+ .setOpacity(0.75f)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetVignetteExample(Player viewer) {
+ ResetVignetteMessage message = ResetVignetteMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/WaypointProtoExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/WaypointProtoExample.java
new file mode 100644
index 00000000..df457fa9
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/examples/WaypointProtoExample.java
@@ -0,0 +1,66 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.examples;
+
+import com.lunarclient.apollo.example.common.modules.impl.WaypointExample;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import com.lunarclient.apollo.waypoint.v1.DisplayWaypointMessage;
+import com.lunarclient.apollo.waypoint.v1.RemoveWaypointMessage;
+import com.lunarclient.apollo.waypoint.v1.ResetWaypointsMessage;
+import java.awt.Color;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+public class WaypointProtoExample extends WaypointExample {
+
+ @Override
+ public void displayWaypointExample(Player viewer) {
+ DisplayWaypointMessage message = DisplayWaypointMessage.newBuilder()
+ .setName("KoTH")
+ .setLocation(ProtobufUtil.createBlockLocationProto(new Location(viewer.getWorld(), 500, 100, 500)))
+ .setColor(ProtobufUtil.createColorProto(Color.ORANGE))
+ .setPreventRemoval(false)
+ .setHidden(false)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void removeWaypointExample(Player viewer) {
+ RemoveWaypointMessage message = RemoveWaypointMessage.newBuilder()
+ .setName("KoTH")
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+ @Override
+ public void resetWaypointsExample(Player viewer) {
+ ResetWaypointsMessage message = ResetWaypointsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPacketReceiveProtoListener.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPacketReceiveProtoListener.java
new file mode 100644
index 00000000..37c22bd9
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPacketReceiveProtoListener.java
@@ -0,0 +1,135 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.listeners;
+
+import com.google.protobuf.Any;
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.lunarclient.apollo.common.v1.LunarClientVersion;
+import com.lunarclient.apollo.common.v1.MinecraftVersion;
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import com.lunarclient.apollo.example.proto.ProtobufUtil;
+import com.lunarclient.apollo.packetenrichment.v1.PlayerAttackMessage;
+import com.lunarclient.apollo.packetenrichment.v1.PlayerChatCloseMessage;
+import com.lunarclient.apollo.packetenrichment.v1.PlayerChatOpenMessage;
+import com.lunarclient.apollo.packetenrichment.v1.PlayerInfo;
+import com.lunarclient.apollo.packetenrichment.v1.PlayerUseItemMessage;
+import com.lunarclient.apollo.player.v1.ModMessage;
+import com.lunarclient.apollo.player.v1.PlayerHandshakeMessage;
+import java.util.List;
+import java.util.UUID;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.messaging.PluginMessageListener;
+
+public class ApolloPacketReceiveProtoListener implements PluginMessageListener {
+
+ public ApolloPacketReceiveProtoListener(ApolloExamplePlugin plugin) {
+
+ }
+
+ @Override
+ public void onPluginMessageReceived(String s, Player player, byte[] bytes) {
+ try {
+ Any any = Any.parseFrom(bytes);
+
+ if (any.is(PlayerHandshakeMessage.class)) {
+ this.onPlayerHandshake(any.unpack(PlayerHandshakeMessage.class));
+ }
+
+ // Packet Enrichment Module
+ if (any.is(PlayerAttackMessage.class)) {
+ this.onPlayerAttack(any.unpack(PlayerAttackMessage.class));
+ } else if (any.is(PlayerChatOpenMessage.class)) {
+ this.onPlayerChatOpen(any.unpack(PlayerChatOpenMessage.class));
+ } else if (any.is(PlayerChatCloseMessage.class)) {
+ this.onPlayerChatClose(any.unpack(PlayerChatCloseMessage.class));
+ } else if (any.is(PlayerUseItemMessage.class)) {
+ this.onPlayerUseItem(any.unpack(PlayerUseItemMessage.class));
+ }
+ } catch (InvalidProtocolBufferException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void onPlayerHandshake(PlayerHandshakeMessage message) {
+ MinecraftVersion minecraftVersion = message.getMinecraftVersion();
+
+ LunarClientVersion lunarClientVersion = message.getLunarClientVersion();
+ String gitBranch = lunarClientVersion.getGitBranch();
+ String gitCommit = lunarClientVersion.getGitCommit();
+ String semVer = lunarClientVersion.getSemver();
+
+ List installedMods = message.getInstalledModsList();
+ for (ModMessage mod : installedMods) {
+ String modId = mod.getId();
+ String displayName = mod.getName();
+ String version = mod.getVersion();
+ ModMessage.Type type = mod.getType();
+ }
+ }
+
+ private void onPlayerAttack(PlayerAttackMessage message) {
+ long instantiationTimeMs = ProtobufUtil.toJavaTimestamp(message.getPacketInfo().getInstantiationTime());
+
+ PlayerInfo targetInfo = message.getTargetInfo();
+ PlayerInfo attackerInfo = message.getAttackerInfo();
+
+ this.onPlayerInfo(targetInfo);
+ this.onPlayerInfo(attackerInfo);
+ }
+
+ private void onPlayerChatOpen(PlayerChatOpenMessage message) {
+ long instantiationTimeMs = ProtobufUtil.toJavaTimestamp(message.getPacketInfo().getInstantiationTime());
+
+ PlayerInfo playerInfo = message.getPlayerInfo();
+ this.onPlayerInfo(playerInfo);
+ }
+
+ private void onPlayerChatClose(PlayerChatCloseMessage message) {
+ long instantiationTimeMs = ProtobufUtil.toJavaTimestamp(message.getPacketInfo().getInstantiationTime());
+
+ PlayerInfo playerInfo = message.getPlayerInfo();
+ this.onPlayerInfo(playerInfo);
+ }
+
+ private void onPlayerUseItem(PlayerUseItemMessage message) {
+ long instantiationTimeMs = ProtobufUtil.toJavaTimestamp(message.getPacketInfo().getInstantiationTime());
+
+ PlayerInfo playerInfo = message.getPlayerInfo();
+ this.onPlayerInfo(playerInfo);
+
+ boolean mainHand = message.getMainHand();
+ }
+
+ private void onPlayerInfo(PlayerInfo info) {
+ UUID uuid = ProtobufUtil.toJavaUuid(info.getPlayerUuid());
+ Location location = ProtobufUtil.toBukkitLocation(info.getLocation());
+ boolean sneaking = info.getSneaking();
+ boolean sprinting = info.getSprinting();
+ boolean jumping = info.getJumping();
+ float forwardSpeed = info.getForwardSpeed();
+ float strafeSpeed = info.getStrafeSpeed();
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPlayerProtoListener.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPlayerProtoListener.java
new file mode 100644
index 00000000..1a6553ba
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloPlayerProtoListener.java
@@ -0,0 +1,105 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.listeners;
+
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.player.v1.UpdatePlayerWorldMessage;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerChangedWorldEvent;
+import org.bukkit.event.player.PlayerRegisterChannelEvent;
+import org.bukkit.plugin.messaging.Messenger;
+
+public class ApolloPlayerProtoListener implements Listener {
+
+ private final ApolloExamplePlugin plugin;
+
+ private final Set playersRunningApollo = new HashSet<>();
+
+ public ApolloPlayerProtoListener(ApolloExamplePlugin plugin) {
+ this.plugin = plugin;
+
+ Messenger messenger = Bukkit.getServer().getMessenger();
+ messenger.registerOutgoingPluginChannel(plugin, "lunar:apollo");
+ messenger.registerIncomingPluginChannel(plugin, "lunar:apollo", new ApolloRoundtripProtoListener(plugin));
+ messenger.registerIncomingPluginChannel(plugin, "lunar:apollo", new ApolloPacketReceiveProtoListener(plugin));
+
+ Bukkit.getPluginManager().registerEvents(this, plugin);
+ }
+
+ public void disable() {
+ this.playersRunningApollo.clear();
+
+ Messenger messenger = Bukkit.getServer().getMessenger();
+ messenger.unregisterOutgoingPluginChannel(this.plugin, "lunar:apollo");
+ messenger.unregisterIncomingPluginChannel(this.plugin, "lunar:apollo");
+
+ HandlerList.unregisterAll(this);
+ }
+
+ @EventHandler
+ private void onRegisterChannel(PlayerRegisterChannelEvent event) {
+ if (!event.getChannel().equalsIgnoreCase("lunar:apollo")) {
+ return;
+ }
+
+ this.onApolloRegister(event.getPlayer());
+ }
+
+ @EventHandler
+ private void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
+ Player player = event.getPlayer();
+
+ // Sending the player's world name to the client is required for some modules
+ ProtobufPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player));
+ }
+
+ private UpdatePlayerWorldMessage createUpdatePlayerWorldMessage(Player player) {
+ return UpdatePlayerWorldMessage.newBuilder()
+ .setWorld(player.getWorld().getName())
+ .build();
+ }
+
+ private boolean isPlayerRunningApollo(Player player) {
+ return this.playersRunningApollo.contains(player.getUniqueId());
+ }
+
+ private void onApolloRegister(Player player) {
+ ProtobufPacketUtil.enableModules(player);
+
+ // Sending the player's world name to the client is required for some modules
+ ProtobufPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player));
+
+ this.playersRunningApollo.add(player.getUniqueId());
+ player.sendMessage("You are using LunarClient!");
+ }
+
+}
diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloRoundtripProtoListener.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloRoundtripProtoListener.java
new file mode 100644
index 00000000..3abd55f9
--- /dev/null
+++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/proto/listeners/ApolloRoundtripProtoListener.java
@@ -0,0 +1,110 @@
+/*
+ * This file is part of Apollo, licensed under the MIT License.
+ *
+ * Copyright (c) 2023 Moonsworth
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.lunarclient.apollo.example.proto.listeners;
+
+import com.google.protobuf.Any;
+import com.google.protobuf.GeneratedMessageV3;
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.lunarclient.apollo.example.ApolloExamplePlugin;
+import com.lunarclient.apollo.example.proto.ProtobufPacketUtil;
+import com.lunarclient.apollo.transfer.v1.PingResponse;
+import com.lunarclient.apollo.transfer.v1.TransferResponse;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import lombok.Getter;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.messaging.PluginMessageListener;
+
+public class ApolloRoundtripProtoListener implements PluginMessageListener {
+
+ @Getter
+ private static ApolloRoundtripProtoListener instance;
+
+ private final Map>> roundTripPacketFutures = new ConcurrentHashMap<>();
+ private final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
+
+ public ApolloRoundtripProtoListener(ApolloExamplePlugin plugin) {
+ instance = this;
+ }
+
+ @Override
+ public void onPluginMessageReceived(String s, Player player, byte[] bytes) {
+ try {
+ Any any = Any.parseFrom(bytes);
+
+ if (any.is(PingResponse.class)) {
+ PingResponse message = any.unpack(PingResponse.class);
+ UUID requestId = UUID.fromString(message.getRequestId().toStringUtf8());
+ this.handleResponse(player, requestId, message);
+ } else if (any.is(TransferResponse.class)) {
+ TransferResponse message = any.unpack(TransferResponse.class);
+ UUID requestId = UUID.fromString(message.getRequestId().toStringUtf8());
+ this.handleResponse(player, requestId, message);
+ }
+
+ } catch (InvalidProtocolBufferException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public CompletableFuture sendRequest(Player player, UUID requestId,
+ GeneratedMessageV3 request,
+ Class responseType) {
+ ProtobufPacketUtil.sendPacket(player, request);
+
+ CompletableFuture future = new CompletableFuture<>();
+
+ this.roundTripPacketFutures
+ .computeIfAbsent(player.getUniqueId(), k -> new ConcurrentHashMap<>())
+ .put(requestId, (CompletableFuture) future);
+
+ ScheduledFuture> timeoutTask = this.executorService.schedule(() ->
+ future.completeExceptionally(new TimeoutException("Response timed out")),
+ 10, TimeUnit.SECONDS
+ );
+
+ future.whenComplete((result, throwable) -> timeoutTask.cancel(false));
+ return future;
+ }
+
+ private void handleResponse(Player player, UUID requestId, T message) {
+ Map> futures = this.roundTripPacketFutures.get(player.getUniqueId());
+ if (futures == null) {
+ return;
+ }
+
+ CompletableFuture future = futures.remove(requestId);
+ if (future != null) {
+ future.complete(message);
+ }
+ }
+
+}
diff --git a/bukkit-example/src/main/resources/plugin.yml b/bukkit-example/src/main/resources/plugin.yml
index 8fb428b2..c0080cc7 100644
--- a/bukkit-example/src/main/resources/plugin.yml
+++ b/bukkit-example/src/main/resources/plugin.yml
@@ -2,10 +2,12 @@ name: Apollo-Example
main: com.lunarclient.apollo.example.ApolloExamplePlugin
version: 1.1.5
author: Moonsworth
-depend: [ Apollo-Bukkit ]
+softdepend: [ Apollo-Bukkit ]
api-version: 1.13
commands:
+ switch:
+ description: "Switch the implementation type!"
beam:
description: "Beams!"
border:
diff --git a/docs/developers/_meta.json b/docs/developers/_meta.json
index f5f6cd1c..9a1ca48a 100644
--- a/docs/developers/_meta.json
+++ b/docs/developers/_meta.json
@@ -7,5 +7,6 @@
"mods": "Mods",
"utilities": "Utilities",
"platform-utilities": "Platform Utilities",
- "adventure": "Adventure"
+ "adventure": "Adventure",
+ "lightweight": "Lightweight"
}
diff --git a/docs/developers/events.mdx b/docs/developers/events.mdx
index 587ec632..29da98b5 100644
--- a/docs/developers/events.mdx
+++ b/docs/developers/events.mdx
@@ -339,3 +339,4 @@ public void callCoolApolloCancellableEvent(ApolloPlayer player) {
}
}
```
+
diff --git a/docs/developers/lightweight/_meta.json b/docs/developers/lightweight/_meta.json
new file mode 100644
index 00000000..88c256cf
--- /dev/null
+++ b/docs/developers/lightweight/_meta.json
@@ -0,0 +1,5 @@
+{
+ "introduction": "Introduction",
+ "protobuf": "Protobuf",
+ "json": "JSON"
+}
diff --git a/docs/developers/lightweight/introduction.mdx b/docs/developers/lightweight/introduction.mdx
new file mode 100644
index 00000000..dc7b49ef
--- /dev/null
+++ b/docs/developers/lightweight/introduction.mdx
@@ -0,0 +1,28 @@
+# Lightweight
+
+Our lightweight integration allows for Apollo features to be used, without the need for running the entire Apollo plugin. We will introduce you to two different methods that achieve the same goal, while utilizing separate approaches. Each method offers different trade-offs between complexity, flexibility, and performance. Choose the method that best fits your use case and environment.
+
+## Message format
+
+The message format used to communicate, follows a loosely structured JSON schema. The schema is defined using Protocol Buffers (protobuf) and includes various fields to achieve the end result, in this example-case displaying a waypoint. While the fields will change depending on the feature you're trying to implement, the `@type` will also remain. It should always be at the top, as shown. You can locate all the `@type` protos from this page: https://buf.build/lunarclient/apollo.
+```JSON
+{
+ "@type": "type.googleapis.com/lunarclient.apollo.waypoint.v1.DisplayWaypointMessage", // The protobuf message type
+ "name": "KoTH",
+ "location": {
+ "world": "world",
+ "x": 150,
+ "y": 100,
+ "z": -150
+ },
+ "color": {
+ "color": 255
+ },
+ "preventRemoval": true
+}
+```
+
+### Usage Methods
+
+🔗 [Protobuf](/apollo/developers/lightweight/protobuf/getting-started)
+🔗 [JSON](/apollo/developers/lightweight/json/getting-started)
diff --git a/docs/developers/lightweight/json/_meta.json b/docs/developers/lightweight/json/_meta.json
new file mode 100644
index 00000000..38a14154
--- /dev/null
+++ b/docs/developers/lightweight/json/_meta.json
@@ -0,0 +1,7 @@
+{
+ "getting-started": "Getting Started",
+ "player-detection": "Player Detection",
+ "packet-util": "Packet Util",
+ "object-util": "Object Util",
+ "adventure-util": "Adventure Util"
+}
diff --git a/docs/developers/lightweight/json/adventure-util.mdx b/docs/developers/lightweight/json/adventure-util.mdx
new file mode 100644
index 00000000..2490a34b
--- /dev/null
+++ b/docs/developers/lightweight/json/adventure-util.mdx
@@ -0,0 +1,13 @@
+# Adventure Util
+
+## Overview
+
+Provides a single method responsible for serializing the Adventure Component to a String
+
+## Integration
+
+```java
+public static String toJson(@NonNull Component component) {
+ return GsonComponentSerializer.gson().serialize(component);
+}
+```
diff --git a/docs/developers/lightweight/json/getting-started.mdx b/docs/developers/lightweight/json/getting-started.mdx
new file mode 100644
index 00000000..bed60847
--- /dev/null
+++ b/docs/developers/lightweight/json/getting-started.mdx
@@ -0,0 +1,22 @@
+import { Callout } from 'nextra-theme-docs'
+
+# Getting Started
+
+## Overview
+
+This method involves manually constructing JSON objects using a JSON library (e.g., Gson) and then converting these objects into byte arrays for transmission. It allows for dynamic and programmatic construction of JSON objects, offering flexibility in modifying the JSON structure. Available fields for each message, including their types, are available on the Buf Schema Registry at https://buf.build/lunarclient/apollo.
+While constructing messages, note that the `@type` field isn't required if the message is being sent within a message.
+
+
+ Note that this method uses a different plugin channel for sending packets,
+ which is `apollo:json`, while still using the `lunar:apollo` for player detection.
+
+
+## Integration Examples
+
+🔗 [Sending Apollo packets & Enabling Apollo modules](/apollo/developers/lightweight/json/packet-util)
+🔗 [Detecting players using LunarClient](/apollo/developers/lightweight/json/player-detection)
+🔗 [Common Apollo Objects](/apollo/developers/lightweight/json/object-util)
+🔗 [Adventure Util](/apollo/developers/lightweight/json/adventure-util)
+
+For examples of module integration, refer to the specific Module pages. Each page contains code samples under the `Manual JSON Object Construction` tab. For instance, you can find sample code for the `BorderModule` on its dedicated page [BorderModule](/apollo/developers/modules/border#sample-code) in the `Sample Code` section.
diff --git a/docs/developers/lightweight/json/object-util.mdx b/docs/developers/lightweight/json/object-util.mdx
new file mode 100644
index 00000000..1a79ade8
--- /dev/null
+++ b/docs/developers/lightweight/json/object-util.mdx
@@ -0,0 +1,129 @@
+# JSON Object Util
+
+## Overview
+
+These utilities facilitate the creation of Apollo objects, commonly used across various Apollo Modules. The utility methods are used for converting objects to and from their corresponding Protocol Buffers represented as a JSON Object.
+
+## Integration
+
+```java
+public static JsonObject createEnableModuleObjectWithType(@NotNull String module, Map properties) {
+ JsonObject enableModuleObject = JsonPacketUtil.createEnableModuleObject(module, properties);
+ enableModuleObject.addProperty("@type", "type.googleapis.com/lunarclient.apollo.configurable.v1.ConfigurableSettings");
+ return enableModuleObject;
+}
+
+public static JsonObject createUuidObject(@NotNull UUID uuid) {
+ JsonObject uuidObject = new JsonObject();
+ uuidObject.addProperty("high64", Long.toUnsignedString(uuid.getMostSignificantBits()));
+ uuidObject.addProperty("low64", Long.toUnsignedString(uuid.getLeastSignificantBits()));
+ return uuidObject;
+}
+
+public static JsonObject createColorObject(@NotNull Color color) {
+ JsonObject colorObject = new JsonObject();
+ colorObject.addProperty("color", color.getRGB());
+ return colorObject;
+}
+
+public static String createDurationObject(@NotNull Duration duration) {
+ long seconds = duration.getSeconds();
+ int nanos = duration.getNano();
+
+ String durationString;
+ if (nanos == 0) {
+ durationString = seconds + "s";
+ } else {
+ durationString = String.format("%d.%09ds", seconds, nanos)
+ .replaceAll("0+$", "")
+ .replaceAll("\\.$", "");
+ }
+
+ return durationString;
+}
+
+public static JsonObject createCuboid2DObject(double minX, double minZ, double maxX, double maxZ) {
+ JsonObject cuboid2DObject = new JsonObject();
+ cuboid2DObject.addProperty("min_x", minX);
+ cuboid2DObject.addProperty("min_z", minZ);
+ cuboid2DObject.addProperty("max_x", maxX);
+ cuboid2DObject.addProperty("max_z", maxZ);
+ return cuboid2DObject;
+}
+
+public static JsonObject createEntityIdObject(@NotNull Entity entity) {
+ JsonObject entityIdObject = new JsonObject();
+ entityIdObject.addProperty("entity_id", entity.getEntityId());
+ entityIdObject.add("entity_uuid", JsonUtil.createUuidObject(entity.getUniqueId()));
+ return entityIdObject;
+}
+```
+
+Location-related methods
+
+```java
+public static JsonObject createLocationObject(@NotNull Location location) {
+ JsonObject locationObject = new JsonObject();
+ locationObject.addProperty("world", location.getWorld().getName());
+ locationObject.addProperty("x", location.getX());
+ locationObject.addProperty("y", location.getY());
+ locationObject.addProperty("z", location.getZ());
+ return locationObject;
+}
+
+public static JsonObject createBlockLocationObject(@NotNull Location location) {
+ JsonObject locationObject = new JsonObject();
+ locationObject.addProperty("world", location.getWorld().getName());
+ locationObject.addProperty("x", location.getBlockX());
+ locationObject.addProperty("y", location.getBlockY());
+ locationObject.addProperty("z", location.getBlockZ());
+ return locationObject;
+}
+```
+
+Icon-related methods
+
+```java
+public static JsonObject createItemStackIconObject(@Nullable String itemName, int itemId, int customModelData) {
+ JsonObject itemIconObject = new JsonObject();
+ if (itemName != null) {
+ itemIconObject.addProperty("item_name", itemName);
+ } else {
+ itemIconObject.addProperty("item_id", itemId);
+ }
+
+ itemIconObject.addProperty("custom_model_data", customModelData);
+
+ JsonObject iconObject = new JsonObject();
+ iconObject.add("item_stack", itemIconObject);
+ return iconObject;
+}
+
+public static JsonObject createSimpleResourceLocationIconObject(@NotNull String resourceLocation, int size) {
+ JsonObject simpleIconObject = new JsonObject();
+ simpleIconObject.addProperty("resource_location", resourceLocation);
+ simpleIconObject.addProperty("size", size);
+
+ JsonObject iconObject = new JsonObject();
+ iconObject.add("simple_resource_location", simpleIconObject);
+
+ return iconObject;
+}
+
+public static JsonObject createAdvancedResourceLocationIconObject(@NotNull String resourceLocation, float width, float height,
+ float minU, float maxU, float minV, float maxV) {
+ JsonObject advancedIcon = new JsonObject();
+ advancedIcon.addProperty("resource_location", resourceLocation);
+ advancedIcon.addProperty("width", width);
+ advancedIcon.addProperty("height", height);
+ advancedIcon.addProperty("min_u", minU);
+ advancedIcon.addProperty("max_u", maxU);
+ advancedIcon.addProperty("min_v", minV);
+ advancedIcon.addProperty("max_v", maxV);
+
+ JsonObject iconObject = new JsonObject();
+ iconObject.add("advanced_resource_location", advancedIcon);
+
+ return iconObject;
+}
+```
diff --git a/docs/developers/lightweight/json/packet-util.mdx b/docs/developers/lightweight/json/packet-util.mdx
new file mode 100644
index 00000000..2bec4a69
--- /dev/null
+++ b/docs/developers/lightweight/json/packet-util.mdx
@@ -0,0 +1,124 @@
+import { Callout } from 'nextra-theme-docs'
+
+# JSON Packet Util
+
+## Overview
+
+These utilities are designed to handle packet transmission and creation for integrating and configuring Apollo modules with their respective properties. The utility class provides a list of most Apollo modules and their configuration options.
+
+The methods in this utility leverage the same plugin messaging channel as the Apollo API `lunar:apollo`.
+
+## Integration
+
+To utilize Apollo Modules, first define a list of the modules you want to use:
+
+```java
+private static final List APOLLO_MODULES = Arrays.asList("limb", "beam", "border", "chat", "colored_fire", "combat", "cooldown",
+ "entity", "glow", "hologram", "mod_setting", "nametag", "nick_hider", "notification", "packet_enrichment", "rich_presence",
+ "server_rule", "staff_mod", "stopwatch", "team", "title", "tnt_countdown", "transfer", "vignette", "waypoint"
+);
+```
+
+Next, specify the properties for these modules. These properties are included in the enable module packet. When using the Apollo plugin, this corresponds to modifying the `config.yml`
+
+
+ The example below does not encompass all available options and may not be up-to-date.
+ For the latest options, refer to the module documentation ([example](/apollo/developers/modules/serverrule#available-options)).
+
+
+```java
+// Module Id -> Option key -> Object
+private static final Table CONFIG_MODULE_PROPERTIES = HashBasedTable.create();
+
+static {
+ // Module Options that the client needs to notified about, these properties are sent with the enable module packet
+ // While using the Apollo plugin this would be equivalent to modifying the config.yml
+ CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "competitive-game", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "competitive-commands", Arrays.asList("/server", "/servers", "/hub"));
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-shaders", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-chunk-reloading", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-broadcasting", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "anti-portal-traps", true);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-brightness", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "brightness", 50);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-nametag-render-distance", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "nametag-render-distance", 64);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-max-chat-length", false);
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "max-chat-length", 256);
+ CONFIG_MODULE_PROPERTIES.put("tnt_countdown", "tnt-ticks", 80);
+ CONFIG_MODULE_PROPERTIES.put("waypoint", "server-handles-waypoints", false);
+}
+```
+
+Use the following methods to send packets either to a specific player or to all online players:
+
+```java
+public static void sendPacket(Player player, JsonObject message) {
+ player.sendPluginMessage(ApolloExamplePlugin.getPlugin(), "apollo:json", message.toString().getBytes());
+}
+
+public static void broadcastPacket(JsonObject message) {
+ byte[] data = message.toString().getBytes();
+
+ Bukkit.getOnlinePlayers().forEach(player ->
+ player.sendPluginMessage(ApolloExamplePlugin.getPlugin(), "apollo:json", data));
+}
+```
+
+To create a Module packet, which is used for enabling modules (with or without properties) and for dynamically updating Apollo Options for modules such as the `Mod Settings Module` and `Server Rule Module`, use the following method:
+
+```java
+public static JsonObject createEnableModuleObject(@NotNull String module, Map properties) {
+ JsonObject enableModuleObject = new JsonObject();
+ enableModuleObject.addProperty("apollo_module", module);
+ enableModuleObject.addProperty("enable", true);
+
+ if (properties != null) {
+ JsonObject propertiesObject = new JsonObject();
+ for (Map.Entry entry : properties.entrySet()) {
+ propertiesObject.add(entry.getKey(), JsonPacketUtil.convertToJsonElement(entry.getValue()));
+ }
+
+ enableModuleObject.add("properties", propertiesObject);
+ }
+
+ return enableModuleObject;
+}
+
+private static JsonElement convertToJsonElement(Object value) {
+ if (value == null) {
+ return JsonNull.INSTANCE;
+ } else if (value instanceof String) {
+ return new JsonPrimitive((String) value);
+ } else if (value instanceof Number) {
+ return new JsonPrimitive((Number) value);
+ } else if (value instanceof Boolean) {
+ return new JsonPrimitive((Boolean) value);
+ } else if (value instanceof List) {
+ JsonArray jsonArray = new JsonArray();
+ for (Object item : (List>) value) {
+ jsonArray.add(JsonPacketUtil.convertToJsonElement(item));
+ }
+ return jsonArray;
+ }
+
+ throw new RuntimeException("Unable to wrap value of type '" + value.getClass().getSimpleName() + "'!");
+}
+```
+
+Enable modules using the methods and fields defined above:
+
+```java
+public static void enableModules(Player player) {
+ JsonArray settings = APOLLO_MODULES.stream()
+ .map(module -> JsonPacketUtil.createEnableModuleObject(module, CONFIG_MODULE_PROPERTIES.row(module)))
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.configurable.v1.OverrideConfigurableSettingsMessage");
+ message.add("configurable_settings", settings);
+
+ JsonPacketUtil.sendPacket(player, message);
+}
+```
diff --git a/docs/developers/lightweight/json/player-detection.mdx b/docs/developers/lightweight/json/player-detection.mdx
new file mode 100644
index 00000000..ad182689
--- /dev/null
+++ b/docs/developers/lightweight/json/player-detection.mdx
@@ -0,0 +1,64 @@
+import { Callout } from 'nextra-theme-docs'
+
+# Player Detection
+
+## Overview
+
+This example demonstrates how to detect whether a player is using Lunar Client by listening for the `PlayerRegisterChannelEvent` on the `lunar:apollo` channel. Additionally, it showcases how to enable Apollo Modules using utility methods from [JsonPacketUtil](/apollo/developers/lightweight/json/packet-util)
+
+
+ Note that this method uses a different plugin channel for sending packets,
+ which is `apollo:json`, while still using the `lunar:apollo` for player detection.
+
+
+## Integration
+
+```java
+public class ApolloPlayerJsonListener implements Listener {
+
+ private final Set playersRunningApollo = new HashSet<>();
+
+ public ApolloPlayerJsonListener(ApolloExamplePlugin plugin) {
+ Messenger messenger = Bukkit.getServer().getMessenger();
+ messenger.registerIncomingPluginChannel(plugin, "lunar:apollo", (s, player, bytes) -> { });
+ messenger.registerIncomingPluginChannel(plugin, "apollo:json", (s, player, bytes) -> { });
+ messenger.registerOutgoingPluginChannel(plugin, "apollo:json");
+
+ Bukkit.getPluginManager().registerEvents(this, plugin);
+ }
+
+ private boolean isPlayerRunningApollo(Player player) {
+ return this.playersRunningApollo.contains(player.getUniqueId());
+ }
+
+ @EventHandler
+ private void onRegisterChannel(PlayerRegisterChannelEvent event) {
+ if (!event.getChannel().equalsIgnoreCase("lunar:apollo")) {
+ return;
+ }
+
+ JsonPacketUtil.enableModules(player);
+
+ // Sending the player's world name to the client is required for some modules
+ JsonPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player));
+
+ this.playersRunningApollo.add(player.getUniqueId());
+ player.sendMessage("You are using LunarClient!");
+ }
+
+ @EventHandler
+ private void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
+ Player player = event.getPlayer();
+
+ // Sending the player's world name to the client is required for some modules
+ JsonPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player));
+ }
+
+ private JsonObject createUpdatePlayerWorldMessage(Player player) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.player.v1.UpdatePlayerWorldMessage");
+ message.addProperty("world", player.getWorld().getName());
+ return message;
+ }
+}
+```
diff --git a/docs/developers/lightweight/protobuf/_meta.json b/docs/developers/lightweight/protobuf/_meta.json
new file mode 100644
index 00000000..83eb3d8b
--- /dev/null
+++ b/docs/developers/lightweight/protobuf/_meta.json
@@ -0,0 +1,9 @@
+{
+ "getting-started": "Getting Started",
+ "player-detection": "Player Detection",
+ "serverbound-packets": "Serverbound Packets",
+ "roundtrip-packets": "Roundtrip Packets",
+ "packet-util": "Packet Util",
+ "object-util": "Object Util",
+ "adventure-util": "Adventure Util"
+}
diff --git a/docs/developers/lightweight/protobuf/adventure-util.mdx b/docs/developers/lightweight/protobuf/adventure-util.mdx
new file mode 100644
index 00000000..2490a34b
--- /dev/null
+++ b/docs/developers/lightweight/protobuf/adventure-util.mdx
@@ -0,0 +1,13 @@
+# Adventure Util
+
+## Overview
+
+Provides a single method responsible for serializing the Adventure Component to a String
+
+## Integration
+
+```java
+public static String toJson(@NonNull Component component) {
+ return GsonComponentSerializer.gson().serialize(component);
+}
+```
diff --git a/docs/developers/lightweight/protobuf/getting-started.mdx b/docs/developers/lightweight/protobuf/getting-started.mdx
new file mode 100644
index 00000000..c06832c9
--- /dev/null
+++ b/docs/developers/lightweight/protobuf/getting-started.mdx
@@ -0,0 +1,74 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
+# Getting Started
+
+## Overview
+
+This guide will help you get started with the `apollo-protos` library, which is used to handle Apollo-related packets from Lunar Client in your Minecraft server. The `apollo-protos` library provides strong typing and schema validation for all Apollo messages, ensuring seamless communication between the client and the server.
+
+In this guide, you'll learn how to add the required repository and dependencies to your project. You'll also find links to various examples demonstrating how to integrate and work with Apollo packets, from detecting players using Lunar Client to handling advanced serverbound and roundtrip packets.
+
+Available fields for each message, including their types, are available on the Buf Schema Registry at https://buf.build/lunarclient/apollo.
+
+## Adding the repository and dependencies
+
+
+
+ ```xml filename="pom.xml"
+
+
+ lunarclient
+ https://repo.lunarclient.dev
+
+
+
+
+
+ com.lunarclient
+ apollo-protos
+ 1.0-SNAPSHOT
+
+
+ ```
+
+
+ ```groovy filename="build.gradle"
+ repositories {
+ maven {
+ name = 'lunarclient'
+ url = 'https://repo.lunarclient.dev'
+ }
+ }
+
+ dependencies {
+ api 'com.lunarclient:apollo-protos:1.0-SNAPSHOT'
+ }
+ ```
+
+
+ ```kotlin filename="build.gradle.kts"
+ repositories {
+ maven {
+ name = "lunarclient"
+ url = uri("https://repo.lunarclient.dev")
+ }
+ }
+
+ dependencies {
+ api("com.lunarclient:apollo-protos:1.0-SNAPSHOT")
+ }
+ ```
+
+
+
+## Integration Examples
+
+🔗 [Sending Apollo packets & Enabling Apollo modules](/apollo/developers/lightweight/protobuf/packet-util)
+🔗 [Detecting players using LunarClient](/apollo/developers/lightweight/protobuf/player-detection)
+🔗 [Common Apollo Objects](/apollo/developers/lightweight/protobuf/object-util)
+🔗 [Adventure Util](/apollo/developers/lightweight/protobuf/adventure-util)
+🔗 [Apollo Serverbound packets](/apollo/developers/lightweight/protobuf/serverbound-packets)
+🔗 [Apollo Roundtrip packets](/apollo/developers/lightweight/protobuf/roundtrip-packets)
+
+For examples of module integration, refer to the specific Module pages. Each page contains code samples under the `apollo-protos library` tab. For instance, you can find sample code for the `BorderModule` on its dedicated page [BorderModule](/apollo/developers/modules/border#sample-code) in the `Sample Code` section.
+
diff --git a/docs/developers/lightweight/protobuf/object-util.mdx b/docs/developers/lightweight/protobuf/object-util.mdx
new file mode 100644
index 00000000..51fb3278
--- /dev/null
+++ b/docs/developers/lightweight/protobuf/object-util.mdx
@@ -0,0 +1,126 @@
+# Protobuf Object Util
+
+## Overview
+
+These utilities facilitate the creation of Apollo objects, commonly used across various Apollo Modules. The utility methods are used for converting objects to and from their corresponding Protocol Buffers representations.
+
+## Integration
+
+```java
+public static UUID toJavaUuid(Uuid message) {
+ return new UUID(message.getHigh64(), message.getLow64());
+}
+
+public static long toJavaTimestamp(Timestamp message) {
+ return message.getSeconds() * 1000 + message.getNanos() / 1000000;
+}
+
+public static Uuid createUuidProto(UUID object) {
+ return Uuid.newBuilder()
+ .setHigh64(object.getMostSignificantBits())
+ .setLow64(object.getLeastSignificantBits())
+ .build();
+}
+
+public static com.lunarclient.apollo.common.v1.Color createColorProto(Color object) {
+ return com.lunarclient.apollo.common.v1.Color.newBuilder()
+ .setColor(object.getRGB())
+ .build();
+}
+
+public static com.google.protobuf.Duration createDurationProto(Duration object) {
+ return com.google.protobuf.Duration.newBuilder()
+ .setSeconds(object.getSeconds())
+ .setNanos(object.getNano())
+ .build();
+}
+
+public static Cuboid2D createCuboid2DProto(double minX, double minZ, double maxX, double maxZ) {
+ return Cuboid2D.newBuilder()
+ .setMinX(minX)
+ .setMinZ(minZ)
+ .setMaxX(maxX)
+ .setMaxZ(maxZ)
+ .build();
+}
+
+public static EntityId createEntityIdProto(int id, UUID uuid) {
+ return EntityId.newBuilder()
+ .setEntityId(id)
+ .setEntityUuid(ProtobufUtil.createUuidProto(uuid))
+ .build();
+}
+```
+
+Location-related methods
+
+```java
+public static com.lunarclient.apollo.common.v1.Location createLocationProto(Location location) {
+ return com.lunarclient.apollo.common.v1.Location.newBuilder()
+ .setWorld(location.getWorld().getName())
+ .setX(location.getX())
+ .setY(location.getY())
+ .setZ(location.getZ())
+ .build();
+}
+
+public static BlockLocation createBlockLocationProto(Location location) {
+ return BlockLocation.newBuilder()
+ .setWorld(location.getWorld().getName())
+ .setX(location.getBlockX())
+ .setY(location.getBlockY())
+ .setZ(location.getBlockZ())
+ .build();
+}
+
+public static Location toBukkitLocation(com.lunarclient.apollo.common.v1.Location message) {
+ return new Location(Bukkit.getWorld(message.getWorld()), message.getX(), message.getY(), message.getZ());
+}
+
+public static Location toBukkitLocation(com.lunarclient.apollo.common.v1.PlayerLocation message) {
+ Location location = ProtobufUtil.toBukkitLocation(message.getLocation());
+ location.setYaw(message.getYaw());
+ location.setPitch(message.getPitch());
+ return location;
+}
+```
+
+Icon-related methods
+
+```java
+public static Icon createItemStackIconProto(@Nullable String itemName, int itemId, int customModelData) {
+ ItemStackIcon.Builder iconBuilder = ItemStackIcon.newBuilder()
+ .setItemId(itemId)
+ .setCustomModelData(customModelData);
+
+ if (itemName != null) {
+ iconBuilder.setItemName(itemName);
+ }
+
+ return Icon.newBuilder().setItemStack(iconBuilder.build()).build();
+}
+
+public static Icon createSimpleResourceLocationIconProto(String resourceLocation, int size) {
+ SimpleResourceLocationIcon icon = SimpleResourceLocationIcon.newBuilder()
+ .setResourceLocation(resourceLocation)
+ .setSize(size)
+ .build();
+
+ return Icon.newBuilder().setSimpleResourceLocation(icon).build();
+}
+
+public static Icon createAdvancedResourceLocationIconProto(String resourceLocation, float width, float height,
+ float minU, float maxU, float minV, float maxV) {
+ AdvancedResourceLocationIcon icon = AdvancedResourceLocationIcon.newBuilder()
+ .setResourceLocation(resourceLocation)
+ .setWidth(width)
+ .setHeight(height)
+ .setMinU(minU)
+ .setMaxU(maxU)
+ .setMinV(minV)
+ .setMaxV(maxV)
+ .build();
+
+ return Icon.newBuilder().setAdvancedResourceLocation(icon).build();
+}
+```
diff --git a/docs/developers/lightweight/protobuf/packet-util.mdx b/docs/developers/lightweight/protobuf/packet-util.mdx
new file mode 100644
index 00000000..fcac5c9b
--- /dev/null
+++ b/docs/developers/lightweight/protobuf/packet-util.mdx
@@ -0,0 +1,105 @@
+import { Callout } from 'nextra-theme-docs'
+
+# Protobuf Packet Util
+
+## Overview
+
+These utilities are designed to handle packet transmission and creation for integrating and configuring Apollo modules with their respective properties. The utility class provides a list of most Apollo modules and their configuration options.
+
+The methods in this utility leverage the same plugin messaging channel as the Apollo API `lunar:apollo`.
+
+## Integration
+
+To utilize Apollo Modules, first define a list of the modules you want to use:
+
+```java
+private static final List APOLLO_MODULES = Arrays.asList("limb", "beam", "border", "chat", "colored_fire", "combat", "cooldown",
+ "entity", "glow", "hologram", "mod_setting", "nametag", "nick_hider", "notification", "packet_enrichment", "rich_presence",
+ "server_rule", "staff_mod", "stopwatch", "team", "title", "tnt_countdown", "transfer", "vignette", "waypoint"
+);
+```
+
+Next, specify the properties for these modules. These properties are included in the enable module packet. When using the Apollo plugin, this corresponds to modifying the `config.yml`
+
+
+ The example below does not encompass all available options and may not be up-to-date.
+ For the latest options, refer to the module documentation ([example](/apollo/developers/modules/serverrule#available-options)).
+
+
+```java
+// Module Id -> Option key -> Value
+private static final Table CONFIG_MODULE_PROPERTIES = HashBasedTable.create();
+
+static {
+ CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "competitive-game", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "competitive-commands", Value.newBuilder().setListValue(
+ ListValue.newBuilder().addAllValues(Arrays.asList(
+ Value.newBuilder().setStringValue("/server").build(),
+ Value.newBuilder().setStringValue("/servers").build(),
+ Value.newBuilder().setStringValue("/hub").build()))
+ .build()
+ ).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-shaders", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-chunk-reloading", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "disable-broadcasting", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "anti-portal-traps", Value.newBuilder().setBoolValue(true).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-brightness", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "brightness", Value.newBuilder().setNumberValue(50).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-nametag-render-distance", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "nametag-render-distance", Value.newBuilder().setNumberValue(64).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "override-max-chat-length", Value.newBuilder().setBoolValue(false).build());
+ CONFIG_MODULE_PROPERTIES.put("server_rule", "max-chat-length", Value.newBuilder().setNumberValue(256).build());
+ CONFIG_MODULE_PROPERTIES.put("tnt_countdown", "tnt-ticks", Value.newBuilder().setNumberValue(80).build());
+ CONFIG_MODULE_PROPERTIES.put("waypoint", "server-handles-waypoints", Value.newBuilder().setBoolValue(false).build());
+}
+```
+
+Use the following methods to send packets either to a specific player or to all online players:
+
+```java
+public static void sendPacket(Player player, GeneratedMessageV3 message) {
+ byte[] bytes = Any.pack(message).toByteArray();
+ player.sendPluginMessage(ApolloExamplePlugin.getPlugin(), "lunar:apollo", bytes);
+}
+
+public static void broadcastPacket(GeneratedMessageV3 message) {
+ byte[] bytes = Any.pack(message).toByteArray();
+
+ Bukkit.getOnlinePlayers().forEach(player ->
+ player.sendPluginMessage(ApolloExamplePlugin.getPlugin(), "lunar:apollo", bytes));
+}
+```
+
+To create a Module packet, which is used for enabling modules (with or without properties) and for dynamically updating Apollo Options for modules such as the `Mod Settings Module` and `Server Rule Module`, use the following method:
+
+```java
+public static ConfigurableSettings createModuleMessage(String module, Map properties) {
+ ConfigurableSettings.Builder moduleBuilder = ConfigurableSettings.newBuilder()
+ .setApolloModule(module)
+ .setEnable(true);
+
+ if (properties != null) {
+ moduleBuilder.putAllProperties(properties);
+ }
+
+ return moduleBuilder.build();
+}
+```
+
+Enable modules using the methods and fields defined above:
+
+```java
+public static void enableModules(Player player) {
+ List settings = APOLLO_MODULES.stream()
+ .map(module -> createModuleMessage(module, CONFIG_MODULE_PROPERTIES.row(module)))
+ .collect(Collectors.toList());
+
+ OverrideConfigurableSettingsMessage message = OverrideConfigurableSettingsMessage
+ .newBuilder()
+ .addAllConfigurableSettings(settings)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(player, message);
+}
+```
diff --git a/docs/developers/lightweight/protobuf/player-detection.mdx b/docs/developers/lightweight/protobuf/player-detection.mdx
new file mode 100644
index 00000000..12d59a6a
--- /dev/null
+++ b/docs/developers/lightweight/protobuf/player-detection.mdx
@@ -0,0 +1,53 @@
+# Player Detection
+
+## Overview
+
+This example demonstrates how to detect whether a player is using Lunar Client by listening for the `PlayerRegisterChannelEvent` on the `lunar:apollo` channel. Additionally, it showcases how to enable Apollo Modules using utility methods from [ProtobufPacketUtil](/apollo/developers/lightweight/protobuf/packet-util)
+
+## Integration
+
+```java
+public class ApolloPlayerProtoListener implements Listener {
+
+ private final Set playersRunningApollo = new HashSet<>();
+
+ public ApolloPlayerProtoListener(ApolloExamplePlugin plugin) {
+ Bukkit.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "lunar:apollo");
+ Bukkit.getServer().getMessenger().registerIncomingPluginChannel(plugin, "lunar:apollo", (s, player, bytes) -> { });
+ Bukkit.getPluginManager().registerEvents(this, plugin);
+ }
+
+ private boolean isPlayerRunningApollo(Player player) {
+ return this.playersRunningApollo.contains(player.getUniqueId());
+ }
+
+ @EventHandler
+ private void onRegisterChannel(PlayerRegisterChannelEvent event) {
+ if (!event.getChannel().equalsIgnoreCase("lunar:apollo")) {
+ return;
+ }
+
+ ProtobufPacketUtil.enableModules(player);
+
+ // Sending the player's world name to the client is required for some modules
+ ProtobufPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player));
+
+ this.playersRunningApollo.add(player.getUniqueId());
+ player.sendMessage("You are using LunarClient!");
+ }
+
+ @EventHandler
+ private void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
+ Player player = event.getPlayer();
+
+ // Sending the player's world name to the client is required for some modules
+ ProtobufPacketUtil.sendPacket(player, this.createUpdatePlayerWorldMessage(player));
+ }
+
+ private UpdatePlayerWorldMessage createUpdatePlayerWorldMessage(Player player) {
+ return UpdatePlayerWorldMessage.newBuilder()
+ .setWorld(player.getWorld().getName())
+ .build();
+ }
+}
+```
diff --git a/docs/developers/lightweight/protobuf/roundtrip-packets.mdx b/docs/developers/lightweight/protobuf/roundtrip-packets.mdx
new file mode 100644
index 00000000..0bc35d0b
--- /dev/null
+++ b/docs/developers/lightweight/protobuf/roundtrip-packets.mdx
@@ -0,0 +1,111 @@
+# Roundtrip Packets
+
+## Overview
+
+This example demonstrates how to handle roundtrip packets between the server and the Lunar Client. These packets are sent from the server, expecting a corresponding response from the client. The example utilizes a map to track the requests and their corresponding responses. For instance, this pattern is common in modules like `TransferModule` where a request packet is sent and a response is awaited.
+
+## Integration
+
+```java
+public class ApolloRoundtripProtoListener implements PluginMessageListener {
+
+ @Getter
+ private static ApolloRoundtripProtoListener instance;
+
+ private final Map>> roundTripPacketFutures = new ConcurrentHashMap<>();
+ private final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
+
+ public ApolloRoundtripProtoListener(ApolloExamplePlugin plugin) {
+ instance = this;
+ Bukkit.getServer().getMessenger().registerIncomingPluginChannel(plugin, "lunar:apollo", this);
+ }
+
+ @Override
+ public void onPluginMessageReceived(String s, Player player, byte[] bytes) {
+ try {
+ Any any = Any.parseFrom(bytes);
+
+ if (any.is(PingResponse.class)) {
+ PingResponse message = any.unpack(PingResponse.class);
+ UUID requestId = UUID.fromString(message.getRequestId().toStringUtf8());
+ this.handleResponse(player, requestId, message);
+ } else if (any.is(TransferResponse.class)) {
+ TransferResponse message = any.unpack(TransferResponse.class);
+ UUID requestId = UUID.fromString(message.getRequestId().toStringUtf8());
+ this.handleResponse(player, requestId, message);
+ }
+
+ } catch (InvalidProtocolBufferException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public CompletableFuture sendRequest(Player player, UUID requestId,
+ GeneratedMessageV3 request,
+ Class responseType) {
+ ProtobufPacketUtil.sendPacket(player, request);
+
+ CompletableFuture future = new CompletableFuture<>();
+
+ this.roundTripPacketFutures
+ .computeIfAbsent(player.getUniqueId(), k -> new ConcurrentHashMap<>())
+ .put(requestId, (CompletableFuture) future);
+
+ ScheduledFuture> timeoutTask = this.executorService.schedule(() ->
+ future.completeExceptionally(new TimeoutException("Response timed out")),
+ 10, TimeUnit.SECONDS
+ );
+
+ future.whenComplete((result, throwable) -> timeoutTask.cancel(false));
+ return future;
+ }
+
+ private void handleResponse(Player player, UUID requestId, T message) {
+ Map> futures = this.roundTripPacketFutures.get(player.getUniqueId());
+ if (futures == null) {
+ return;
+ }
+
+ CompletableFuture future = futures.remove(requestId);
+ if (future != null) {
+ future.complete(message);
+ }
+ }
+}
+```
+
+Here's an example demonstrating how to use the code to handle a server-to-client `TransferModule` transfer, where the client responds with a status (`accepted` or `rejected`).
+
+```java
+public void transferExample(Player player) {
+ UUID requestId = UUID.randomUUID();
+
+ TransferRequest transferRequestMessage = TransferRequest.newBuilder()
+ .setRequestId(ByteString.copyFromUtf8(requestId.toString()))
+ .setServerIp("mc.hypixel.net")
+ .build();
+
+ ApolloRoundtripProtoListener.getInstance()
+ .sendRequest(player, requestId, transferRequestMessage, TransferResponse.class)
+ .thenAccept(response -> {
+ String message = "";
+
+ switch (response.getStatus()) {
+ case STATUS_ACCEPTED: {
+ message = "Transfer accepted! Goodbye!";
+ break;
+ }
+
+ case STATUS_REJECTED: {
+ message = "Transfer rejected by client!";
+ break;
+ }
+ }
+
+ player.sendMessage(message);
+ }).exceptionally(throwable -> {
+ player.sendMessage("Failed to receive a response in time.");
+ return null;
+ });
+}
+```
diff --git a/docs/developers/lightweight/protobuf/serverbound-packets.mdx b/docs/developers/lightweight/protobuf/serverbound-packets.mdx
new file mode 100644
index 00000000..c7dc9ab3
--- /dev/null
+++ b/docs/developers/lightweight/protobuf/serverbound-packets.mdx
@@ -0,0 +1,102 @@
+# Serverbound Packets
+
+## Overview
+
+Players using Lunar Client may send packets to the server for specific Apollo modules, such as the `PacketEnrichment Module` and/or when the player is joining the server. This example demonstrates how to handle packets sent from the client that are related to Apollo.
+
+Additionally, the `Transfer Module` expects a response packet from the client after the server sends a request. For an example of how to handle roundtrip packets, visit [Packet Roundtrip Example](/apollo/developers/lightweight/protobuf/roundtrip-packets)
+
+## Integration
+
+```java
+public class ApolloPacketReceiveProtoListener implements PluginMessageListener {
+
+ public ApolloPacketReceiveProtoListener(ApolloExamplePlugin plugin) {
+ Bukkit.getServer().getMessenger().registerIncomingPluginChannel(plugin, "lunar:apollo", this);
+ }
+
+ @Override
+ public void onPluginMessageReceived(String s, Player player, byte[] bytes) {
+ try {
+ Any any = Any.parseFrom(bytes);
+
+ if (any.is(PlayerHandshakeMessage.class)) {
+ this.onPlayerHandshake(any.unpack(PlayerHandshakeMessage.class));
+ }
+
+ // Packet Enrichment Module
+ if (any.is(PlayerAttackMessage.class)) {
+ this.onPlayerAttack(any.unpack(PlayerAttackMessage.class));
+ } else if (any.is(PlayerChatOpenMessage.class)) {
+ this.onPlayerChatOpen(any.unpack(PlayerChatOpenMessage.class));
+ } else if (any.is(PlayerChatCloseMessage.class)) {
+ this.onPlayerChatClose(any.unpack(PlayerChatCloseMessage.class));
+ } else if (any.is(PlayerUseItemMessage.class)) {
+ this.onPlayerUseItem(any.unpack(PlayerUseItemMessage.class));
+ }
+ } catch (InvalidProtocolBufferException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void onPlayerHandshake(PlayerHandshakeMessage message) {
+ MinecraftVersion minecraftVersion = message.getMinecraftVersion();
+
+ LunarClientVersion lunarClientVersion = message.getLunarClientVersion();
+ String gitBranch = lunarClientVersion.getGitBranch();
+ String gitCommit = lunarClientVersion.getGitCommit();
+ String semVer = lunarClientVersion.getSemver();
+
+ List installedMods = message.getInstalledModsList();
+ for (ModMessage mod : installedMods) {
+ String modId = mod.getId();
+ String displayName = mod.getName();
+ String version = mod.getVersion();
+ ModMessage.Type type = mod.getType();
+ }
+ }
+
+ private void onPlayerAttack(PlayerAttackMessage message) {
+ long instantiationTimeMs = ProtobufUtil.toJavaTimestamp(message.getPacketInfo().getInstantiationTime());
+
+ PlayerInfo targetInfo = message.getTargetInfo();
+ PlayerInfo attackerInfo = message.getAttackerInfo();
+
+ this.onPlayerInfo(targetInfo);
+ this.onPlayerInfo(attackerInfo);
+ }
+
+ private void onPlayerChatOpen(PlayerChatOpenMessage message) {
+ long instantiationTimeMs = ProtobufUtil.toJavaTimestamp(message.getPacketInfo().getInstantiationTime());
+
+ PlayerInfo playerInfo = message.getPlayerInfo();
+ this.onPlayerInfo(playerInfo);
+ }
+
+ private void onPlayerChatClose(PlayerChatCloseMessage message) {
+ long instantiationTimeMs = ProtobufUtil.toJavaTimestamp(message.getPacketInfo().getInstantiationTime());
+
+ PlayerInfo playerInfo = message.getPlayerInfo();
+ this.onPlayerInfo(playerInfo);
+ }
+
+ private void onPlayerUseItem(PlayerUseItemMessage message) {
+ long instantiationTimeMs = ProtobufUtil.toJavaTimestamp(message.getPacketInfo().getInstantiationTime());
+
+ PlayerInfo playerInfo = message.getPlayerInfo();
+ this.onPlayerInfo(playerInfo);
+
+ boolean mainHand = message.getMainHand();
+ }
+
+ private void onPlayerInfo(PlayerInfo info) {
+ UUID uuid = ProtobufUtil.toJavaUuid(info.getPlayerUuid());
+ Location location = ProtobufUtil.toBukkitLocation(info.getLocation());
+ boolean sneaking = info.getSneaking();
+ boolean sprinting = info.getSprinting();
+ boolean jumping = info.getJumping();
+ float forwardSpeed = info.getForwardSpeed();
+ float strafeSpeed = info.getStrafeSpeed();
+ }
+}
+```
diff --git a/docs/developers/modules/beam.mdx b/docs/developers/modules/beam.mdx
index fd2b8b02..75a4e4c8 100644
--- a/docs/developers/modules/beam.mdx
+++ b/docs/developers/modules/beam.mdx
@@ -20,8 +20,16 @@ The beam module allows you to create custom beams resembling beacon beams, which
## Integration
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
### Sample Code
+
+
+
+
+### Displaying a Beam
+
```java
public void displayBeamExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -43,6 +51,24 @@ public void displayBeamExample(Player viewer) {
}
```
+### Removing a Beam
+
+```java
+public void removeBeamExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(apolloPlayer -> this.beamModule.removeBeam(apolloPlayer, "spawn-beacon"));
+}
+```
+
+### Resetting all Beams
+
+```java
+public void resetBeamsExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.beamModule::resetBeams);
+}
+```
+
### `Beam` Options
`.id(String)` should include a unique identifier for the beam.
@@ -99,20 +125,90 @@ Custom colors can be created from any RGB values using `new Color(int red, int g
)
```
-### Removing a specific beam for a player
+
+
+
+
+### Displaying a Beam
+
+```java
+public void displayBeamExample(Player viewer) {
+ DisplayBeaconBeamMessage message = DisplayBeaconBeamMessage.newBuilder()
+ .setId("spawn-beacon")
+ .setColor(ProtobufUtil.createColorProto(Color.CYAN))
+ .setLocation(ProtobufUtil.createBlockLocationProto(new Location(viewer.getWorld(), 0, 60, 0)))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Removing a Beam
```java
public void removeBeamExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(apolloPlayer -> this.beamModule.removeBeam(apolloPlayer, "spawn-beacon"));
+ RemoveBeaconBeamMessage message = RemoveBeaconBeamMessage.newBuilder()
+ .setId("spawn-beacon")
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
}
```
-### Resetting all beams for a player
+### Resetting all Beams
```java
public void resetBeamsExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(this.beamModule::resetBeams);
+ ResetBeaconBeamsMessage message = ResetBeaconBeamsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
}
```
+
+
+
+
+
+### Displaying a Beam
+
+```java
+public void displayBeamExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.beam.v1.DisplayBeaconBeamMessage");
+ message.addProperty("id", "spawn-beacon");
+ message.add("location", JsonUtil.createBlockLocationObject(
+ new Location(Bukkit.getWorld("world"), 0, 60, 0)
+ ));
+ message.add("color", JsonUtil.createColorObject(Color.CYAN));
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Removing a Beam
+
+```java
+public void removeBeamExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.beam.v1.RemoveBeaconBeamMessage");
+ message.addProperty("id", "spawn-beacon");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Resetting all Beams
+
+```java
+public void resetBeamsExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.beam.v1.ResetBeaconBeamsMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+
diff --git a/docs/developers/modules/border.mdx b/docs/developers/modules/border.mdx
index 681e5c87..98f70da1 100644
--- a/docs/developers/modules/border.mdx
+++ b/docs/developers/modules/border.mdx
@@ -15,6 +15,13 @@ The border module not only enhances Minecraft's current world border system, but
## Integration
### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Displaying a Border
```java
public void displayBorderExample(Player viewer) {
@@ -42,6 +49,24 @@ public void displayBorderExample(Player viewer) {
}
```
+### Removing a Border
+
+```java
+public void removeBorderExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(apolloPlayer -> this.borderModule.removeBorder(apolloPlayer, "pvp-tagged-spawn"));
+}
+```
+
+### Resetting all Borders
+
+```java
+public void resetBordersExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.borderModule::resetBorders);
+}
+```
+
### `Border` Options
`.id(String)` should include a unique identifier for the border. It's important when you have multiple borders in a single world.
@@ -128,20 +153,96 @@ Custom colors can be created from any RGB values using `new Color(int red, int g
.durationTicks(0)
```
-### Removing a specific border for a player
+
+
+
+
+### Displaying a Border
+
+```java
+public void displayBorderExample(Player viewer) {
+ DisplayBorderMessage message = DisplayBorderMessage.newBuilder()
+ .setId("pvp-tagged-spawn")
+ .setWorld("world")
+ .setCancelEntry(true)
+ .setCancelExit(true)
+ .setCanShrinkOrExpand(false)
+ .setColor(ProtobufUtil.createColorProto(Color.RED))
+ .setBounds(ProtobufUtil.createCuboid2DProto(-50, -50, 50, 50))
+ .setDurationTicks(1000)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Removing a Border
```java
public void removeBorderExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(apolloPlayer -> this.borderModule.removeBorder(apolloPlayer, "pvp-tagged-spawn"));
+ RemoveBorderMessage message = RemoveBorderMessage.newBuilder()
+ .setId("pvp-tagged-spawn")
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
}
```
-### Resetting all borders for a player
+### Resetting all Borders
```java
public void resetBordersExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(this.borderModule::resetBorders);
+ ResetBordersMessage message = ResetBordersMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+### Displaying a Border
+
+```java
+public void displayBorderExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.border.v1.DisplayBorderMessage");
+ message.addProperty("id", "pvp-tagged-spawn");
+ message.addProperty("world", "world");
+ message.addProperty("cancel_entry", true);
+ message.addProperty("cancel_exit", true);
+ message.addProperty("can_shrink_or_expand", false);
+ message.add("color", JsonUtil.createColorObject(Color.RED));
+ message.add("bounds", JsonUtil.createCuboid2DObject(-50, -50, 50, 50));
+ message.addProperty("duration_ticks", 1000);
+
+ JsonPacketUtil.sendPacket(viewer, message);
}
```
+
+### Removing a Border
+
+```java
+public void removeBorderExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.border.v1.RemoveBorderMessage");
+ message.addProperty("id", "pvp-tagged-spawn");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Resetting all Borders
+
+```java
+public void resetBordersExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.border.v1.ResetBordersMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/chat.mdx b/docs/developers/modules/chat.mdx
index 99469f23..b73d70c4 100644
--- a/docs/developers/modules/chat.mdx
+++ b/docs/developers/modules/chat.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Chat Module
## Overview
@@ -15,15 +17,23 @@ The chat module allows you to interact with and modify users chat feeds.
## Integration
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Displaying a Live Chat Message
+
```java
-private final int messageId = ThreadLocalRandom.current().nextInt(100);
private int countdown = 5;
-public void displayLiveMessageExample() {
+public void displayLiveChatMessageExample() {
this.chatModule.displayLiveChatMessage(Recipients.ofEveryone(),
Component.text("Game starting in ", NamedTextColor.GREEN)
.append(Component.text(this.countdown, NamedTextColor.BLUE)),
- this.messageId
+ 13
);
if (--this.countdown == 0) {
@@ -32,10 +42,91 @@ public void displayLiveMessageExample() {
}
```
-### Removing a specific live message for a player
+### Removing a Live Chat Message
```java
-public void removeLiveMessageExample() {
- this.chatModule.removeLiveChatMessage(Recipients.ofEveryone(), this.messageId);
+public void removeLiveChatMessageExample() {
+ this.chatModule.removeLiveChatMessage(Recipients.ofEveryone(), 13);
+}
+```
+
+
+
+
+
+### Displaying a Live Chat Message
+
+```java
+private int countdown = 5;
+
+public void displayLiveChatMessageExample() {
+ DisplayLiveChatMessageMessage message = DisplayLiveChatMessageMessage.newBuilder()
+ .setAdventureJsonLines(AdventureUtil.toJson(
+ Component.text("Game starting in ", NamedTextColor.GREEN)
+ .append(Component.text(this.countdown, NamedTextColor.BLUE)))
+ )
+ .setMessageId(13)
+ .build();
+
+ if (--this.countdown == 0) {
+ this.countdown = 5;
+ }
+
+ ProtobufPacketUtil.broadcastPacket(message);
+}
+```
+
+### Removing a Live Chat Message
+
+```java
+public void removeLiveChatMessageExample() {
+ RemoveLiveChatMessageMessage message = RemoveLiveChatMessageMessage.newBuilder()
+ .setMessageId(13)
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
}
```
+
+
+
+
+
+### Displaying a Live Chat Message
+
+```java
+private int countdown = 5;
+
+public void displayLiveChatMessageExample() {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.chat.v1.DisplayLiveChatMessageMessage");
+ message.addProperty("message_id", 13);
+ message.addProperty("adventure_json_lines", AdventureUtil.toJson(
+ Component.text("Game starting in ", NamedTextColor.GREEN)
+ .append(Component.text(this.countdown, NamedTextColor.BLUE))
+ ));
+
+ if (--this.countdown == 0) {
+ this.countdown = 5;
+ }
+
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+### Removing a Live Chat Message
+
+```java
+public void removeLiveChatMessageExample() {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.chat.v1.RemoveLiveChatMessageMessage");
+ message.addProperty("message_id", 13);
+
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+
+
+
+
diff --git a/docs/developers/modules/coloredfire.mdx b/docs/developers/modules/coloredfire.mdx
index fb49e213..5a70cbaf 100644
--- a/docs/developers/modules/coloredfire.mdx
+++ b/docs/developers/modules/coloredfire.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Colored Fire Module
## Overview
@@ -13,6 +15,13 @@ The colored fire module allows you to modify the color of the flames that appear
## Integration
### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Override a Fire Color
```java
public void overrideColoredFireExample(UUID burningPlayer) {
@@ -23,6 +32,23 @@ public void overrideColoredFireExample(UUID burningPlayer) {
}
```
+### Removing a Fire Color
+
+```java
+public void resetColoredFireExample(UUID burningPlayer) {
+ this.coloredFireModule.resetColoredFire(Recipients.ofEveryone(), burningPlayer);
+}
+```
+
+### Resetting all Fire Colors
+
+```java
+public void resetColoredFiresExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.coloredFireModule::resetColoredFires);
+}
+```
+
### `overrideColoredFire` Parameters
1. `Recipients recipients`
@@ -32,19 +58,84 @@ public void overrideColoredFireExample(UUID burningPlayer) {
3. `Color flameColor`
- How you'll dictate the color of the fire, see the [colors page](/apollo/developers/utilities/colors) for more.
-### Removing a specific targets colored fire for viewers
+
+
+
+
+### Override a Fire Color
+
+```java
+public void overrideColoredFireExample(UUID burningPlayer) {
+ OverrideColoredFireMessage message = OverrideColoredFireMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(burningPlayer))
+ .setColor(ProtobufUtil.createColorProto(Color.BLUE))
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+}
+```
+
+### Removing a Fire Color
```java
public void resetColoredFireExample(UUID burningPlayer) {
- this.coloredFireModule.resetColoredFire(Recipients.ofEveryone(), burningPlayer);
+ ResetColoredFireMessage message = ResetColoredFireMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(burningPlayer))
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
}
```
-### Resetting all colored fires for all viewers
+### Resetting all Fire Colors
```java
public void resetColoredFiresExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(this.coloredFireModule::resetColoredFires);
+ ResetColoredFiresMessage message = ResetColoredFiresMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+### Override a Fire Color
+
+```java
+public void overrideColoredFireExample(UUID burningPlayer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.coloredfire.v1.OverrideColoredFireMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(burningPlayer));
+ message.add("color", JsonUtil.createColorObject(Color.BLUE));
+
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+### Removing a Fire Color
+
+```java
+public void resetColoredFireExample(UUID burningPlayer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.coloredfire.v1.ResetColoredFireMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(burningPlayer));
+
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+### Resetting all Fire Colors
+
+```java
+public void resetColoredFiresExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.coloredfire.v1.ResetColoredFiresMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
}
```
+
+
+
+
diff --git a/docs/developers/modules/cooldown.mdx b/docs/developers/modules/cooldown.mdx
index eb7fe96c..e0bf5edc 100644
--- a/docs/developers/modules/cooldown.mdx
+++ b/docs/developers/modules/cooldown.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Cooldown Module
## Overview
@@ -17,6 +19,13 @@ Apollo's cooldown module allows servers to interact with the Cooldown mod found
## Integration
### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Displaying a Cooldown with an item
```java
public void displayCooldownItemExample(Player viewer) {
@@ -34,7 +43,11 @@ public void displayCooldownItemExample(Player viewer) {
);
});
}
+```
+
+### Displaying a Cooldown with a resource
+```java
public void displayCooldownResourceExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -53,6 +66,28 @@ public void displayCooldownResourceExample(Player viewer) {
}
```
+### Removing a Cooldown
+
+```java
+public void removeCooldownExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+
+ apolloPlayerOpt.ifPresent(apolloPlayer -> {
+ this.cooldownModule.removeCooldown(apolloPlayer, "enderpearl-cooldown");
+ this.cooldownModule.removeCooldown(apolloPlayer, "lunar-cooldown");
+ });
+}
+```
+
+### Resetting all Cooldowns
+
+```java
+public void resetCooldownsExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.cooldownModule::resetCooldowns);
+}
+```
+
### `Cooldown` Options
`.name(String)` should include a unique identifier for the each cooldown.
@@ -75,24 +110,114 @@ public void displayCooldownResourceExample(Player viewer) {
.icon(SimpleResourceLocationIcon.builder().resourceLocation("lunar:logo/logo-200x182.svg").size(12).build())
```
-### Removing a specific cooldown for a player
+
+
+
+
+### Displaying a Cooldown with an item
+
+```java
+public void displayCooldownItemExample(Player viewer) {
+ DisplayCooldownMessage message = DisplayCooldownMessage.newBuilder()
+ .setName("enderpearl-cooldown")
+ .setDuration(ProtobufUtil.createDurationProto(Duration.ofSeconds(15)))
+ .setIcon(ProtobufUtil.createItemStackIconProto("ENDER_PEARL", 0, 0))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Displaying a Cooldown with a resource
+
+```java
+public void displayCooldownResourceExample(Player viewer) {
+ DisplayCooldownMessage message = DisplayCooldownMessage.newBuilder()
+ .setName("lunar-cooldown")
+ .setDuration(ProtobufUtil.createDurationProto(Duration.ofSeconds(15)))
+ .setIcon(ProtobufUtil.createSimpleResourceLocationIconProto("lunar:logo/logo-200x182.svg", 12))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Removing a Cooldown
```java
public void removeCooldownExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ RemoveCooldownMessage enderpearlMessage = RemoveCooldownMessage.newBuilder()
+ .setName("enderpearl-cooldown")
+ .build();
- apolloPlayerOpt.ifPresent(apolloPlayer -> {
- this.cooldownModule.removeCooldown(apolloPlayer, "enderpearl-cooldown");
- this.cooldownModule.removeCooldown(apolloPlayer, "lunar-cooldown");
- });
+ ProtobufPacketUtil.sendPacket(viewer, enderpearlMessage);
}
```
-### Resetting all cooldowns for a player
+### Resetting all Cooldowns
```java
public void resetCooldownsExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(this.cooldownModule::resetCooldowns);
+ ResetCooldownsMessage message = ResetCooldownsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
}
```
+
+
+
+
+
+### Displaying a Cooldown with an item
+
+```java
+public void displayCooldownItemExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.cooldown.v1.DisplayCooldownMessage");
+ message.addProperty("name", "enderpearl-cooldown");
+ message.addProperty("duration", JsonUtil.createDurationObject(Duration.ofSeconds(15)));
+ message.add("icon", JsonUtil.createItemStackIconObject("ENDER_PEARL", 0, 0));
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Displaying a Cooldown with a resource
+
+```java
+public void displayCooldownResourceExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.cooldown.v1.DisplayCooldownMessage");
+ message.addProperty("name", "lunar-cooldown");
+ message.addProperty("duration", JsonUtil.createDurationObject(Duration.ofSeconds(15)));
+ message.add("icon", JsonUtil.createSimpleResourceLocationIconObject("lunar:logo/logo-200x182.svg", 12));
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Removing a Cooldown
+
+```java
+public void removeCooldownExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.cooldown.v1.RemoveCooldownMessage");
+ message.addProperty("name", "enderpearl-cooldown");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Resetting all Cooldowns
+
+```java
+public void resetCooldownsExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.cooldown.v1.ResetCooldownsMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/entity.mdx b/docs/developers/modules/entity.mdx
index 19fb8e2f..6ca479ba 100644
--- a/docs/developers/modules/entity.mdx
+++ b/docs/developers/modules/entity.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Entity Module
## Overview
@@ -9,7 +11,14 @@ The entity module allows you to interact with entities client-sided.
## Integration
-### Override rainbow sheep for a player
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Override Sheep rainbow state
```java
public void overrideRainbowSheepExample(Player viewer) {
@@ -25,14 +34,7 @@ public void overrideRainbowSheepExample(Player viewer) {
}
```
-#### `overrideRainbowSheep` Parameters
-
-1. `ApolloPlayer Viewer`
- - The player you want to view the rainbow sheep.
-2. `List sheepEntities`
- - A list of all sheep entities you want to be rainbow.
-
-#### Resetting rainbow sheep for a player
+### Reset Sheep rainbow state
```java
public void resetRainbowSheepExample(Player viewer) {
@@ -44,19 +46,12 @@ public void resetRainbowSheepExample(Player viewer) {
.stream().map(sheep -> new ApolloEntity(sheep.getEntityId(), sheep.getUniqueId()))
.collect(Collectors.toList());
- this.entityModule.overrideRainbowSheep(apolloPlayer, sheepEntities);
+ this.entityModule.resetRainbowSheep(apolloPlayer, sheepEntities);
});
}
```
-#### `resetRainbowSheep` Parameters
-
-1. `ApolloPlayer Viewer`
- - The player you want to reset the rainbow sheep for.
-2. `List sheepEntities`
- - A list of all sheep entities you want to remove the rainbow state from.
-
-### Flip entities for a player
+### Override Entity flip state
```java
public void flipEntityExample(Player viewer) {
@@ -75,14 +70,7 @@ public void flipEntityExample(Player viewer) {
}
```
-#### `flipEntity` Parameters
-
-1. `ApolloPlayer Viewer`
- - The player you want to see the flipped entity.
-2. `List entities`
- - A list of all entities you want to flip.
-
-#### Resetting flipped entities for a player
+### Reset Entity flip state
```java
public void resetFlippedEntityExample(Player viewer) {
@@ -101,9 +89,157 @@ public void resetFlippedEntityExample(Player viewer) {
}
```
-#### `resetFlippedEntity` Parameters
+#### `overrideRainbowSheep`, `resetRainbowSheep`, `flipEntity` & `resetFlippedEntity` Parameters
-1. `ApolloPlayer Viewer`
- - The player you want to reset the flipped entity for.
+1. `Recipients recipients`
+ - A list of all the player(s) you want to be able to see the updated entities.
2. `List entities`
- - A list of all entities you want to reset the flip state from.
+ - A list of all entities you want to reset the flip or colored sheep state from.
+
+
+
+
+
+### Override Sheep rainbow state
+
+```java
+public void overrideRainbowSheepExample(Player viewer) {
+ Set sheepUuidsProto = viewer.getWorld().getEntitiesByClass(Sheep.class).stream()
+ .map(sheep -> ProtobufUtil.createEntityIdProto(sheep.getEntityId(), sheep.getUniqueId()))
+ .collect(Collectors.toSet());
+
+ OverrideRainbowSheepMessage message = OverrideRainbowSheepMessage.newBuilder()
+ .addAllEntityIds(sheepUuidsProto)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Sheep rainbow state
+
+```java
+public void resetRainbowSheepExample(Player viewer) {
+ Set sheepUuidsProto = viewer.getWorld().getEntitiesByClass(Sheep.class).stream()
+ .map(sheep -> ProtobufUtil.createEntityIdProto(sheep.getEntityId(), sheep.getUniqueId()))
+ .collect(Collectors.toSet());
+
+ ResetRainbowSheepMessage message = ResetRainbowSheepMessage.newBuilder()
+ .addAllEntityIds(sheepUuidsProto)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Override Entity flip state
+
+```java
+public void flipEntityExample(Player viewer) {
+ Set entityUuidsProto = viewer.getWorld()
+ .getNearbyEntities(viewer.getLocation(), 10, 10, 10)
+ .stream().filter(entity -> entity instanceof Cow)
+ .map(sheep -> ProtobufUtil.createEntityIdProto(sheep.getEntityId(), sheep.getUniqueId()))
+ .collect(Collectors.toSet());
+
+ FlipEntityMessage message = FlipEntityMessage.newBuilder()
+ .addAllEntityIds(entityUuidsProto)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Entity flip state
+
+```java
+public void resetFlippedEntityExample(Player viewer) {
+ Set entityUuidsProto = viewer.getWorld()
+ .getNearbyEntities(viewer.getLocation(), 10, 10, 10)
+ .stream().filter(entity -> entity instanceof Cow)
+ .map(sheep -> ProtobufUtil.createEntityIdProto(sheep.getEntityId(), sheep.getUniqueId()))
+ .collect(Collectors.toSet());
+
+ ResetFlipedEntityMessage message = ResetFlipedEntityMessage.newBuilder()
+ .addAllEntityIds(entityUuidsProto)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+### Override Sheep rainbow state
+
+```java
+public void overrideRainbowSheepExample(Player viewer) {
+ JsonArray entityIds = viewer.getWorld().getEntitiesByClass(Sheep.class).stream()
+ .map(JsonUtil::createEntityIdObject)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.entity.v1.OverrideRainbowSheepMessage");
+ message.add("entity_ids", entityIds);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Sheep rainbow state
+
+```java
+public void resetRainbowSheepExample(Player viewer) {
+ JsonArray entityIds = viewer.getWorld().getEntitiesByClass(Sheep.class).stream()
+ .map(JsonUtil::createEntityIdObject)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.entity.v1.ResetRainbowSheepMessage");
+ message.add("entity_ids", entityIds);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Override Entity flip state
+
+```java
+public void flipEntityExample(Player viewer) {
+ JsonArray entityIds = viewer.getWorld()
+ .getNearbyEntities(viewer.getLocation(), 10, 10, 10)
+ .stream().filter(entity -> entity instanceof Cow)
+ .map(JsonUtil::createEntityIdObject)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.entity.v1.FlipEntityMessage");
+ message.add("entity_ids", entityIds);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Entity flip state
+
+```java
+public void resetFlippedEntityExample(Player viewer) {
+ JsonArray entityIds = viewer.getWorld()
+ .getNearbyEntities(viewer.getLocation(), 10, 10, 10)
+ .stream().filter(entity -> entity instanceof Cow)
+ .map(JsonUtil::createEntityIdObject)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.entity.v1.ResetFlipedEntityMessage");
+ message.add("entity_ids", entityIds);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/glow.mdx b/docs/developers/modules/glow.mdx
index fc0e7c5b..38952b2d 100644
--- a/docs/developers/modules/glow.mdx
+++ b/docs/developers/modules/glow.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Glow Module
## Overview
@@ -17,6 +19,13 @@ The glow module allows you to take advantage of the vanilla Minecraft Glow Effec
## Integration
### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Override a Glow Effect
```java
public void overrideGlowEffectExample(UUID glowingPlayer) {
@@ -27,6 +36,23 @@ public void overrideGlowEffectExample(UUID glowingPlayer) {
}
```
+### Removing a Glow Effect
+
+```java
+public void resetGlowEffectExample(UUID glowingPlayer) {
+ this.glowModule.resetGlow(Recipients.ofEveryone(), glowingPlayer);
+}
+```
+
+### Resetting all Glow Effects
+
+```java
+public void resetGlowEffectsExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.glowModule::resetGlow);
+}
+```
+
### `overrideGlowEffectExample` Parameters
1. `Recipients recipients`
@@ -36,19 +62,84 @@ public void overrideGlowEffectExample(UUID glowingPlayer) {
3. `Color glowColor`
- How you'll dictate the color of the glow effect, see the [colors page](/apollo/developers/utilities/colors) for more.
-### Removing a specific targets glow effect for viewers
+
+
+
+
+### Override a Glow Effect
+
+```java
+public void overrideGlowEffectExample(UUID glowingPlayer) {
+ OverrideGlowEffectMessage message = OverrideGlowEffectMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(glowingPlayer))
+ .setColor(ProtobufUtil.createColorProto(Color.RED))
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+}
+```
+
+### Removing a Glow Effect
```java
public void resetGlowEffectExample(UUID glowingPlayer) {
- this.glowModule.resetGlow(Recipients.ofEveryone(), glowingPlayer);
+ ResetGlowEffectMessage message = ResetGlowEffectMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(glowingPlayer))
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
}
```
-### Resetting all glow effects for all viewers
+### Resetting all Glow Effects
```java
public void resetGlowEffectsExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(this.glowModule::resetGlow);
+ ResetGlowEffectsMessage message = ResetGlowEffectsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+### Override a Glow Effect
+
+```java
+public void overrideGlowEffectExample(UUID glowingPlayer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.glow.v1.OverrideGlowEffectMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(glowingPlayer));
+ message.add("color", JsonUtil.createColorObject(Color.RED));
+
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+### Removing a Glow Effect
+
+```java
+public void resetGlowEffectExample(UUID glowingPlayer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.glow.v1.ResetGlowEffectMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(glowingPlayer));
+
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+### Resetting all Glow Effects
+
+```java
+public void resetGlowEffectsExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.glow.v1.ResetGlowEffectsMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
}
```
+
+
+
+
diff --git a/docs/developers/modules/hologram.mdx b/docs/developers/modules/hologram.mdx
index 7aa64d6b..36259a35 100644
--- a/docs/developers/modules/hologram.mdx
+++ b/docs/developers/modules/hologram.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Hologram Module
## Overview
@@ -13,6 +15,13 @@ The hologram module enhances vanilla Minecraft's current system for holograms an
## Integration
### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Displaying a Hologram
```java
public void displayHologramExample() {
@@ -42,6 +51,23 @@ public void displayHologramExample() {
}
```
+### Removing a Hologram
+
+```java
+public void removeHologramExample() {
+ this.hologramModule.removeHologram(Recipients.ofEveryone(), "welcome-hologram");
+}
+```
+
+### Resetting all Holograms
+
+```java
+public void resetHologramsExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.hologramModule::resetHolograms);
+}
+```
+
### `Hologram` Options
`.id(String)` should include a unique identifier for the hologram.
@@ -59,7 +85,7 @@ public void displayHologramExample() {
.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.
@@ -95,20 +121,121 @@ public void displayHologramExample() {
.showBackground(true)
```
+
+
+
+
+### Displaying a Hologram
+
+```java
+public void displayHologramExample() {
+ List lines = Lists.newArrayList(
+ 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()
+ )
+ .stream().map(AdventureUtil::toJson)
+ .collect(Collectors.toList());
+
+ DisplayHologramMessage message = DisplayHologramMessage.newBuilder()
+ .setId("welcome-hologram")
+ .setLocation(ProtobufUtil.createLocationProto(
+ new Location(Bukkit.getWorld("world"), 5, 105, 0)
+ ))
+ .addAllAdventureJsonLines(lines)
+ .setShowThroughWalls(true)
+ .setShowShadow(false)
+ .setShowBackground(true)
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+}
+```
+
+### Removing a Hologram
+
+```java
+public void removeHologramExample() {
+ RemoveHologramMessage message = RemoveHologramMessage.newBuilder()
+ .setId("welcome-hologram")
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+}
+```
+
+### Resetting all Holograms
+
+```java
+public void resetHologramsExample(Player viewer) {
+ ResetHologramsMessage message = ResetHologramsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+### Displaying a Hologram
+
+```java
+public void displayHologramExample() {
+ JsonArray lines = Lists.newArrayList(
+ 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()
+ ).stream().map(AdventureUtil::toJson).map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.hologram.v1.DisplayHologramMessage");
+ message.addProperty("id", "welcome-hologram");
+ message.add("location", JsonUtil.createLocationObject(
+ new Location(Bukkit.getWorld("world"), 5, 105, 0)
+ ));
+ message.add("adventure_json_lines", lines);
+ message.addProperty("show_through_walls", true);
+ message.addProperty("show_shadow", false);
+ message.addProperty("show_background", true);
+
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
-### Removing a specific hologram for players
+### Removing a Hologram
```java
public void removeHologramExample() {
- this.hologramModule.removeHologram(Recipients.ofEveryone(), "welcome-hologram");
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.hologram.v1.RemoveHologramMessage");
+ message.addProperty("id", "welcome-hologram");
+
+ JsonPacketUtil.broadcastPacket(message);
}
```
-### Resetting all holograms for a player
+### Resetting all Holograms
```java
public void resetHologramsExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(this.hologramModule::resetHolograms);
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.hologram.v1.ResetHologramsMessage");
+
+ JsonPacketUtil.broadcastPacket(message);
}
```
+
+
+
+
diff --git a/docs/developers/modules/limb.mdx b/docs/developers/modules/limb.mdx
index 950107d1..a05d10c4 100644
--- a/docs/developers/modules/limb.mdx
+++ b/docs/developers/modules/limb.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Limb Module
## Overview
@@ -15,7 +17,14 @@ The limb module allows you to hide the `ArmorPiece` and `BodyPart` limbs of a pl
## Integration
-### Hiding an armor piece of a player
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Hide Armor Pieces
```java
public void hideArmorExample(Player viewer, Player target) {
@@ -30,16 +39,7 @@ public void hideArmorExample(Player viewer, Player target) {
}
```
-#### `hideArmorPieces` Parameters
-
-1. `ApolloPlayer Viewer`
- - The player(s) that you wish to see the hidden armor piece.
-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.
-
-### Resetting an armor piece of a player
+### Reset Armor Pieces
```java
public void resetArmorExample(Player viewer, Player target) {
@@ -54,16 +54,7 @@ public void resetArmorExample(Player viewer, Player target) {
}
```
-#### `resetArmorPieces` Parameters
-
-1. `ApolloPlayer Viewer`
- - The player(s) that you want to reset the armor piece for.
-2. `UUID Target`
- - The players UUID you want to reset the armor piece of.
-3. `ArmorPiece.TYPE`
- - The type of armor piece(s) you want to reset on the `target` player. See the [armor pieces](#armorpiece-types) section for more.
-
-### Hiding a body part of a player
+### Hide Body Parts
```java
public void hideBodyExample(Player viewer, Player target) {
@@ -78,18 +69,9 @@ public void hideBodyExample(Player viewer, Player target) {
}
```
-#### `hideBodyParts` Parameters
-
-1. `ApolloPlayer Viewer`
- - The player(s) you want to see the hidden body part.
-2. `UUID Target`
- - The players UUID you want to hide the body part of.
-3. `BodyPart.TYPE`
- - The type of body part(s) you want to hide on the `target` player. See the [body parts](#bodyparts-types) section for more.
-
-### Resetting a body part of a player
+### Reset Body Parts
-```java
+```java
public void resetBodyExample(Player viewer, Player target) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -102,10 +84,19 @@ public void resetBodyExample(Player viewer, Player target) {
}
```
-#### `resetBodyParts` Parameters
+#### `hideArmorPieces` & `resetArmorPieces` Parameters
+
+1. `Recipients recipients`
+ - A list of all the player(s) you want to be able to see the updated armor pieces.
+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.
+
+#### `hideBodyParts` & `resetBodyParts` Parameters
-1. `ApolloPlayer Viewer`
- - The player(s) you want to reset the body part for.
+1. `Recipients recipients`
+ - A list of all the player(s) you want to be able to see the updated armor pieces.
2. `UUID Target`
- The players UUID you want to reset the body part of.
3. `BodyPart.TYPE`
@@ -126,3 +117,139 @@ public void resetBodyExample(Player viewer, Player target) {
* `RIGHT_ARM`
* `LEFT_LEG`
* `RIGHT_LEG`
+
+
+
+
+
+### Hide Armor Pieces
+
+```java
+public void hideArmorExample(Player viewer, Player target) {
+ HideArmorPiecesMessage message = HideArmorPiecesMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId()))
+ .addAllArmorPieces(EnumSet.of(ArmorPiece.ARMOR_PIECE_HELMET, ArmorPiece.ARMOR_PIECE_LEGGINGS))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Armor Pieces
+
+```java
+public void resetArmorExample(Player viewer, Player target) {
+ ResetArmorPiecesMessage message = ResetArmorPiecesMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId()))
+ .addAllArmorPieces(EnumSet.of(ArmorPiece.ARMOR_PIECE_HELMET, ArmorPiece.ARMOR_PIECE_LEGGINGS))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Hide Body Parts
+
+```java
+public void hideBodyExample(Player viewer, Player target) {
+ HideBodyPartMessage message = HideBodyPartMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId()))
+ .addAllBodyParts(EnumSet.of(BodyPart.BODY_PART_HEAD, BodyPart.BODY_PART_RIGHT_ARM))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);;
+}
+```
+
+### Reset Body Parts
+
+```java
+public void resetBodyExample(Player viewer, Player target) {
+ ResetBodyPartMessage message = ResetBodyPartMessage.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(target.getUniqueId()))
+ .addAllBodyParts(EnumSet.of(BodyPart.BODY_PART_HEAD, BodyPart.BODY_PART_RIGHT_ARM))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);;
+}
+```
+
+
+
+
+
+### Hide Armor Pieces
+
+```java
+public void hideArmorExample(Player viewer, Player target) {
+ // 1 = helmet, 2 = chestplate, 3 = leggings, 4 = boots
+ JsonArray armorPieces = Lists.newArrayList(1, 3)
+ .stream().map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.limb.v1.HideArmorPiecesMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(target.getUniqueId()));
+ message.add("armor_pieces", armorPieces);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Armor Pieces
+
+```java
+public void resetArmorExample(Player viewer, Player target) {
+ // 1 = helmet, 2 = chestplate, 3 = leggings, 4 = boots
+ JsonArray armorPieces = Lists.newArrayList(1, 3)
+ .stream().map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.limb.v1.ResetArmorPiecesMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(target.getUniqueId()));
+ message.add("armor_pieces", armorPieces);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Hide Body Parts
+
+```java
+public void hideBodyExample(Player viewer, Player target) {
+ // 1 = head, 2 = torso, 3 = left arm, 4 = right arm, 5 = left leg, 6 = right leg
+ JsonArray bodyParts = Lists.newArrayList(1, 4)
+ .stream().map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.limb.v1.HideBodyPartMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(target.getUniqueId()));
+ message.add("body_parts", bodyParts);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Body Parts
+
+```java
+public void resetBodyExample(Player viewer, Player target) {
+ // 1 = head, 2 = torso, 3 = left arm, 4 = right arm, 5 = left leg, 6 = right leg
+ JsonArray bodyParts = Lists.newArrayList(1, 4)
+ .stream().map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.limb.v1.ResetBodyPartMessage");
+ message.add("player_uuid", JsonUtil.createUuidObject(target.getUniqueId()));
+ message.add("body_parts", bodyParts);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/modsetting.mdx b/docs/developers/modules/modsetting.mdx
index 6d05ccfc..7afb5de3 100644
--- a/docs/developers/modules/modsetting.mdx
+++ b/docs/developers/modules/modsetting.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Mod Setting Module
## Overview
@@ -19,29 +21,122 @@ You can find all available mods and their options under the mods section.
## Integration
-### Interacting with a specific players `ModSetting`
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Disable Lighting Mod
```java
-public void disableLightningModExample(Player viewer) {
+public void disableLightingModExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModLighting.ENABLED, false));
}
```
-### Resetting a specific players `ModSetting`
+### Reset Lighting Mod to it's default value
```java
-public void rollbackLightningModEnabledState(Player viewer) {
+public void rollbackLightingModEnabledState(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
// To rollback the server override value of the setting, simply set the value to "null"
apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModLighting.ENABLED, null));
}
```
-### Broadcasting a `ModSettings` change to an entire server.
+### Broadcast Disable Lighting Mod the an entire server
```java
-public void broadcastDisableLightningModExample(Player viewer) {
+public void broadcastDisableLightingModExample(Player viewer) {
this.modSettingModule.getOptions().set(ModLighting.ENABLED, false);
}
```
+
+
+
+
+
+### Disable Lighting Mod
+
+```java
+public void disableLightingModExample(Player viewer) {
+ Map properties = new HashMap<>();
+ properties.put("lighting.enabled", Value.newBuilder().setBoolValue(false).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("mod_setting", properties);
+ ProtobufPacketUtil.sendPacket(viewer, settings);
+}
+```
+
+### Reset Lighting Mod to it's default value
+
+```java
+public void rollbackLightingModEnabledState(Player viewer) {
+ Map properties = new HashMap<>();
+ // To rollback the server override value of the setting, simply set the value to "null"
+ properties.put("lighting.enabled", Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("mod_setting", properties);
+ ProtobufPacketUtil.sendPacket(viewer, settings);
+}
+```
+
+### Broadcast Disable Lighting Mod the an entire server
+
+```java
+public void broadcastDisableLightingModExample() {
+ Map properties = new HashMap<>();
+ properties.put("lighting.enabled", Value.newBuilder().setBoolValue(false).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("mod_setting", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+}
+```
+
+
+
+
+
+### Disable Lighting Mod
+
+```java
+public void disableLightingModExample(Player viewer) {
+ Map properties = new HashMap<>();
+ properties.put("lighting.enabled", false);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("mod_setting", properties);
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Lighting Mod to it's default value
+
+```java
+public void rollbackLightingModEnabledState(Player viewer) {
+ // To rollback the server override value of the setting, simply set the value to "null"
+ Map properties = new HashMap<>();
+ properties.put("lighting.enabled", null);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("mod_setting", properties);
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Broadcast Disable Lighting Mod the an entire server
+
+```java
+public void broadcastDisableLightingModExample() {
+ Map properties = new HashMap<>();
+ properties.put("lighting.enabled", false);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("mod_setting", properties);
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/nametag.mdx b/docs/developers/modules/nametag.mdx
index e8dcebc2..bace711d 100644
--- a/docs/developers/modules/nametag.mdx
+++ b/docs/developers/modules/nametag.mdx
@@ -1,3 +1,4 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
import { Callout } from 'nextra-theme-docs'
# Nametag Module
@@ -24,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) {
@@ -44,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`
@@ -72,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).map(JsonPrimitive::new)
+ .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 5f1c3751..4122158b 100644
--- a/docs/developers/modules/nickhider.mdx
+++ b/docs/developers/modules/nickhider.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Nick Hider Module
## Overview
@@ -8,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) {
@@ -17,7 +26,7 @@ public void overrideNickExample(Player viewer) {
}
```
-### Reset the nick for a specific player
+### Reset a Nick
```java
public void resetNickExample(Player viewer) {
@@ -25,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 faad0aeb..81ed896d 100644
--- a/docs/developers/modules/notification.mdx
+++ b/docs/developers/modules/notification.mdx
@@ -1,3 +1,4 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
import { Callout } from 'nextra-theme-docs'
# Notification Module
@@ -18,20 +19,42 @@ The notification module allows you to send Lunar Client notifications to players
## Integration
-### `Notification` Builder
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Displaying a Notification
```java
-private final Notification uhcAnnouncement = Notification.builder()
- .titleComponent(Component.text("UHC Announcement", NamedTextColor.GREEN))
- .descriptionComponent(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))
- )
- .resourceLocation("icons/golden_apple.png") // This field is optional
- .displayTime(Duration.ofSeconds(5))
- .build();
+public void displayNotificationExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+
+ apolloPlayerOpt.ifPresent(apolloPlayer -> {
+ this.notificationModule.displayNotification(apolloPlayer, Notification.builder()
+ .titleComponent(Component.text("UHC Announcement", NamedTextColor.GREEN))
+ .descriptionComponent(Component.text("UHC starts in 5 minutes...", NamedTextColor.RED)
+ .append(Component.newline())
+ .append(Component.text("Get ready!", NamedTextColor.WHITE))
+ .append(Component.newline())
+ .append(Component.text("Good luck!", NamedTextColor.GOLD))
+ )
+ .resourceLocation("icons/golden_apple.png") // This field is optional
+ .displayTime(Duration.ofSeconds(5))
+ .build());
+ });
+}
+```
+
+### Resetting all Notifications
+
+```java
+public void resetNotificationsExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.notificationModule::resetNotifications);
+}
```
#### `Notification` Options
@@ -82,20 +105,82 @@ If this field is left empty (null) it'll display a generic info icon, as display
.description("UHC starts in 5 minutes...")
```
-### Displaying a Notification for a specific player
+
+
+
+
+### Displaying a Notification
```java
public void displayNotificationExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(apolloPlayer -> this.notificationModule.displayNotification(apolloPlayer, this.uhcAnnouncement));
+ 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)
+ .append(Component.newline())
+ .append(Component.text("Get ready!", NamedTextColor.WHITE))
+ .append(Component.newline())
+ .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 for a player
+### 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)
+ .append(Component.newline())
+ .append(Component.text("Get ready!", NamedTextColor.WHITE))
+ .append(Component.newline())
+ .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);
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/packetenrichment.mdx b/docs/developers/modules/packetenrichment.mdx
index 4234a7f2..ffa50b7c 100644
--- a/docs/developers/modules/packetenrichment.mdx
+++ b/docs/developers/modules/packetenrichment.mdx
@@ -13,6 +13,13 @@ The packet enrichment module provides servers with additional information about
## Integration
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
The majority of this module is handled through Apollo's [event system](/apollo/developers/events).
The following events are related to the packet enrichment module, you can find more information about each event on the [events page](/apollo/developers/events).
@@ -20,3 +27,14 @@ The following events are related to the packet enrichment module, you can find m
* `ApolloPlayerChatOpenEvent`
* `ApolloPlayerAttackEvent`
* `ApolloPlayerUseItemEvent`
+
+
+
+
+
+Visit [Apollo Serverbound packets](/apollo/developers/lightweight/protobuf/serverbound-packets)
+
+
+
+
+
diff --git a/docs/developers/modules/richpresence.mdx b/docs/developers/modules/richpresence.mdx
index 5fd58995..a144b6a7 100644
--- a/docs/developers/modules/richpresence.mdx
+++ b/docs/developers/modules/richpresence.mdx
@@ -1,3 +1,4 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
import { Callout } from 'nextra-theme-docs'
# Rich Presence Module
@@ -28,6 +29,13 @@ The rich presence module allows you to interact with Discord and Lunar Client's
## Integration
### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Override Rich Presence
```java
public void overrideServerRichPresenceExample(Player viewer) {
@@ -49,6 +57,15 @@ public void overrideServerRichPresenceExample(Player viewer) {
}
```
+### Reset Rich Presence
+
+```java
+public void resetServerRichPresenceExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.richPresenceModule::resetServerRichPresence);
+}
+```
+
### `ServerRichPresence` Options
`.gameName(String)` the name of the game the player is playing on.
@@ -99,11 +116,72 @@ public void overrideServerRichPresenceExample(Player viewer) {
.teamMaxSize(4)
```
-### Resetting the server rich presence for a player
+
+
+
+
+### Override Rich Presence
+
+```java
+public void overrideServerRichPresenceExample(Player viewer) {
+ OverrideServerRichPresenceMessage message = OverrideServerRichPresenceMessage.newBuilder()
+ .setGameName("BedWars")
+ .setGameVariantName("Solo")
+ .setGameState("In Game")
+ .setPlayerState("Playing")
+ .setMapName("Winter")
+ .setSubServer("BW02")
+ .setTeamCurrentSize(3)
+ .setTeamMaxSize(4)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Rich Presence
```java
public void resetServerRichPresenceExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(this.richPresenceModule::resetServerRichPresence);
+ ResetServerRichPresenceMessage message = ResetServerRichPresenceMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+### Override Rich Presence
+
+```java
+public void overrideServerRichPresenceExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.richpresence.v1.OverrideServerRichPresenceMessage");
+ message.addProperty("game_name", "BedWars");
+ message.addProperty("game_variant_name", "Solo");
+ message.addProperty("game_state", "In Game");
+ message.addProperty("player_state", "Playing");
+ message.addProperty("map_name", "Winter");
+ message.addProperty("sub_server", "BW02");
+ message.addProperty("team_current_size", 3);
+ message.addProperty("team_max_size", 4);
+
+ JsonPacketUtil.sendPacket(viewer, message);
}
```
+
+### Reset Rich Presence
+
+```java
+public void resetServerRichPresenceExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.richpresence.v1.ResetServerRichPresenceMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/serverrule.mdx b/docs/developers/modules/serverrule.mdx
index 2272fcdc..7f1d6143 100644
--- a/docs/developers/modules/serverrule.mdx
+++ b/docs/developers/modules/serverrule.mdx
@@ -1,3 +1,4 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
import { Callout } from 'nextra-theme-docs'
# Server Rule Module
@@ -16,7 +17,14 @@ This module heavily integrates with our [Options API](/apollo/developers/options
## Integration
-### How to toggle a specific server rule
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Toggle Anti Portal Traps
```java
public void setAntiPortalTraps(boolean value) {
@@ -24,7 +32,7 @@ public void setAntiPortalTraps(boolean value) {
}
```
-### How to toggle a specific server rule for a specific player
+### Override Nametag Render Distance
```java
public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
@@ -36,7 +44,7 @@ public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
}
```
-### How to change a specific server rule value
+### Broadcast Nametag Render Distance
```java
public void setNametagRenderDistanceExample(int value) {
@@ -44,6 +52,90 @@ public void setNametagRenderDistanceExample(int value) {
}
```
+
+
+
+
+### Toggle Anti Portal Traps
+
+```java
+public void setAntiPortalTraps(boolean value) {
+ Map properties = new HashMap<>();
+ properties.put("anti-portal-traps", Value.newBuilder().setBoolValue(value).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("server_rule", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+}
+```
+
+### Override Nametag Render Distance
+
+```java
+public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
+ Map properties = new HashMap<>();
+ properties.put("override-nametag-render-distance", Value.newBuilder().setBoolValue(value).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("server_rule", properties);
+ ProtobufPacketUtil.sendPacket(viewer, settings);
+}
+```
+
+### Broadcast Nametag Render Distance
+
+```java
+public void setNametagRenderDistanceExample(int value) {
+ Map properties = new HashMap<>();
+ properties.put("nametag-render-distance", Value.newBuilder().setNumberValue(value).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("server_rule", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+}
+```
+
+
+
+
+
+### Toggle Anti Portal Traps
+
+```java
+public void setAntiPortalTraps(boolean value) {
+ Map properties = new HashMap<>();
+ properties.put("anti-portal-traps", value);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("server_rule", properties);
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+### Override Nametag Render Distance
+
+```java
+public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
+ Map properties = new HashMap<>();
+ properties.put("override-nametag-render-distance", value);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("server_rule", properties);
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Broadcast Nametag Render Distance
+
+```java
+public void setNametagRenderDistanceExample(int value) {
+ Map properties = new HashMap<>();
+ properties.put("nametag-render-distance", value);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("server_rule", properties);
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+
+
+
+
## Available options
- __`COMPETITIVE_GAME`__
diff --git a/docs/developers/modules/staffmod.mdx b/docs/developers/modules/staffmod.mdx
index e3fe3ca6..1be7c8af 100644
--- a/docs/developers/modules/staffmod.mdx
+++ b/docs/developers/modules/staffmod.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Staff Mod Module
## Overview
@@ -15,9 +17,16 @@ The staff mod module allows you to interact with Lunar Client's built in staff m
## Integration
-### How to enable staff mods for a player
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Enable Staff Mods
-```java
+```java
public void enableStaffModsExample(Player viewer) {
if (!viewer.hasPermission("apollo.staff")) {
return;
@@ -28,14 +37,7 @@ public void enableStaffModsExample(Player viewer) {
}
```
-#### `enableStaffMods` Parameters
-
-1. `ApolloPlayer`
- - The player you want to enable the staff mod for.
-2. `StaffMod.TYPE`
- - The type of staff mod(s) you want to enable for the `ApolloPlayer` player. See the [staff mod types](#staffmod-types) section for more.
-
-### How to disable staff mods for a player
+### Disable Staff Mods
```java
public void disableStaffModsExample(Player viewer) {
@@ -44,14 +46,91 @@ public void disableStaffModsExample(Player viewer) {
}
```
-#### `disableStaffMods` Parameters
+#### `enableStaffMods` & `disableStaffMods` Parameters
-1. `ApolloPlayer`
- - The player you want to disable the staff mod for.
+1. `Recipients recipients`
+ - A list of all the player(s) you want to enable or disable the staff mod.
2. `StaffMod.TYPE`
- - The type of staff mod(s) you want to disable for the `ApolloPlayer` player. See the [staff mod types](#staffmod-types) section for more.
+ - The type of staff mod(s) you want to enable for the `Recipients` player. See the [staff mod types](#staffmod-types) section for more.
## `StaffMod` Types
* `XRAY`
+
+
+
+
+### Enable Staff Mods
+
+```java
+public void enableStaffModsExample(Player viewer) {
+ if (!viewer.hasPermission("apollo.staff")) {
+ return;
+ }
+
+ EnableStaffModsMessage message = EnableStaffModsMessage.newBuilder()
+ .addAllStaffMods(Collections.singletonList(StaffMod.STAFF_MOD_XRAY))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Disable Staff Mods
+
+```java
+public void disableStaffModsExample(Player viewer) {
+ DisableStaffModsMessage message = DisableStaffModsMessage.newBuilder()
+ .addAllStaffMods(Collections.singletonList(StaffMod.STAFF_MOD_XRAY))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+### Enable Staff Mods
+
+```java
+public void enableStaffModsExample(Player viewer) {
+ if (!viewer.hasPermission("apollo.staff")) {
+ return;
+ }
+
+ // 1 = xray
+ JsonArray staffMods = Stream.of(1)
+ .map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.staffmod.v1.EnableStaffModsMessage");
+ message.add("staff_mods", staffMods);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Disable Staff Mods
+
+```java
+public void disableStaffModsExample(Player viewer) {
+ // 1 = xray
+ JsonArray staffMods = Stream.of(1)
+ .map(JsonPrimitive::new)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.staffmod.v1.DisableStaffModsMessage");
+ message.add("staff_mods", staffMods);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/stopwatch.mdx b/docs/developers/modules/stopwatch.mdx
index 46f91198..9412318b 100644
--- a/docs/developers/modules/stopwatch.mdx
+++ b/docs/developers/modules/stopwatch.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Stopwatch Module
## Overview
@@ -17,7 +19,14 @@ The stopwatch module allows you to control the stopwatch mod inside Lunar Client
## Integration
-### How to start a player's stopwatch
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Start Stopwatch
```java
public void startStopwatchExample(Player viewer) {
@@ -26,7 +35,7 @@ public void startStopwatchExample(Player viewer) {
}
```
-### How to stop a player's stopwatch
+### Stop Stopwatch
```java
public void stopStopwatchExample(Player viewer) {
@@ -35,7 +44,7 @@ public void stopStopwatchExample(Player viewer) {
}
```
-### How to reset a player's stopwatch
+### Reset Stopwatch
```java
public void resetStopwatchExample(Player viewer) {
@@ -43,3 +52,75 @@ public void resetStopwatchExample(Player viewer) {
apolloPlayerOpt.ifPresent(this.stopwatchModule::resetStopwatch);
}
```
+
+
+
+
+
+### Start Stopwatch
+
+```java
+public void startStopwatchExample(Player viewer) {
+ StartStopwatchMessage message = StartStopwatchMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Stop Stopwatch
+
+```java
+public void stopStopwatchExample(Player viewer) {
+ StopStopwatchMessage message = StopStopwatchMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Stopwatch
+
+```java
+public void resetStopwatchExample(Player viewer) {
+ ResetStopwatchMessage message = ResetStopwatchMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+### Start Stopwatch
+
+```java
+public void startStopwatchExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.stopwatch.v1.StartStopwatchMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Stop Stopwatch
+
+```java
+public void stopStopwatchExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.stopwatch.v1.StopStopwatchMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Stopwatch
+
+```java
+public void resetStopwatchExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.stopwatch.v1.ResetStopwatchMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/team.mdx b/docs/developers/modules/team.mdx
index 282174b9..bd856ce1 100644
--- a/docs/developers/modules/team.mdx
+++ b/docs/developers/modules/team.mdx
@@ -20,6 +20,11 @@ The team module will allow you to interact with the Team View mod in Lunar Clien
## Integration
### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
```java
private final Map teamsByTeamId = Maps.newHashMap();
@@ -224,3 +229,292 @@ Custom colors can be created from any RGB values using `new Color(int red, int g
.build()
)
```
+
+
+
+
+
+```java
+private final Map teamsByTeamId = Maps.newHashMap();
+private final Map teamsByPlayerUuid = Maps.newHashMap();
+
+public TeamProtoExample() {
+ new TeamUpdateTask();
+
+ Bukkit.getPluginManager().registerEvents(this, ApolloExamplePlugin.getPlugin());
+}
+
+@EventHandler
+private void onPlayerQuit(PlayerQuitEvent event) {
+ Player player = event.getPlayer();
+
+ this.getByPlayerUuid(player.getUniqueId()).ifPresent(team -> {
+ if (team.getMembers().size() == 1) {
+ this.deleteTeam(team.getTeamId());
+ }
+ });
+}
+
+public Optional getByPlayerUuid(UUID playerUuid) {
+ return Optional.ofNullable(this.teamsByPlayerUuid.get(playerUuid));
+}
+
+public Optional getByTeamId(UUID teamId) {
+ return Optional.ofNullable(this.teamsByTeamId.get(teamId));
+}
+
+public Team createTeam() {
+ Team team = new Team();
+ this.teamsByTeamId.put(team.getTeamId(), team);
+
+ return team;
+}
+
+public void deleteTeam(UUID teamId) {
+ Team team = this.teamsByTeamId.remove(teamId);
+
+ if (team != null) {
+ team.getMembers().forEach(team::removeMember);
+ }
+}
+
+public class Team {
+
+ private final UUID teamId;
+ private final Set members;
+
+ public Team() {
+ this.teamId = UUID.randomUUID();
+ this.members = Sets.newHashSet();
+ }
+
+ public void addMember(Player player) {
+ this.members.add(player);
+ TeamProtoExample.this.teamsByPlayerUuid.put(player.getUniqueId(), this);
+ }
+
+ public void removeMember(Player player) {
+ this.members.remove(player);
+ TeamProtoExample.this.teamsByPlayerUuid.remove(player.getUniqueId());
+
+ ResetTeamMembersMessage message = ResetTeamMembersMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(player, message);
+ }
+
+ private TeamMember createTeamMember(Player member) {
+ return TeamMember.newBuilder()
+ .setPlayerUuid(ProtobufUtil.createUuidProto(member.getUniqueId()))
+ .setAdventureJsonPlayerName(AdventureUtil.toJson(
+ Component.text()
+ .content(member.getName())
+ .color(NamedTextColor.WHITE)
+ .build()
+ ))
+ .setMarkerColor(ProtobufUtil.createColorProto(Color.WHITE))
+ .setLocation(ProtobufUtil.createLocationProto(member.getLocation()))
+ .build();
+ }
+
+ // The refresh method used for updating members locations
+ public void refresh() {
+ List teammates = this.members.stream().filter(Player::isOnline)
+ .map(this::createTeamMember)
+ .collect(Collectors.toList());
+
+ UpdateTeamMembersMessage message = UpdateTeamMembersMessage.newBuilder()
+ .addAllMembers(teammates)
+ .build();
+
+ this.members.forEach(member -> ProtobufPacketUtil.sendPacket(member, message));
+ }
+
+ public UUID getTeamId() {
+ return this.teamId;
+ }
+
+ public Set getMembers() {
+ return this.members;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+
+ if (other == null || other.getClass() != this.getClass()) {
+ return false;
+ }
+
+ Team team = (Team) other;
+ return this.teamId.equals(team.getTeamId());
+ }
+
+ @Override
+ public int hashCode() {
+ return this.teamId.hashCode();
+ }
+}
+
+// Updates players location every 1 tick (50ms)
+public class TeamUpdateTask extends BukkitRunnable {
+
+ public TeamUpdateTask() {
+ this.runTaskTimerAsynchronously(ApolloExamplePlugin.getPlugin(), 1L, 1L);
+ }
+
+ @Override
+ public void run() {
+ TeamProtoExample.this.teamsByTeamId.values().forEach(Team::refresh);
+ }
+}
+```
+
+
+
+
+
+```java
+private final Map teamsByTeamId = Maps.newHashMap();
+private final Map teamsByPlayerUuid = Maps.newHashMap();
+
+public TeamJsonExample() {
+ new TeamUpdateTask();
+
+ Bukkit.getPluginManager().registerEvents(this, ApolloExamplePlugin.getPlugin());
+}
+
+@EventHandler
+private void onPlayerQuit(PlayerQuitEvent event) {
+ Player player = event.getPlayer();
+
+ this.getByPlayerUuid(player.getUniqueId()).ifPresent(team -> {
+ if (team.getMembers().size() == 1) {
+ this.deleteTeam(team.getTeamId());
+ }
+ });
+}
+
+public Optional getByPlayerUuid(UUID playerUuid) {
+ return Optional.ofNullable(this.teamsByPlayerUuid.get(playerUuid));
+}
+
+public Optional getByTeamId(UUID teamId) {
+ return Optional.ofNullable(this.teamsByTeamId.get(teamId));
+}
+
+public Team createTeam() {
+ Team team = new Team();
+ this.teamsByTeamId.put(team.getTeamId(), team);
+
+ return team;
+}
+
+public void deleteTeam(UUID teamId) {
+ Team team = this.teamsByTeamId.remove(teamId);
+
+ if (team != null) {
+ team.getMembers().forEach(team::removeMember);
+ }
+}
+
+public class Team {
+
+ private final UUID teamId;
+ private final Set members;
+
+ public Team() {
+ this.teamId = UUID.randomUUID();
+ this.members = Sets.newHashSet();
+ }
+
+ public void addMember(Player player) {
+ this.members.add(player);
+ TeamJsonExample.this.teamsByPlayerUuid.put(player.getUniqueId(), this);
+ }
+
+ public void removeMember(Player player) {
+ this.members.remove(player);
+ TeamJsonExample.this.teamsByPlayerUuid.remove(player.getUniqueId());
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.team.v1.ResetTeamMembersMessage");
+
+ JsonPacketUtil.sendPacket(player, message);
+ }
+
+ private JsonObject createTeamMember(Player member) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.team.v1.TeamMember");
+ message.add("player_uuid", JsonUtil.createUuidObject(member.getUniqueId()));
+ message.addProperty("adventure_json_player_name", AdventureUtil.toJson(
+ Component.text()
+ .content(member.getName())
+ .color(NamedTextColor.WHITE)
+ .build()
+ ));
+ message.add("marker_color", JsonUtil.createColorObject(Color.WHITE));
+ message.add("location", JsonUtil.createLocationObject(member.getLocation()));
+
+ return message;
+ }
+
+ // The refresh method used for updating members locations
+ public void refresh() {
+ JsonArray teammates = this.members.stream().filter(Player::isOnline)
+ .map(this::createTeamMember)
+ .collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
+
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.team.v1.UpdateTeamMembersMessage");
+ message.add("members", teammates);
+
+ this.members.forEach(member -> JsonPacketUtil.sendPacket(member, message));
+ }
+
+ public UUID getTeamId() {
+ return this.teamId;
+ }
+
+ public Set getMembers() {
+ return this.members;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+
+ if (other == null || other.getClass() != this.getClass()) {
+ return false;
+ }
+
+ Team team = (Team) other;
+ return this.teamId.equals(team.getTeamId());
+ }
+
+ @Override
+ public int hashCode() {
+ return this.teamId.hashCode();
+ }
+}
+
+// Updates players location every 1 tick (50ms)
+public class TeamUpdateTask extends BukkitRunnable {
+
+ public TeamUpdateTask() {
+ this.runTaskTimerAsynchronously(ApolloExamplePlugin.getPlugin(), 1L, 1L);
+ }
+
+ @Override
+ public void run() {
+ TeamJsonExample.this.teamsByTeamId.values().forEach(Team::refresh);
+ }
+}
+```
+
+
+
+
+
diff --git a/docs/developers/modules/title.mdx b/docs/developers/modules/title.mdx
index fc2df212..21209901 100644
--- a/docs/developers/modules/title.mdx
+++ b/docs/developers/modules/title.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Title Module
## Overview
@@ -10,38 +12,62 @@ The title module backports all vanilla `title` & `subtitle` features found in 1.
## Integration
-### `Title` Builder
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Displaying a Title
```java
-private final Title helloTitle = Title.builder()
- .type(TitleType.TITLE)
- .message(Component.text()
- .content("Hello, player!")
- .color(NamedTextColor.GREEN)
- .decorate(TextDecoration.BOLD)
- .build())
- .scale(1.0f)
- .displayTime(Duration.ofMillis(1500L))
- .fadeInTime(Duration.ofMillis(250))
- .fadeOutTime(Duration.ofMillis(300))
- .build();
+public void displayTitleExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(apolloPlayer -> this.titleModule.displayTitle(apolloPlayer, Title.builder()
+ .type(TitleType.TITLE)
+ .message(Component.text()
+ .content("Hello, player!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build())
+ .scale(1.0f)
+ .displayTime(Duration.ofMillis(1500L))
+ .fadeInTime(Duration.ofMillis(250))
+ .fadeOutTime(Duration.ofMillis(300))
+ .build()));
+}
```
+### Displaying a Interpolated Title
+
```java
-private final Title interpolatedTitle = Title.builder()
- .type(TitleType.TITLE)
- .message(Component.text()
- .content("This title expands!")
- .color(NamedTextColor.GREEN)
- .decorate(TextDecoration.BOLD)
- .build())
- .scale(0.1f)
- .interpolationScale(1.0f)
- .interpolationRate(0.01f)
- .displayTime(Duration.ofMillis(5000L))
- .fadeInTime(Duration.ofMillis(250))
- .fadeOutTime(Duration.ofMillis(300))
- .build();
+public void displayTitleInterpolatedExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(apolloPlayer -> this.titleModule.displayTitle(apolloPlayer, Title.builder()
+ .type(TitleType.TITLE)
+ .message(Component.text()
+ .content("This title expands!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build())
+ .scale(0.1f)
+ .interpolationScale(1.0f)
+ .interpolationRate(0.01f)
+ .displayTime(Duration.ofMillis(5000L))
+ .fadeInTime(Duration.ofMillis(250))
+ .fadeOutTime(Duration.ofMillis(300))
+ .build()));
+}
+```
+
+### Resetting all Titles
+
+```java
+public void resetTitlesExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.titleModule::resetTitles);
+}
```
#### `Title` Options
@@ -98,26 +124,135 @@ private final Title interpolatedTitle = Title.builder()
.interpolationRate(0.01f)
```
-### Displaying a title for a player
+## `TitleType` Types
+
+* `TITLE`
+* `SUBTITLE`
+
+
+
+
+
+### Displaying a Title
```java
public void displayTitleExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ DisplayTitleMessage message = DisplayTitleMessage.newBuilder()
+ .setTitleType(TitleType.TITLE_TYPE_TITLE)
+ .setAdventureJsonMessage(AdventureUtil.toJson(
+ Component.text()
+ .content("Hello, player!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build()
+ ))
+ .setScale(1.0f)
+ .setFadeInTime(ProtobufUtil.createDurationProto(Duration.ofMillis(1500)))
+ .setDisplayTime(ProtobufUtil.createDurationProto(Duration.ofMillis(250)))
+ .setFadeOutTime(ProtobufUtil.createDurationProto(Duration.ofMillis(300)))
+ .build();
- apolloPlayerOpt.ifPresent(apolloPlayer -> this.titleModule.displayTitle(apolloPlayer, this.helloTitle));
+ ProtobufPacketUtil.sendPacket(viewer, message);
}
```
-### Resetting all titles for a player
+### Displaying a Interpolated Title
+
+```java
+public void displayTitleInterpolatedExample(Player viewer) {
+ DisplayTitleMessage message = DisplayTitleMessage.newBuilder()
+ .setTitleType(TitleType.TITLE_TYPE_TITLE)
+ .setAdventureJsonMessage(AdventureUtil.toJson(
+ Component.text()
+ .content("This title expands!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build()
+ ))
+ .setScale(0.1f)
+ .setInterpolationScale(1.0f)
+ .setInterpolationRate(0.01f)
+ .setFadeInTime(ProtobufUtil.createDurationProto(Duration.ofMillis(5000)))
+ .setDisplayTime(ProtobufUtil.createDurationProto(Duration.ofMillis(250)))
+ .setFadeOutTime(ProtobufUtil.createDurationProto(Duration.ofMillis(300)))
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Resetting all Titles
```java
public void resetTitlesExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(this.titleModule::resetTitles);
+ ResetTitlesMessage message = ResetTitlesMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
}
```
-## `TitleType` Types
+
-* `TITLE`
-* `SUBTITLE`
+
+
+### Displaying a Title
+
+```java
+public void displayTitleExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.title.v1.DisplayTitleMessage");
+ message.addProperty("title_type", 1); // 1 = title, 2 = subtitle
+ message.addProperty("adventure_json_message", AdventureUtil.toJson(
+ Component.text()
+ .content("Hello, player!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build()
+ ));
+ message.addProperty("scale", 1.0f);
+ message.addProperty("fade_in_time", JsonUtil.createDurationObject(Duration.ofMillis(1500)));
+ message.addProperty("display_time", JsonUtil.createDurationObject(Duration.ofMillis(250)));
+ message.addProperty("fade_out_time", JsonUtil.createDurationObject(Duration.ofMillis(300)));
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Displaying a Interpolated Title
+
+```java
+public void displayTitleInterpolatedExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.title.v1.DisplayTitleMessage");
+ message.addProperty("title_type", 1); // 1 = title, 2 = subtitle
+ message.addProperty("adventure_json_message", AdventureUtil.toJson(
+ Component.text()
+ .content("This title expands!")
+ .color(NamedTextColor.GREEN)
+ .decorate(TextDecoration.BOLD)
+ .build()
+ ));
+ message.addProperty("scale", 0.1f);
+ message.addProperty("interpolation_scale", 1.0f);
+ message.addProperty("interpolation_rate", 0.01f);
+ message.addProperty("fade_in_time", JsonUtil.createDurationObject(Duration.ofMillis(5000)));
+ message.addProperty("display_time", JsonUtil.createDurationObject(Duration.ofMillis(250)));
+ message.addProperty("fade_out_time", JsonUtil.createDurationObject(Duration.ofMillis(300)));
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Resetting all Titles
+
+```java
+public void resetTitlesExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.title.v1.ResetTitlesMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/tntcountdown.mdx b/docs/developers/modules/tntcountdown.mdx
index ac62fb4d..18a2f598 100644
--- a/docs/developers/modules/tntcountdown.mdx
+++ b/docs/developers/modules/tntcountdown.mdx
@@ -1,3 +1,4 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
import { Callout } from 'nextra-theme-docs'
# TNT Countdown Module
@@ -14,23 +15,22 @@ The TNT Countdown module allows you to interact with and set custom TNT timers f
## Integration
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Set TNT Countdown Ticks Option
+
```java
-public void setTntCountdownExample(Player viewer, ApolloEntity tntEntity, int ticks) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(apolloPlayer -> this.tntCountdownModule.setTntCountdown(apolloPlayer, tntEntity, ticks));
+public void setTntCountdownExample() {
+ this.tntCountdownModule.getOptions().set(TntCountdownModule.TNT_TICKS, 160);
}
```
-### `setTntCountdown` Parameters
-
-1. `ApolloPlayer`
- - The player or viewer you want to display the countdown to.
-2. `ApolloEntity`
- - The TNT entity you want the custom countdown to be displayed above.
-3. `ticks`
- - The amount of ticks the TNT entity has before exploding.
-
-### Applying your custom `setTntCountdown` to a TNT.
+### Spawn TNT with Custom Tick amount
```java
public void overrideTntCountdownExample(Player viewer) {
@@ -47,6 +47,241 @@ public void overrideTntCountdownExample(Player viewer) {
}
```
+### Reset TNT Countdown Ticks Options
+
+```java
+public void clearTntCountdownOptionExample() {
+ this.tntCountdownModule.getOptions().remove(TntCountdownModule.TNT_TICKS, 80);
+}
+```
+
+### `setTntCountdown` Parameters
+
+1. `ApolloEntity`
+ - The TNT entity you want the custom countdown to be displayed above.
+2. `ticks`
+ - The amount of ticks the TNT entity has before exploding.
+
+
+
+
+
+### Set TNT Countdown Ticks Option
+
+```java
+public void setTntCountdownExample() {
+ Map properties = new HashMap<>();
+ properties.put("tnt-ticks", Value.newBuilder().setNumberValue(160).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("tnt_countdown", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+}
+```
+
+### Spawn TNT with Custom Tick amount
+
+```java
+private static Method entityGetter;
+
+static {
+ try {
+ TntCountdownProtoExample.entityGetter = Bukkit.class.getDeclaredMethod("getEntity", UUID.class);
+ } catch (Throwable throwable) {
+ // Ignore for legacy versions.
+ }
+}
+
+public void overrideTntCountdownExample(Player viewer) {
+ Location location = viewer.getLocation();
+ TNTPrimed entity = viewer.getWorld().spawn(location, TNTPrimed.class);
+ int customTicks = 200;
+
+ TNTPrimed target = null;
+ if (TntCountdownProtoExample.entityGetter != null) {
+ try {
+ target = (TNTPrimed) TntCountdownProtoExample.entityGetter.invoke(null, entity.getUniqueId());
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
+ } else {
+ for (World world : Bukkit.getWorlds()) {
+ for (TNTPrimed compare : world.getEntitiesByClass(TNTPrimed.class)) {
+ if (compare.getUniqueId().equals(entity.getUniqueId())) {
+ target = compare;
+ break;
+ }
+ }
+ }
+ }
+
+ if (target != null) {
+ target.setFuseTicks(customTicks);
+ }
+
+ SetTntCountdownMessage message = SetTntCountdownMessage.newBuilder()
+ .setEntityId(ProtobufUtil.createEntityIdProto(entity.getEntityId(), entity.getUniqueId()))
+ .setDurationTicks(customTicks)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset TNT Countdown Ticks Options
+
+```java
+public void clearTntCountdownOptionExample() {
+ Map properties = new HashMap<>();
+ properties.put("tnt-ticks", Value.newBuilder().setNumberValue(80).build());
+
+ ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("tnt_countdown", properties);
+ ProtobufPacketUtil.broadcastPacket(settings);
+}
+```
+
+### Modify Fuse Ticks on TNT Spawn
+
+```java
+@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+private void onTntSpawn(EntitySpawnEvent event) {
+ String entityName = event.getEntityType().name();
+ if (!entityName.equals("PRIMED_TNT") && !entityName.equals("TNT")) {
+ return;
+ }
+
+ TNTPrimed primed = (TNTPrimed) event.getEntity();
+ int customTicks = 200;
+ int defaultTicks = 80;
+ int currentTicks = primed.getFuseTicks();
+
+ if (currentTicks != defaultTicks) {
+ customTicks = currentTicks;
+
+ SetTntCountdownMessage message = SetTntCountdownMessage.newBuilder()
+ .setEntityId(ProtobufUtil.createEntityIdProto(primed.getEntityId(), primed.getUniqueId()))
+ .setDurationTicks(customTicks)
+ .build();
+
+ ProtobufPacketUtil.broadcastPacket(message);
+ }
+
+ primed.setFuseTicks(customTicks);
+}
+```
+
+
+
+
+
+### Create TNT Countdown Message
+
+```java
+private JsonObject createTNTCountdownMessage(Entity entity, int ticks) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.tntcountdown.v1.SetTntCountdownMessage");
+ message.add("entity_id", JsonUtil.createEntityIdObject(entity));
+ message.addProperty("duration_ticks", ticks);
+ return message;
+}
+```
+
+### Set TNT Countdown Ticks Option
+
+```java
+public void setTntCountdownExample() {
+ Map properties = new HashMap<>();
+ properties.put("tnt-ticks", 160);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("tnt_countdown", properties);
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+### Spawn TNT with Custom Tick amount
+
+```java
+private static Method entityGetter;
+
+static {
+ try {
+ TntCountdownJsonExample.entityGetter = Bukkit.class.getDeclaredMethod("getEntity", UUID.class);
+ } catch (Throwable throwable) {
+ // Ignore for legacy versions.
+ }
+}
+
+public void overrideTntCountdownExample(Player viewer) {
+ Location location = viewer.getLocation();
+ TNTPrimed entity = viewer.getWorld().spawn(location, TNTPrimed.class);
+ int customTicks = 200;
+
+ TNTPrimed target = null;
+ if (TntCountdownJsonExample.entityGetter != null) {
+ try {
+ target = (TNTPrimed) TntCountdownJsonExample.entityGetter.invoke(null, entity.getUniqueId());
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
+ } else {
+ for (World world : Bukkit.getWorlds()) {
+ for (TNTPrimed compare : world.getEntitiesByClass(TNTPrimed.class)) {
+ if (compare.getUniqueId().equals(entity.getUniqueId())) {
+ target = compare;
+ break;
+ }
+ }
+ }
+ }
+
+ if (target != null) {
+ target.setFuseTicks(customTicks);
+ }
+
+ JsonPacketUtil.sendPacket(viewer, this.createTNTCountdownMessage(entity, customTicks));
+}
+```
+
+### Reset TNT Countdown Ticks Options
+
+```java
+public void clearTntCountdownOptionExample() {
+ Map properties = new HashMap<>();
+ properties.put("tnt-ticks", 80);
+
+ JsonObject message = JsonUtil.createEnableModuleObjectWithType("tnt_countdown", properties);
+ JsonPacketUtil.broadcastPacket(message);
+}
+```
+
+### Modify Fuse Ticks on TNT Spawn
+
+```java
+@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+private void onTntSpawn(EntitySpawnEvent event) {
+ String entityName = event.getEntityType().name();
+ if (!entityName.equals("PRIMED_TNT") && !entityName.equals("TNT")) {
+ return;
+ }
+
+ TNTPrimed primed = (TNTPrimed) event.getEntity();
+ int customTicks = 200;
+ int defaultTicks = 80;
+ int currentTicks = primed.getFuseTicks();
+
+ if (currentTicks != defaultTicks) {
+ customTicks = currentTicks;
+
+ JsonPacketUtil.broadcastPacket(this.createTNTCountdownMessage(primed, customTicks));
+ }
+
+ primed.setFuseTicks(customTicks);
+}
+```
+
+
+
+
+
## Available options
- __`TNT_TICKS`__
diff --git a/docs/developers/modules/transfer.mdx b/docs/developers/modules/transfer.mdx
index 974cd394..088a5602 100644
--- a/docs/developers/modules/transfer.mdx
+++ b/docs/developers/modules/transfer.mdx
@@ -1,3 +1,4 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
import { Callout } from 'nextra-theme-docs'
# Transfer Module
@@ -67,7 +68,14 @@ If you own `example.com` and `server.net`, and want to auto-accept transfers bet
## Integration
-### Using the Transfer Packet
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Transfer Player
```java
public void transferExample(Player viewer) {
@@ -104,12 +112,13 @@ public void transferExample(Player viewer) {
}
```
-### Using the Ping Packet
+### Ping Servers
You can provide up to `10` different addresses per ping packet.
+
```java
public void pingExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -148,3 +157,115 @@ public void pingExample(Player viewer) {
});
}
```
+
+
+
+
+
+### Transfer Player
+
+```java
+public void transferExample(Player player) {
+ UUID requestId = UUID.randomUUID();
+
+ TransferRequest transferRequestMessage = TransferRequest.newBuilder()
+ .setRequestId(ByteString.copyFromUtf8(requestId.toString()))
+ .setServerIp("mc.hypixel.net")
+ .build();
+
+ ApolloRoundtripProtoListener.getInstance()
+ .sendRequest(player, requestId, transferRequestMessage, TransferResponse.class)
+ .thenAccept(response -> {
+ String message = "";
+
+ switch (response.getStatus()) {
+ case STATUS_ACCEPTED: {
+ message = "Transfer accepted! Goodbye!";
+ break;
+ }
+
+ case STATUS_REJECTED: {
+ message = "Transfer rejected by client!";
+ break;
+ }
+ }
+
+ player.sendMessage(message);
+ }).exceptionally(throwable -> {
+ player.sendMessage("Failed to receive a response in time.");
+ return null;
+ });
+}
+```
+
+### Ping Servers
+
+
+ You can provide up to `10` different addresses per ping packet.
+
+
+```java
+public void pingExample(Player player) {
+ UUID requestId = UUID.randomUUID();
+
+ PingRequest pingRequestMessage = PingRequest.newBuilder()
+ .setRequestId(ByteString.copyFromUtf8(requestId.toString()))
+ .addAllServerIps(Lists.newArrayList("mc.hypixel.net", "minehut.com"))
+ .build();
+
+ ApolloRoundtripProtoListener.getInstance()
+ .sendRequest(player, requestId, pingRequestMessage, PingResponse.class)
+ .thenAccept(response -> {
+ for (PingData pingData : response.getPingDataList()) {
+ String message = "";
+
+ switch (pingData.getStatus()) {
+ // Displays successful ping request to display the server IP and the players ping to that server.
+ case STATUS_SUCCESS: {
+ message = String.format("Ping to %s is %d ms.", pingData.getServerIp(), pingData.getPing());
+ break;
+ }
+
+ // If the ping request times-out
+ case STATUS_TIMED_OUT: {
+ message = String.format("Failed to ping %s", pingData.getServerIp());
+ break;
+ }
+ }
+
+ player.sendMessage(message);
+ }
+ }).exceptionally(throwable -> {
+ player.sendMessage("Failed to receive a response in time.");
+ return null;
+ });
+}
+```
+
+
+
+
+
+
+ This example is not implemented.
+
+
+### Transfer Player
+
+```java
+public void transferExample(Player player) {
+
+}
+```
+
+### Ping Servers
+
+```java
+public void pingExample(Player player) {
+
+}
+```
+
+
+
+
diff --git a/docs/developers/modules/vignette.mdx b/docs/developers/modules/vignette.mdx
index 64b37218..3a0db638 100644
--- a/docs/developers/modules/vignette.mdx
+++ b/docs/developers/modules/vignette.mdx
@@ -1,3 +1,5 @@
+import { Tab, Tabs } from 'nextra-theme-docs'
+
# Vignette Module
## Overview
@@ -8,7 +10,14 @@ The vignette module gives the ability to apply a full-screen image overlay with
## Integration
-### Display vignette to a player
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Display Vignette
```java
public void displayVignetteExample(Player viewer) {
@@ -24,6 +33,15 @@ public void displayVignetteExample(Player viewer) {
}
```
+### Reset Vignette
+
+```java
+public void resetVignetteExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.vignetteModule::resetVignette);
+}
+```
+
#### `Vignette` Options
`.resourceLocation(String)` is the resource location of the vignette.
@@ -38,11 +56,60 @@ public void displayVignetteExample(Player viewer) {
.opacity(0.75f)
```
-#### Resetting the vignette for a player
+
+
+
+
+### Display Vignette
+
+```java
+public void displayVignetteExample(Player viewer) {
+ DisplayVignetteMessage message = DisplayVignetteMessage.newBuilder()
+ .setResourceLocation("textures/misc/pumpkinblur.png")
+ .setOpacity(0.75f)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Vignette
```java
public void resetVignetteExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(this.vignetteModule::resetVignette);
+ ResetVignetteMessage message = ResetVignetteMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+### Display Vignette
+
+```java
+public void displayVignetteExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.vignette.v1.DisplayVignetteMessage");
+ message.addProperty("resource_location", "textures/misc/pumpkinblur.png");
+ message.addProperty("opacity", 0.75f);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Reset Vignette
+
+```java
+public void resetVignetteExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.vignette.v1.ResetVignetteMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
}
```
+
+
+
+
diff --git a/docs/developers/modules/waypoint.mdx b/docs/developers/modules/waypoint.mdx
index 6458bde0..560cd1ac 100644
--- a/docs/developers/modules/waypoint.mdx
+++ b/docs/developers/modules/waypoint.mdx
@@ -1,4 +1,5 @@
import { Tab, Tabs } from 'nextra-theme-docs'
+import { Callout } from 'nextra-theme-docs'
# Waypoint Module
@@ -21,6 +22,15 @@ The waypoint module allows you to interact with the Waypoints mod in Lunar Clien
## Integration
+### Sample Code
+Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
+
+
+
+
+
+### Displaying a Waypoint
+
```java
public void displayWaypointExample(Player viewer) {
Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
@@ -44,6 +54,24 @@ public void displayWaypointExample(Player viewer) {
}
```
+### Removing a Waypoint
+
+```java
+public void removeWaypointExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(apolloPlayer -> this.waypointModule.removeWaypoint(apolloPlayer, "KoTH"));
+}
+```
+
+### Resetting all Waypoints
+
+```java
+public void resetWaypointsExample(Player viewer) {
+ Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
+ apolloPlayerOpt.ifPresent(this.waypointModule::resetWaypoints);
+}
+```
+
### `Waypoint` Options
`.name(String)` is the name of the waypoint. Keep in mind this is displayed to players.
@@ -112,24 +140,105 @@ Custom colors can be created from any RGB values using `new Color(int red, int g
.hidden(false)
```
-### Removing specific waypoints for a player
+
+
+
+
+
+ Make sure the server is sending the world name to the client as show in the [Player Detection](/apollo/developers/lightweight/protobuf/player-detection) example.
+
+
+### Displaying a Waypoint
+
+```java
+public void displayWaypointExample(Player viewer) {
+ DisplayWaypointMessage message = DisplayWaypointMessage.newBuilder()
+ .setName("KoTH")
+ .setLocation(ProtobufUtil.createBlockLocationProto(new Location(viewer.getWorld(), 500, 100, 500)))
+ .setColor(ProtobufUtil.createColorProto(Color.ORANGE))
+ .setPreventRemoval(false)
+ .setHidden(false)
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Removing a Waypoint
```java
public void removeWaypointExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(apolloPlayer -> this.waypointModule.removeWaypoint(apolloPlayer, "KoTH"));
+ RemoveWaypointMessage message = RemoveWaypointMessage.newBuilder()
+ .setName("KoTH")
+ .build();
+
+ ProtobufPacketUtil.sendPacket(viewer, message);
}
```
-### Resetting all waypoints for a player
+### Resetting all Waypoints
```java
public void resetWaypointsExample(Player viewer) {
- Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
- apolloPlayerOpt.ifPresent(this.waypointModule::resetWaypoints);
+ ResetWaypointsMessage message = ResetWaypointsMessage.getDefaultInstance();
+ ProtobufPacketUtil.sendPacket(viewer, message);
}
```
+
+
+
+
+
+ Make sure the server is sending the world name to the client as show in the [Player Detection](/apollo/developers/lightweight/protobuf/player-detection) example.
+
+
+### Displaying a Waypoint
+
+```java
+public void displayWaypointExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.waypoint.v1.DisplayWaypointMessage");
+ message.addProperty("name", "KoTH");
+ message.add("location", JsonUtil.createBlockLocationObject(
+ new Location(Bukkit.getWorld("world"), 500, 100, 500)
+ ));
+ message.add("color", JsonUtil.createColorObject(Color.ORANGE));
+ message.addProperty("prevent_removal", false);
+ message.addProperty("hidden", false);
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Removing a Waypoint
+
+```java
+public void removeWaypointExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.waypoint.v1.RemoveWaypointMessage");
+ message.addProperty("name", "KoTH");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+### Resetting all Waypoints
+
+```java
+public void resetWaypointsExample(Player viewer) {
+ JsonObject message = new JsonObject();
+ message.addProperty("@type", "type.googleapis.com/lunarclient.apollo.waypoint.v1.ResetWaypointsMessage");
+
+ JsonPacketUtil.sendPacket(viewer, message);
+}
+```
+
+
+
+
+
+
## Available options
- __`SERVER_HANDLES_WAYPOINTS`__
diff --git a/docs/internals/lightweight.mdx b/docs/internals/lightweight.mdx
deleted file mode 100644
index eed9e0e9..00000000
--- a/docs/internals/lightweight.mdx
+++ /dev/null
@@ -1,232 +0,0 @@
-import { Tab, Tabs } from 'nextra-theme-docs'
-
-# Lightweight
-
-Our lightweight integration allows for Apollo features to be used, without the need for running the entire Apollo plugin. We will introduce you to three different methods that all achieve the same goal, while utilizing separate approaches. At the end of the day, all the methods displayed send the JSON message through the plugin messaging channel `apollo:json`. Each method offers different trade-offs between complexity, flexibility, and performance. Choose the method that best fits your use case and environment.
-
-## Message format
-
-The message format used to communicate, follows a loosely structured JSON schema. The schema is defined using Protocol Buffers (protobuf) and includes various fields to achieve the end result, in this example-case displaying a waypoint. While the fields will change depending on the feature you're trying to implement, the `@type` will also remain. It should always be at the top, as shown. You can locate all the `@type` protos from this page: https://buf.build/lunarclient/apollo.
-```JSON
-{
- "@type": "type.googleapis.com/lunarclient.apollo.waypoint.v1.DisplayWaypointMessage", // The protobuf message type
- "name": "KoTH",
- "location": {
- "world": "world",
- "x": 150,
- "y": 100,
- "z": -150
- },
- "color": {
- "color": 255
- },
- "preventRemoval": true
-}
-```
-
-### Usage Methods
-Explore each method by cycling through each tab, to find the best fit for your requirements and needs.
-
-
-
-
-
-### Method 1: Using the `apollo-protos` & `protobuf-java-util` libraries
-
-This method leverages the apollo-protos library and protobuf's native serialization mechanism, which offers efficient serialization and maintains strong typing and schema validation. It involves creating a type registry, serializing messages into protobuf format, and then converting them into JSON for transmission.
-
-**Steps**
-
-1. **Create a TypeRegistry**: Register the message types you are using.
- ```java
- TypeRegistry registry = TypeRegistry.newBuilder()
- .add(DisplayWaypointMessage.getDescriptor())
- .add(ConfigurableSettings.getDescriptor())
- .add(OverrideConfigurableSettingsMessage.getDescriptor())
- .build();
- ```
-
-2. **Create the protobuf printer with the registry**:
- ```java
- JsonFormat.Printer printer = JsonFormat.printer().usingTypeRegistry(registry);
- ```
-
-3. **Construct the messages**:
- - **Enable Module Message**:
- ```java
- OverrideConfigurableSettingsMessage enableModuleMessage = OverrideConfigurableSettingsMessage.newBuilder()
- .addConfigurableSettings(
- ConfigurableSettings.newBuilder()
- .setApolloModule("waypoint")
- .setEnable(true)
- .build()
- ).build();
- ```
-
- - **Display Waypoint Message**:
- ```java
- DisplayWaypointMessage waypointMessage = DisplayWaypointMessage.newBuilder()
- .setName("KoTH")
- .setLocation(
- BlockLocation.newBuilder()
- .setWorld("world")
- .setX(150)
- .setY(100)
- .setZ(-150)
- .build())
- .setColor(
- Color.newBuilder()
- .setColor(255)
- .build())
- .setPreventRemoval(true)
- .build();
- ```
-
-4. **Pack the messages into `Any` type and serialize**:
- ```java
- Any enableModuleAny = Any.pack(enableModuleMessage);
- Any displayWaypointAny = Any.pack(waypointMessage);
-
- try {
- byte[] enableModuleBytes = printer.print(enableModuleAny).getBytes();
- byte[] displayWaypointBytes = printer.print(displayWaypointAny).getBytes();
-
- player.sendPluginMessage(this, "apollo:json", enableModuleBytes);
- player.sendPluginMessage(this, "apollo:json", displayWaypointBytes);
- } catch (InvalidProtocolBufferException e) {
- throw new RuntimeException(e);
- }
- ```
-
-## Adding the repository and dependencies
-
-
-
- ```xml filename="pom.xml"
-
-
- lunarclient
- https://repo.lunarclient.dev
-
-
-
-
-
- com.lunarclient
- apollo-protos
- 1.0-SNAPSHOT
-
-
- com.google.protobuf
- protobuf-java-util
- 3.25.0
-
-
- ```
-
-
- ```groovy filename="build.gradle"
- repositories {
- maven {
- name = 'lunarclient'
- url = 'https://repo.lunarclient.dev'
- }
- }
-
- dependencies {
- api 'com.lunarclient:apollo-protos:1.0-SNAPSHOT'
- api 'com.google.protobuf:protobuf-java-util:3.25.0'
- }
- ```
-
-
- ```kotlin filename="build.gradle.kts"
- repositories {
- maven {
- name = "lunarclient"
- url = uri("https://repo.lunarclient.dev")
- }
- }
-
- dependencies {
- api("com.lunarclient:apollo-protos:1.0-SNAPSHOT")
- api("com.google.protobuf:protobuf-java-util:3.25.0")
- }
- ```
-
-
-
-
-
-
-
-### Method 2: Manual JSON Object Construction
-
-This method involves manually constructing JSON objects using a JSON library (e.g., Gson) and then converting these objects into byte arrays for transmission. It allows for dynamic and programmatic construction of JSON objects, offering flexibility in modifying the JSON structure. Available fields for each message, including their types, are available on the Buf Schema Registry at https://buf.build/lunarclient/apollo.
-
-**Steps**
-
-1. **Create JSON objects**:
- - **Enable Module Message**:
- ```java
- JsonObject configurableSetting = new JsonObject();
- configurableSetting.addProperty("apolloModule", "waypoint");
- configurableSetting.addProperty("enable", true);
-
- JsonArray configurableSettingsArray = new JsonArray();
- configurableSettingsArray.add(configurableSetting);
-
- JsonObject settingsObject = new JsonObject();
- settingsObject.addProperty("@type", "type.googleapis.com/lunarclient.apollo.configurable.v1.OverrideConfigurableSettingsMessage");
- settingsObject.add("configurableSettings", configurableSettingsArray);
-
- player.sendPluginMessage(this, "apollo:json", settingsObject.toString().getBytes());
- ```
-
- - **Display Waypoint Message**:
- ```java
- JsonObject location = new JsonObject();
- location.addProperty("world", "world");
- location.addProperty("x", 150);
- location.addProperty("y", 100);
- location.addProperty("z", -150);
-
- JsonObject color = new JsonObject();
- color.addProperty("color", 255);
-
- JsonObject waypointObject = new JsonObject();
- waypointObject.addProperty("@type", "type.googleapis.com/lunarclient.apollo.waypoint.v1.DisplayWaypointMessage");
- waypointObject.addProperty("name", "KoTH");
- waypointObject.add("location", location);
- waypointObject.add("color", color);
- waypointObject.addProperty("preventRemoval", true);
-
- player.sendPluginMessage(this, "apollo:json", waypointObject.toString().getBytes());
- ```
-
-
-
-
-
-### Method 3: Direct JSON String Serialization
-
-This method directly uses JSON strings to send the messages. The JSON strings are manually constructed to match the required format, offering a simple and straightforward approach without requiring external dependencies for serialization. Available fields for each message, including their types, are available on the Buf Schema Registry at https://buf.build/lunarclient/apollo.
-
-**Steps**
-
-1. **Construct JSON strings**:
- ```java
- String enableModuleData = "{\"@type\":\"type.googleapis.com/lunarclient.apollo.configurable.v1.OverrideConfigurableSettingsMessage\",\"configurableSettings\":[{\"apolloModule\":\"waypoint\",\"enable\":true}]}";
- String displayWaypointData = "{\"@type\":\"type.googleapis.com/lunarclient.apollo.waypoint.v1.DisplayWaypointMessage\",\"name\":\"KoTH\",\"location\":{\"world\":\"world\",\"x\":150,\"y\":100,\"z\":-150},\"color\":{\"color\":255},\"preventRemoval\":true}";
- ```
-
-2. **Send the JSON strings as plugin messages**:
- ```java
- player.sendPluginMessage(this, "apollo:json", enableModuleData.getBytes());
- player.sendPluginMessage(this, "apollo:json", displayWaypointData.getBytes());
- ```
-
-
-
-
-
diff --git a/docs/introduction.mdx b/docs/introduction.mdx
index 90a5a0d8..f9ca50bb 100644
--- a/docs/introduction.mdx
+++ b/docs/introduction.mdx
@@ -1,3 +1,5 @@
+import { Callout } from 'nextra-theme-docs'
+
# Introduction
Apollo is a powerful tool that allows developers to create custom integrations with Lunar Client.
@@ -10,6 +12,10 @@ This documentation will provide you with all information you'll need to know to
We'll cover the basics of Apollo, from changing the configuration file to integrating your own features using each module.
Inside the module breakdowns, for developers, we'll include code snippets along with photos, videos and gifs related to the module to ensure you get the most out of Apollo.
+
+ Need just the essentials? [Lightweight](/apollo/developers/lightweight/introduction) allows you to use Apollo features without the full plugin!
+
+
### Useful Links
🔗 [Lunar Client Website](https://www.lunarclient.com/)