From 03fd558e1b3e4da3eff033d327f4fef50805fcca Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sun, 7 Jul 2019 06:11:15 -0700 Subject: [PATCH] Add toggle to allow piston cheating --- .../gmail/nossr50/config/experience/ExperienceConfig.java | 1 + .../java/com/gmail/nossr50/listeners/BlockListener.java | 8 ++++++++ src/main/resources/experience.yml | 1 + 3 files changed, 10 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index a6f6ef26c..13c88d329 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -145,6 +145,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { /* EXPLOIT TOGGLES */ public boolean isEndermanEndermiteFarmingPrevented() { return config.getBoolean("ExploitFix.EndermanEndermiteFarms", true); } + public boolean isPistonCheatingPrevented() { return config.getBoolean("ExploitFix.PistonCheating", true); } public boolean isPistonExploitPrevented() { return config.getBoolean("ExploitFix.Pistons", false); } public boolean allowUnsafeEnchantments() { return config.getBoolean("ExploitFix.UnsafeEnchantments", false); } public boolean isCOTWBreedingPrevented() { return config.getBoolean("ExploitFix.COTWBreeding", true); } diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 1f43bbfbe..cd9cc12fd 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -129,6 +129,10 @@ public class BlockListener implements Listener { if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) return; + if(!ExperienceConfig.getInstance().isPistonCheatingPrevented()) { + return; + } + BlockFace direction = event.getDirection(); Block movedBlock = event.getBlock(); movedBlock = movedBlock.getRelative(direction, 2); @@ -152,6 +156,10 @@ public class BlockListener implements Listener { if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) return; + if(!ExperienceConfig.getInstance().isPistonCheatingPrevented()) { + return; + } + // Get opposite direction so we get correct block BlockFace direction = event.getDirection(); Block movedBlock = event.getBlock().getRelative(direction); diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index f8e67156a..8df3dec66 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -33,6 +33,7 @@ ExploitFix: Acrobatics: true LavaStoneAndCobbleFarming: true TreeFellerReducedXP: true + PistonCheating: true Experience_Bars: # Turn this to false if you wanna disable XP bars Enable: true