Skip to content

Commit

Permalink
1.19.0 - BowBomb exploit patch
Browse files Browse the repository at this point in the history
  • Loading branch information
moom0o committed Oct 27, 2021
1 parent c2a0222 commit 76ade10
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ MaxEntitiesInChunk: 100 # Does not include living entities. (animals/monsters) u
LogEntityRemovals: false
EntityCheckTimeTicks: 20 # 1 second

PreventBowBombExploit: true # Please report any problems in GitHub/Discord.
MaxBowSquaredVelocity: 15 # Fully pulled bow is ~9-10. 15 is default just to be safe.

AntiBedTrap: false
AntiBedTrapDeathAmount: 2 # x deaths in 30 secs will reset someones bed.

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.moomoo</groupId>
<artifactId>anarchyexploitfixes</artifactId>
<version>1.18.21</version>
<version>1.19.0</version>
<packaging>jar</packaging>

<name>AnarchyExploitFixes</name>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/me/moomoo/anarchyexploitfixes/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public void onEnable() {
new RenderDistance(this), new CoordExploits(this),
new CommandExploits(this), new WitherSpawning(this),
new Burrow(this), new BookBan(this),
new AntiBedTrap(this), new Commands(this)
new AntiBedTrap(this), new Commands(this),
new BowBomb(this)
);

if (getConfig().getBoolean("DisableAllProtocolLib")) {
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/me/moomoo/anarchyexploitfixes/patches/BowBomb.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package me.moomoo.anarchyexploitfixes.patches;

import lombok.RequiredArgsConstructor;
import me.moomoo.anarchyexploitfixes.Main;
import org.bukkit.entity.Arrow;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileLaunchEvent;

@RequiredArgsConstructor
public class BowBomb implements Listener {
private final Main plugin;

@EventHandler
public void onArrow(ProjectileLaunchEvent evt) {
if (plugin.getConfig().getBoolean("PreventBowBombExploit")) {
if (evt.getEntity() instanceof Arrow) {
if (evt.getEntity().getVelocity().lengthSquared() > plugin.getConfig().getInt("MaxBowSquaredVelocity")) {
evt.setCancelled(true);
}
}
}
}
}
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ MaxEntitiesInChunk: 100 # Does not include living entities. (animals/monsters) u
LogEntityRemovals: false
EntityCheckTimeTicks: 20 # 1 second

PreventBowBombExploit: true # Please report any problems in GitHub/Discord.
MaxBowSquaredVelocity: 15 # Fully pulled bow is ~9-10. 15 is default just to be safe.

AntiBedTrap: false
AntiBedTrapDeathAmount: 2 # x deaths in 30 secs will reset someones bed.

Expand Down

0 comments on commit 76ade10

Please sign in to comment.