Skip to content

Commit b27df6e

Browse files
committed
Add Combat module lightweight example docs
1 parent 8dc1fbf commit b27df6e

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

docs/developers/modules/combat.mdx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Tab, Tabs } from 'nextra-theme-docs'
2+
13
# Combat Module
24

35
## Overview
@@ -6,6 +8,57 @@ The combat module allows you to modify certain aspects of combat that are usuall
68

79
- Adds the ability to disable the miss penalty, on all versions 1.8 and above.
810

11+
### Sample Code
12+
Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
13+
14+
<Tabs items={['Apollo API', 'apollo-protos library', 'Manual JSON Object Construction']}>
15+
16+
<Tab>
17+
18+
### Toggle Miss Penalty
19+
20+
```java
21+
public void setDisableMissPenalty(boolean value) {
22+
this.combatModule.getOptions().set(CombatModule.DISABLE_MISS_PENALTY, value);
23+
}
24+
```
25+
26+
</Tab>
27+
28+
<Tab>
29+
30+
### Toggle Miss Penalty
31+
32+
```java
33+
public void setDisableMissPenalty(boolean value) {
34+
Map<String, Value> properties = new HashMap<>();
35+
properties.put("disable-miss-penalty", Value.newBuilder().setBoolValue(value).build());
36+
37+
ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("combat", properties);
38+
ProtobufPacketUtil.broadcastPacket(settings);
39+
}
40+
```
41+
42+
</Tab>
43+
44+
<Tab>
45+
46+
### Toggle Miss Penalty
47+
48+
```java
49+
public void setDisableMissPenalty(boolean value) {
50+
Map<String, Object> properties = new HashMap<>();
51+
properties.put("disable-miss-penalty", value);
52+
53+
JsonObject message = JsonUtil.createEnableModuleObjectWithType("combat", properties);
54+
JsonPacketUtil.broadcastPacket(message);
55+
}
56+
```
57+
58+
</Tab>
59+
60+
</Tabs>
61+
962
## Available options
1063

1164
- __`DISABLE_MISS_PENALTY`__

0 commit comments

Comments
 (0)