From ef39b78e99c681add7d0b9e863d552beba3912b2 Mon Sep 17 00:00:00 2001 From: ItsNature Date: Thu, 8 Oct 2026 23:27:31 +0200 Subject: [PATCH] Add more staff mods --- .../apollo/module/staffmod/StaffMod.java | 24 ++++++++++++++- docs/developers/lightweight/protobuf.mdx | 6 ++-- docs/developers/modules/staffmod.mdx | 29 +++++++++++++------ .../api/module/StaffModApiExample.java | 8 +++-- .../json/module/StaffModJsonExample.java | 8 ++--- .../proto/module/StaffModProtoExample.java | 6 ++-- gradle/libs.versions.toml | 2 +- 7 files changed, 59 insertions(+), 24 deletions(-) diff --git a/api/src/main/java/com/lunarclient/apollo/module/staffmod/StaffMod.java b/api/src/main/java/com/lunarclient/apollo/module/staffmod/StaffMod.java index 6585a5b2..14202213 100644 --- a/api/src/main/java/com/lunarclient/apollo/module/staffmod/StaffMod.java +++ b/api/src/main/java/com/lunarclient/apollo/module/staffmod/StaffMod.java @@ -26,10 +26,32 @@ /** * Represents a staff mod that can be enabled on the client. * + *

Enabling a staff mod may cause compatibility issues with anti-cheats.

+ * * @since 1.0.0 */ public enum StaffMod { - XRAY + /** + * Lets the player see through blocks. + * + * @since 1.0.0 + */ + XRAY, + + /** + * Automatically jumps while moving and keeps air speed up. + * + * @since 1.3.0 + */ + BHOP, + + /** + * Shows player nametags through walls and from far away, including + * sneaking, invisible and team-hidden players. + * + * @since 1.3.0 + */ + NAMETAGS } diff --git a/docs/developers/lightweight/protobuf.mdx b/docs/developers/lightweight/protobuf.mdx index 5845b980..5678478b 100644 --- a/docs/developers/lightweight/protobuf.mdx +++ b/docs/developers/lightweight/protobuf.mdx @@ -26,7 +26,7 @@ Available fields for each message, including their types, are available on the B com.lunarclient apollo-protos - 0.2.5 + 0.2.7 ``` @@ -41,7 +41,7 @@ Available fields for each message, including their types, are available on the B } dependencies { - api 'com.lunarclient:apollo-protos:0.2.5' + api 'com.lunarclient:apollo-protos:0.2.7' } ``` @@ -55,7 +55,7 @@ Available fields for each message, including their types, are available on the B } dependencies { - api("com.lunarclient:apollo-protos:0.2.5") + api("com.lunarclient:apollo-protos:0.2.7") } ``` diff --git a/docs/developers/modules/staffmod.mdx b/docs/developers/modules/staffmod.mdx index 8c547999..12d9a204 100644 --- a/docs/developers/modules/staffmod.mdx +++ b/docs/developers/modules/staffmod.mdx @@ -7,7 +7,7 @@ import { Callout, Tab, Tabs } from 'nextra-theme-docs' The staff mod module allows you to interact with Lunar Client's built in staff mods. - Ability to grant and remove staff mods found in Lunar Client for players. - - Ability to allow players to enable/disable the X-ray mod. + - Ability to allow players to enable/disable the X-ray, BHop and Nametags mods. ![Staff Mod Module Example](/modules/staffmod/overview.png#center) @@ -15,6 +15,10 @@ The staff mod module allows you to interact with Lunar Client's built in staff m Allow your staff to use hidden staff only mods, like xray! + + Enabling a staff mod may cause compatibility issues with anti-cheats. For example, your anti-cheat may flag staff members who use BHop, so exempt them from movement checks while it is granted. + + ## Integration ### Sample Code @@ -37,7 +41,8 @@ public void enableStaffModsExample(Player viewer) { } Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); - apolloPlayerOpt.ifPresent(apolloPlayer -> this.staffModModule.enableStaffMods(apolloPlayer, Collections.singletonList(StaffMod.XRAY), true)); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.staffModModule.enableStaffMods(apolloPlayer, + Arrays.asList(StaffMod.XRAY, StaffMod.BHOP, StaffMod.NAMETAGS), true)); } ``` @@ -46,7 +51,8 @@ public void enableStaffModsExample(Player viewer) { ```java public void disableStaffModsExample(Player viewer) { Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); - apolloPlayerOpt.ifPresent(apolloPlayer -> this.staffModModule.disableStaffMods(apolloPlayer, Collections.singletonList(StaffMod.XRAY))); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.staffModModule.disableStaffMods(apolloPlayer, + Arrays.asList(StaffMod.XRAY, StaffMod.BHOP, StaffMod.NAMETAGS))); } ``` @@ -62,6 +68,11 @@ public void disableStaffModsExample(Player viewer) { ## `StaffMod` Types * `XRAY` + - Lets players see through blocks. +* `BHOP` + - Automatically jumps while moving and keeps air speed up. +* `NAMETAGS` + - Shows player nametags through walls and from far away, including sneaking, invisible and team-hidden players. @@ -80,7 +91,7 @@ public void enableStaffModsExample(Player viewer) { } EnableStaffModsMessage message = EnableStaffModsMessage.newBuilder() - .addAllStaffMods(Collections.singletonList(StaffMod.STAFF_MOD_XRAY)) + .addAllStaffMods(Arrays.asList(StaffMod.STAFF_MOD_XRAY, StaffMod.STAFF_MOD_BHOP, StaffMod.STAFF_MOD_NAMETAGS)) .setEnabledByDefault(true) .build(); @@ -93,7 +104,7 @@ public void enableStaffModsExample(Player viewer) { ```java public void disableStaffModsExample(Player viewer) { DisableStaffModsMessage message = DisableStaffModsMessage.newBuilder() - .addAllStaffMods(Collections.singletonList(StaffMod.STAFF_MOD_XRAY)) + .addAllStaffMods(Arrays.asList(StaffMod.STAFF_MOD_XRAY, StaffMod.STAFF_MOD_BHOP, StaffMod.STAFF_MOD_NAMETAGS)) .build(); ProtobufPacketUtil.sendPacket(viewer, message); @@ -116,8 +127,8 @@ public void enableStaffModsExample(Player viewer) { return; } - // 1 = xray - JsonArray staffMods = Stream.of(1) + // 1 = xray, 2 = bhop, 3 = nametags + JsonArray staffMods = Stream.of(1, 2, 3) .map(JsonPrimitive::new) .collect(JsonArray::new, JsonArray::add, JsonArray::addAll); @@ -134,8 +145,8 @@ public void enableStaffModsExample(Player viewer) { ```java public void disableStaffModsExample(Player viewer) { - // 1 = xray - JsonArray staffMods = Stream.of(1) + // 1 = xray, 2 = bhop, 3 = nametags + JsonArray staffMods = Stream.of(1, 2, 3) .map(JsonPrimitive::new) .collect(JsonArray::new, JsonArray::add, JsonArray::addAll); diff --git a/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/StaffModApiExample.java b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/StaffModApiExample.java index d38ae3da..6cee2b2b 100644 --- a/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/StaffModApiExample.java +++ b/example/bukkit/api/src/main/java/com/lunarclient/apollo/example/api/module/StaffModApiExample.java @@ -28,7 +28,7 @@ import com.lunarclient.apollo.module.staffmod.StaffMod; import com.lunarclient.apollo.module.staffmod.StaffModModule; import com.lunarclient.apollo.player.ApolloPlayer; -import java.util.Collections; +import java.util.Arrays; import java.util.Optional; import org.bukkit.entity.Player; @@ -43,13 +43,15 @@ public void enableStaffModsExample(Player viewer) { } Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); - apolloPlayerOpt.ifPresent(apolloPlayer -> this.staffModModule.enableStaffMods(apolloPlayer, Collections.singletonList(StaffMod.XRAY), true)); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.staffModModule.enableStaffMods(apolloPlayer, + Arrays.asList(StaffMod.XRAY, StaffMod.BHOP, StaffMod.NAMETAGS), true)); } @Override public void disableStaffModsExample(Player viewer) { Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); - apolloPlayerOpt.ifPresent(apolloPlayer -> this.staffModModule.disableStaffMods(apolloPlayer, Collections.singletonList(StaffMod.XRAY))); + apolloPlayerOpt.ifPresent(apolloPlayer -> this.staffModModule.disableStaffMods(apolloPlayer, + Arrays.asList(StaffMod.XRAY, StaffMod.BHOP, StaffMod.NAMETAGS))); } } diff --git a/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/StaffModJsonExample.java b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/StaffModJsonExample.java index ee0d0d87..058d07d4 100644 --- a/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/StaffModJsonExample.java +++ b/example/bukkit/json/src/main/java/com/lunarclient/apollo/example/json/module/StaffModJsonExample.java @@ -39,8 +39,8 @@ public void enableStaffModsExample(Player viewer) { return; } - // 1 = xray - JsonArray staffMods = Stream.of(1) + // 1 = xray, 2 = bhop, 3 = nametags + JsonArray staffMods = Stream.of(1, 2, 3) .map(JsonPrimitive::new) .collect(JsonArray::new, JsonArray::add, JsonArray::addAll); @@ -54,8 +54,8 @@ public void enableStaffModsExample(Player viewer) { @Override public void disableStaffModsExample(Player viewer) { - // 1 = xray - JsonArray staffMods = Stream.of(1) + // 1 = xray, 2 = bhop, 3 = nametags + JsonArray staffMods = Stream.of(1, 2, 3) .map(JsonPrimitive::new) .collect(JsonArray::new, JsonArray::add, JsonArray::addAll); diff --git a/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/StaffModProtoExample.java b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/StaffModProtoExample.java index 9af09b1a..1dc8e02b 100644 --- a/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/StaffModProtoExample.java +++ b/example/bukkit/proto/src/main/java/com/lunarclient/apollo/example/proto/module/StaffModProtoExample.java @@ -28,7 +28,7 @@ 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 java.util.Arrays; import org.bukkit.entity.Player; public class StaffModProtoExample extends StaffModExample { @@ -40,7 +40,7 @@ public void enableStaffModsExample(Player viewer) { } EnableStaffModsMessage message = EnableStaffModsMessage.newBuilder() - .addAllStaffMods(Collections.singletonList(StaffMod.STAFF_MOD_XRAY)) + .addAllStaffMods(Arrays.asList(StaffMod.STAFF_MOD_XRAY, StaffMod.STAFF_MOD_BHOP, StaffMod.STAFF_MOD_NAMETAGS)) .setEnabledByDefault(true) .build(); @@ -50,7 +50,7 @@ public void enableStaffModsExample(Player viewer) { @Override public void disableStaffModsExample(Player viewer) { DisableStaffModsMessage message = DisableStaffModsMessage.newBuilder() - .addAllStaffMods(Collections.singletonList(StaffMod.STAFF_MOD_XRAY)) + .addAllStaffMods(Arrays.asList(StaffMod.STAFF_MOD_XRAY, StaffMod.STAFF_MOD_BHOP, StaffMod.STAFF_MOD_NAMETAGS)) .build(); ProtobufPacketUtil.sendPacket(viewer, message); diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4ed5c3ef..b65deeaf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ geantyref = "1.3.11" idea = "1.1.7" jetbrains = "24.0.1" lombok = "1.18.38" -protobuf = "0.2.6" +protobuf = "0.2.7" gson = "2.10.1" shadow = "9.4.1" spotless = "8.4.0"