Skip to content

Commit

Permalink
1.23.1 - break anvils instead of teleporting for burrow
Browse files Browse the repository at this point in the history
  • Loading branch information
moom0o committed Mar 22, 2022
1 parent 8eca4e5 commit 000da36
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ PreventBurrow: true # Preliminary burrow patch, please test. Makes players take
BurrowDamageWhenMoving: 1 # Half a heart of damage every time you move.
TeleportBurrow: true #Teleport player above block
PreventBurrowIfBlockAbove: false # Prevent burrow even if there is a block above the block they are burrowing in, please note this may allow creating an "elevator", players will keep teleporting up until they hit air
BreakAnvilInsteadOfTeleport: true # Break anvil instead of teleporting player.

PreventBookBan: true
MaxByteSize: 255 # Per page - Not recommended to touch this
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.23.0</version>
<version>1.23.1</version>
<packaging>jar</packaging>

<name>AnarchyExploitFixes</name>
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/me/moomoo/anarchyexploitfixes/patches/Burrow.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
Expand All @@ -24,6 +25,7 @@ private void onMove(PlayerMoveEvent evt) {
int z = l.getBlockZ();
if (plugin.getConfig().getBoolean("PreventBurrow") && evt.getPlayer().getGameMode() != GameMode.SPECTATOR && (plugin.getConfig().getBoolean("PreventBurrowIfBlockAbove") || evt.getPlayer().getLocation().getWorld().getBlockAt(x, y + 1, z).getType().equals(Material.AIR))) {
Material b = evt.getPlayer().getLocation().getWorld().getBlockAt(x, y, z).getType();
Block bb = evt.getPlayer().getLocation().getWorld().getBlockAt(x, y, z);
if (!b.equals(Material.AIR) && b.isOccluding() && !b.equals(Material.SOUL_SAND) && !isGravityBlock(b)) {
evt.getPlayer().damage(plugin.getConfig().getInt("BurrowDamageWhenMoving"));
if (plugin.getConfig().getBoolean("TeleportBurrow")) {
Expand Down Expand Up @@ -51,8 +53,17 @@ private void onMove(PlayerMoveEvent evt) {
}
break;
}
case ANVIL: {
evt.getPlayer().damage(plugin.getConfig().getInt("BurrowDamageWhenMoving"));
if (plugin.getConfig().getBoolean("TeleportBurrow") && !plugin.getConfig().getBoolean("BreakAnvilInsteadOfTeleport")) {
evt.getPlayer().teleport(new Location(l.getWorld(), x, y + 1, z));
}
if (plugin.getConfig().getBoolean("BreakAnvilInsteadOfTeleport")) {
bb.breakNaturally();
}
break;
}
case BEDROCK:
case ANVIL:
case BEACON: {
evt.getPlayer().damage(plugin.getConfig().getInt("BurrowDamageWhenMoving"));
if (plugin.getConfig().getBoolean("TeleportBurrow")) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ PreventBurrow: true # Preliminary burrow patch, please test. Makes players take
BurrowDamageWhenMoving: 1 # Half a heart of damage every time you move.
TeleportBurrow: true #Teleport player above block
PreventBurrowIfBlockAbove: false # Prevent burrow even if there is a block above the block they are burrowing in, please note this may allow creating an "elevator", players will keep teleporting up until they hit air
BreakAnvilInsteadOfTeleport: true # Break anvil instead of teleporting player.

PreventBookBan: true
MaxByteSize: 255 # Per page - Not recommended to touch this
Expand Down

0 comments on commit 000da36

Please sign in to comment.