From 1c130aad42395c8d7024c4b04b100e25fafa83c4 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 16 May 2019 13:30:43 -0700 Subject: [PATCH] 2.1.61 - Some fixes + Exploit prevention --- Changelog.txt | 2 ++ pom.xml | 2 +- .../config/experience/ExperienceConfig.java | 2 ++ .../gmail/nossr50/listeners/BlockListener.java | 16 ++++++++++++++++ src/main/resources/experience.yml | 1 + 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 4d0e79b79..ba2c522da 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3,8 +3,10 @@ Version 2.1.61 Updated the Japanese locale (thanks snake0053) Added toggle to turn off event message broadcasts (XP rate) to config.yml - 'General.EventBroadcasts' Added toggle to not inform players of events when they join (XP rate, etc) to config.yml 'General.EventInfoOnPlayerJoin' + Added anti-exploit protection for cobble/stone farms which can be automated, to turn this off you can toggle the new config options 'ExploitFix.LavaStoneAndCobbleFarming' in experience.yml NOTE: The toggle for event message broadcasts is separate from the titles being shown, that's another config option (titles are the BIG TEXT in the middle of the screen) + NOTE: The new anti-stone/cobble automation will not prevent XP gains from obsidian, since Obsidian requires some effort to farm Version 2.1.60 Fixed a NPE error if a LivingEntity's target was set to null diff --git a/pom.xml b/pom.xml index 38d3521c6..948d49f97 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.60 + 2.1.61 mcMMO https://github.com/mcMMO-Dev/mcMMO 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 a3e4b9f63..3f134cf66 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -332,4 +332,6 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { { return config.getInt("Experience_Values.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type)); } + + public boolean preventStoneLavaFarming() { return config.getBoolean("ExploitFix.LavaStoneAndCobbleFarming", true);} } diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index a627a09b3..e20334dc4 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -180,6 +180,22 @@ public class BlockListener implements Listener { } } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onBlockFormEvent(BlockFormEvent event) + { + /* WORLD BLACKLIST CHECK */ + if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) + return; + + if(ExperienceConfig.getInstance().preventStoneLavaFarming()) + { + if(event.getNewState().getType() != Material.OBSIDIAN && BlockUtils.shouldBeWatched(event.getNewState())) + { + mcMMO.getPlaceStore().setTrue(event.getNewState()); + } + } + } + /** * Monitor BlockPlace events. * diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index ab546e708..473354b11 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -31,6 +31,7 @@ ExploitFix: Fishing: true EndermanEndermiteFarms: true Acrobatics: true + LavaStoneAndCobbleFarming: true Experience_Bars: # Turn this to false if you wanna disable XP bars Enable: true