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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,32 @@
/**
* Represents a staff mod that can be enabled on the client.
*
* <p>Enabling a staff mod may cause compatibility issues with anti-cheats.</p>
*
* @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

}
6 changes: 3 additions & 3 deletions docs/developers/lightweight/protobuf.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Available fields for each message, including their types, are available on the B
<dependency>
<groupId>com.lunarclient</groupId>
<artifactId>apollo-protos</artifactId>
<version>0.2.5</version>
<version>0.2.7</version>
</dependency>
</dependencies>
```
Expand All @@ -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'
}
```
</Tab>
Expand All @@ -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")
}
```
</Tab>
Expand Down
29 changes: 20 additions & 9 deletions docs/developers/modules/staffmod.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ 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)

<div style={{ textAlign: "center" }}>
<small>Allow your staff to use hidden staff only mods, like xray!</small>
</div>

<Callout type="warning">
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.
</Callout>

## Integration

### Sample Code
Expand All @@ -37,7 +41,8 @@ public void enableStaffModsExample(Player viewer) {
}

Optional<ApolloPlayer> 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));
}
```

Expand All @@ -46,7 +51,8 @@ public void enableStaffModsExample(Player viewer) {
```java
public void disableStaffModsExample(Player viewer) {
Optional<ApolloPlayer> 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)));
}
```

Expand All @@ -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.

</Tab>

Expand All @@ -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();

Expand All @@ -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);
Expand All @@ -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);

Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -43,13 +43,15 @@ public void enableStaffModsExample(Player viewer) {
}

Optional<ApolloPlayer> 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<ApolloPlayer> 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)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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();

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading