From 71459399b07e6b0fa5dd2e6a884f8f51ee0804aa Mon Sep 17 00:00:00 2001 From: SoftikLord Date: Sat, 10 Feb 2024 09:31:38 +0500 Subject: [PATCH 1/2] More configuration for PreventGoingBelowBedrockFloor --- .../bedrock/PreventGoingBelowBedrockFloor.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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); } } } From 1ff07a57acfef61f793f86748b1797b4daf82f1b Mon Sep 17 00:00:00 2001 From: SoftikLord Date: Sat, 10 Feb 2024 09:35:49 +0500 Subject: [PATCH 2/2] More configuration for PreventGoingBelowBedrockFloor --- .../bedrock/PreventGoingBelowBedrockFloor.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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); } } }