소스 검색

Add toggle to allow piston cheating

nossr50 6 년 전
부모
커밋
03fd558e1b

+ 1 - 0
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); }

+ 8 - 0
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);

+ 1 - 0
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