Skip to content
Merged
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 @@ -52,6 +52,22 @@ public final class CombatModule extends ApolloModule {
.node("disable-miss-penalty").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();

/**
* Whether the player gets a hit delay for a missed hit while
* targeting a block. Applies to all versions 1.8 and above.
*
* <p>Enabling this option may cause compatibility issues with anti-cheats.</p>
*
* @since 1.2.8
*/
public static final SimpleOption<Boolean> DISABLE_BLOCK_MISS_PENALTY = Option.<Boolean>builder()
.comment(
"Set to 'true' to remove the miss penalty when targeting a block on all versions 1.8 and above, otherwise 'false'.",
"Enabling this option may cause compatibility issues with anti-cheats."
)
.node("disable-block-miss-penalty").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();

/**
* Whether the player can dig and use an item at the same time,
* like in 1.7. Applies to all versions 1.8 and above.
Expand All @@ -71,6 +87,7 @@ public final class CombatModule extends ApolloModule {
CombatModule() {
this.registerOptions(
CombatModule.DISABLE_MISS_PENALTY,
CombatModule.DISABLE_BLOCK_MISS_PENALTY,
CombatModule.ALLOW_DIG_AND_USE
);
}
Expand Down
1 change: 1 addition & 0 deletions docs/developers/lightweight/json/packet-util.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static {
// While using the Apollo plugin this would be equivalent to modifying the config.yml
CONFIG_MODULE_PROPERTIES.put("colored_fire", "persist-colors-on-unload", false);
CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", false);
CONFIG_MODULE_PROPERTIES.put("combat", "disable-block-miss-penalty", false);
CONFIG_MODULE_PROPERTIES.put("combat", "allow-dig-and-use", false);
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-attack.send-packet", false);
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-chat-open.send-packet", false);
Expand Down
1 change: 1 addition & 0 deletions docs/developers/lightweight/protobuf/packet-util.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static {
// While using the Apollo plugin this would be equivalent to modifying the config.yml
CONFIG_MODULE_PROPERTIES.put("colored_fire", "persist-colors-on-unload", Value.newBuilder().setBoolValue(false).build());
CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", Value.newBuilder().setBoolValue(false).build());
CONFIG_MODULE_PROPERTIES.put("combat", "disable-block-miss-penalty", Value.newBuilder().setBoolValue(false).build());
CONFIG_MODULE_PROPERTIES.put("combat", "allow-dig-and-use", Value.newBuilder().setBoolValue(false).build());
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-attack.send-packet", Value.newBuilder().setBoolValue(false).build());
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-chat-open.send-packet", Value.newBuilder().setBoolValue(false).build());
Expand Down
38 changes: 38 additions & 0 deletions docs/developers/modules/combat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Callout, Tab, Tabs } from 'nextra-theme-docs'
The combat module allows you to modify certain aspects of combat that are usually handled client-sided.

- Adds the ability to disable the miss penalty, on all versions 1.8 and above.
- Adds the ability to disable the miss penalty when targeting a block, on all versions 1.8 and above.
- Adds the ability to dig and use an item at the same time, like in 1.7, on all versions 1.8 and above.

### Sample Code
Expand All @@ -28,6 +29,14 @@ public void setDisableMissPenalty(boolean value) {
}
```

### Toggle Block Miss Penalty

```java
public void setDisableBlockMissPenalty(boolean value) {
this.combatModule.getOptions().set(CombatModule.DISABLE_BLOCK_MISS_PENALTY, value);
}
```

### Toggle Dig and Use

```java
Expand Down Expand Up @@ -56,6 +65,18 @@ public void setDisableMissPenalty(boolean value) {
}
```

**Toggle Block Miss Penalty**

```java
public void setDisableBlockMissPenalty(boolean value) {
Map<String, Value> properties = new HashMap<>();
properties.put("disable-block-miss-penalty", Value.newBuilder().setBoolValue(value).build());

ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("combat", properties);
ProtobufPacketUtil.broadcastPacket(settings);
}
```

**Toggle Dig and Use**

```java
Expand Down Expand Up @@ -88,6 +109,18 @@ public void setDisableMissPenalty(boolean value) {
}
```

**Toggle Block Miss Penalty**

```java
public void setDisableBlockMissPenalty(boolean value) {
Map<String, Object> properties = new HashMap<>();
properties.put("disable-block-miss-penalty", value);

JsonObject message = JsonUtil.createEnableModuleObjectWithType("combat", properties);
JsonPacketUtil.broadcastPacket(message);
}
```

**Toggle Dig and Use**

```java
Expand All @@ -111,6 +144,11 @@ public void setAllowDigAndUse(boolean value) {
- Values
- Type: `Boolean`
- Default: `false`
- __`DISABLE_BLOCK_MISS_PENALTY`__
- Whether the player gets a hit delay for a missed hit while targeting a block. Applies to all versions 1.8 and above. Enabling this option may cause compatibility issues with anti-cheats.
- Values
- Type: `Boolean`
- Default: `false`
- __`ALLOW_DIG_AND_USE`__
- Whether the player can dig and use an item at the same time, like in 1.7. Applies to all versions 1.8 and above. Enabling this option may cause compatibility issues with anti-cheats.
- Values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public final class JsonPacketUtil {
// While using the Apollo plugin this would be equivalent to modifying the config.yml
CONFIG_MODULE_PROPERTIES.put("colored_fire", "persist-colors-on-unload", false);
CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", false);
CONFIG_MODULE_PROPERTIES.put("combat", "disable-block-miss-penalty", false);
CONFIG_MODULE_PROPERTIES.put("combat", "allow-dig-and-use", false);
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-attack.send-packet", false);
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-chat-open.send-packet", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public final class ProtobufPacketUtil {
// While using the Apollo plugin this would be equivalent to modifying the config.yml
CONFIG_MODULE_PROPERTIES.put("colored_fire", "persist-colors-on-unload", Value.newBuilder().setBoolValue(false).build());
CONFIG_MODULE_PROPERTIES.put("combat", "disable-miss-penalty", Value.newBuilder().setBoolValue(false).build());
CONFIG_MODULE_PROPERTIES.put("combat", "disable-block-miss-penalty", Value.newBuilder().setBoolValue(false).build());
CONFIG_MODULE_PROPERTIES.put("combat", "allow-dig-and-use", Value.newBuilder().setBoolValue(false).build());
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-attack.send-packet", Value.newBuilder().setBoolValue(false).build());
CONFIG_MODULE_PROPERTIES.put("packet_enrichment", "player-chat-open.send-packet", Value.newBuilder().setBoolValue(false).build());
Expand Down
Loading