diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/bedrock/PreventGoingBelowBedrockFloor.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/bedrock/PreventGoingBelowBedrockFloor.java index d446dadb5..1f967f5e2 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/bedrock/PreventGoingBelowBedrockFloor.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/bedrock/PreventGoingBelowBedrockFloor.java @@ -23,11 +23,19 @@ public class PreventGoingBelowBedrockFloor implements AnarchyExploitFixesModule, private final Set exemptedWorlds; private final Material fillMaterial; + private final boolean teleport_enabled; + private final boolean filling_enabled; + private final boolean eject_enabled; + private final boolean stop_elytra_enabled; public PreventGoingBelowBedrockFloor() { shouldEnable(); Config config = AnarchyExploitFixes.getConfiguration(); - config.addComment("bedrock.prevent-going-below-bedrock-floor.enable", "Fills the bedrock hole and teleports player above."); + config.addComment("bedrock.prevent-going-below-bedrock-floor.enable", "Prevents the player from being hit by a bedrock"); + this.teleport_enabled = config.getBoolean("bedrock.prevent-going-below-bedrock-floor.teleport", true, "Teleports the player above the bedrock"); + this.eject_enabled = config.getBoolean("bedrock.prevent-going-below-bedrock-floor.eject-player", true, "Eject player from the vehicle"); + this.stop_elytra_enabled = config.getBoolean("bedrock.prevent-going-below-bedrock-floor.stop-elytra", true, "Disables a player's elytra flight"); + this.filling_enabled = config.getBoolean("bedrock.prevent-going-below-bedrock-floor.fill-bedrock-hole", true, "Indicates whether the hole should be filled from bedorck"); this.exemptedWorlds = new HashSet<>(config.getList("bedrock.prevent-going-below-bedrock-floor.exempted-worlds", List.of("world_the_end", "skyblock_world"))); String configuredFillMaterial = config.getString("bedrock.prevent-going-below-bedrock-floor.filler-material", "BEDROCK"); Material filler_material = Material.BEDROCK; @@ -75,9 +83,11 @@ private void onPlayerMove(PlayerMoveEvent event) { if (playerLoc.getY() < world.getMinHeight()) { // place bedrock at the min world height - world.getBlockAt(playerLoc.getBlockX(), world.getMinHeight(), playerLoc.getBlockZ()).setType(fillMaterial); + if (filling_enabled) world.getBlockAt(playerLoc.getBlockX(), world.getMinHeight(), playerLoc.getBlockZ()).setType(fillMaterial); // teleport player on top of that bedrock - event.setTo(event.getFrom().add(0, 2, 0)); + if (teleport_enabled) event.setTo(event.getFrom().add(0, 2, 0)); + if (eject_enabled && player.isInsideVehicle()) player.leaveVehicle(); + if (stop_elytra_enabled && player.isGliding()) player.setGliding(false); } } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/bedrock/PreventGoingBelowBedrockFloor.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/bedrock/PreventGoingBelowBedrockFloor.java index 9303b8322..856152473 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/bedrock/PreventGoingBelowBedrockFloor.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/bedrock/PreventGoingBelowBedrockFloor.java @@ -24,11 +24,19 @@ public class PreventGoingBelowBedrockFloor implements AnarchyExploitFixesModule, private final Set exemptedWorlds; private final Material fillMaterial; + private final boolean teleport_enabled; + private final boolean filling_enabled; + private final boolean eject_enabled; + private final boolean stop_elytra_enabled; public PreventGoingBelowBedrockFloor() { shouldEnable(); Config config = AnarchyExploitFixes.getConfiguration(); config.addComment("bedrock.prevent-going-below-bedrock-floor.enable", "Fills the bedrock hole and teleports player above."); + this.teleport_enabled = config.getBoolean("bedrock.prevent-going-below-bedrock-floor.teleport", true, "Teleports the player above the bedrock"); + this.eject_enabled = config.getBoolean("bedrock.prevent-going-below-bedrock-floor.eject-player", true, "Eject player from the vehicle"); + this.stop_elytra_enabled = config.getBoolean("bedrock.prevent-going-below-bedrock-floor.stop-elytra", true, "Disables a player's elytra flight"); + this.filling_enabled = config.getBoolean("bedrock.prevent-going-below-bedrock-floor.fill-bedrock-hole", true, "Indicates whether the hole should be filled from bedorck"); this.exemptedWorlds = new HashSet<>(config.getList("bedrock.prevent-going-below-bedrock-floor.exempted-worlds", Arrays.asList("world_the_end", "skyblock_world"))); String configuredFillMaterial = config.getString("bedrock.prevent-going-below-bedrock-floor.filler-material", "BEDROCK"); Material filler_material = Material.BEDROCK; @@ -71,9 +79,11 @@ private void onPlayerMove(PlayerMoveEvent event) { if (playerLoc.getY() < ChunkUtil.guessMinWorldHeight(world)) { // place bedrock at the min world height - world.getBlockAt(playerLoc.getBlockX(), ChunkUtil.guessMinWorldHeight(world), playerLoc.getBlockZ()).setType(fillMaterial); + if (filling_enabled) world.getBlockAt(playerLoc.getBlockX(), ChunkUtil.guessMinWorldHeight(world), playerLoc.getBlockZ()).setType(fillMaterial); // teleport player on top of that bedrock - event.setTo(event.getFrom().add(0, 2, 0)); + if (teleport_enabled) event.setTo(event.getFrom().add(0, 2, 0)); + if (eject_enabled && player.isInsideVehicle()) player.leaveVehicle(); + if (stop_elytra_enabled && player.isGliding()) player.setGliding(false); } } }