Skip to content

Commit

Permalink
Fixed hit cooldown issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Despical committed Nov 17, 2024
1 parent 3d0c247 commit ffa68c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.despical</groupId>
<artifactId>one-in-the-chamber</artifactId>
<version>2.7.5</version>
<version>2.7.6</version>

<name>One In The Chamber</name>
<inceptionYear>2019</inceptionYear>
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/me/despical/oitc/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void updateAttackCooldown() {
Optional.ofNullable(player.getAttribute(Attribute.GENERIC_ATTACK_SPEED)).ifPresent(attribute -> {
this.attackCooldown = attribute.getBaseValue();

attribute.setBaseValue(plugin.getConfig().getDouble("Hit-Cooldown-Delay", 4));
attribute.setBaseValue(plugin.getConfig().getDouble("Hit-Cooldown-Delay", 20));
});
}

Expand All @@ -175,7 +175,13 @@ public void resetAttackCooldown() {

if (player == null) return;

Optional.ofNullable(player.getAttribute(Attribute.GENERIC_ATTACK_SPEED)).ifPresent(attribute -> attribute.setBaseValue(this.attackCooldown));
Optional.ofNullable(player.getAttribute(Attribute.GENERIC_ATTACK_SPEED)).ifPresent(attribute -> {
if (attackCooldown == 0) {
attackCooldown = attribute.getDefaultValue();
}

attribute.setBaseValue(attackCooldown);
});
}

public void setPinnedPage(final Page pinnedPage) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Chat-Format-Enabled: true
Disable-Separate-Chat: false

# The delay between hitting players. ONLY EFFECTED in Minecraft 1.9+
Hit-Cooldown-Delay: 16
Hit-Cooldown-Delay: 20

# Basic permissions for game, permissions explained here: https://github.com/Despical/OITC/wiki/Commands-and-permissions#basic-permissions
Basic-Permissions:
Expand Down

0 comments on commit ffa68c9

Please sign in to comment.