Some tweaks to tracking blocks as unnatural

This commit is contained in:
nossr50 2020-09-21 21:36:24 -07:00
parent 3fd5cd03ee
commit 0b20fc2c16
2 changed files with 12 additions and 20 deletions

View File

@ -1,5 +1,5 @@
Version 2.1.146 Version 2.1.146
A dupe exploit has been patched Improvements were made to tracking player placed blocks in mcMMO
Players no longer lose levels below the level threshold in hardcore mode Players no longer lose levels below the level threshold in hardcore mode
Hardcore now only applies penalties to levels above threshold Hardcore now only applies penalties to levels above threshold

View File

@ -127,12 +127,10 @@ public class BlockListener implements Listener {
Block movedBlock; Block movedBlock;
for (Block b : event.getBlocks()) { for (Block b : event.getBlocks()) {
if (BlockUtils.shouldBeWatched(b.getState())) {
movedBlock = b.getRelative(direction); movedBlock = b.getRelative(direction);
mcMMO.getPlaceStore().setTrue(movedBlock); mcMMO.getPlaceStore().setTrue(movedBlock);
} }
} }
}
/** /**
* Monitor BlockPistonRetract events. * Monitor BlockPistonRetract events.
@ -190,7 +188,6 @@ public class BlockListener implements Listener {
if(ExperienceConfig.getInstance().preventStoneLavaFarming()) if(ExperienceConfig.getInstance().preventStoneLavaFarming())
{ {
if(event.getNewState().getType() != Material.OBSIDIAN if(event.getNewState().getType() != Material.OBSIDIAN
&& BlockUtils.shouldBeWatched(event.getNewState())
&& ExperienceConfig.getInstance().doesBlockGiveSkillXP(PrimarySkillType.MINING, event.getNewState().getBlockData())) && ExperienceConfig.getInstance().doesBlockGiveSkillXP(PrimarySkillType.MINING, event.getNewState().getBlockData()))
{ {
mcMMO.getPlaceStore().setTrue(event.getNewState()); mcMMO.getPlaceStore().setTrue(event.getNewState());
@ -208,11 +205,8 @@ public class BlockListener implements Listener {
BlockState blockState = event.getBlock().getState(); BlockState blockState = event.getBlock().getState();
/* Check if the blocks placed should be monitored so they do not give out XP in the future */ /* Check if the blocks placed should be monitored so they do not give out XP in the future */
if (BlockUtils.shouldBeWatched(blockState)) {
// Don't count de-barking wood
// if (!Tag.LOGS.isTagged(event.getBlockReplacedState().getType()) || !Tag.LOGS.isTagged(event.getBlockPlaced().getType())) // if (!Tag.LOGS.isTagged(event.getBlockReplacedState().getType()) || !Tag.LOGS.isTagged(event.getBlockPlaced().getType()))
mcMMO.getPlaceStore().setTrue(blockState); mcMMO.getPlaceStore().setTrue(blockState);
}
/* WORLD BLACKLIST CHECK */ /* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) { if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) {
@ -250,10 +244,8 @@ public class BlockListener implements Listener {
BlockState blockState = replacedBlockState.getBlock().getState(); BlockState blockState = replacedBlockState.getBlock().getState();
/* Check if the blocks placed should be monitored so they do not give out XP in the future */ /* Check if the blocks placed should be monitored so they do not give out XP in the future */
if (BlockUtils.shouldBeWatched(blockState)) {
mcMMO.getPlaceStore().setTrue(blockState); mcMMO.getPlaceStore().setTrue(blockState);
} }
}
/* WORLD BLACKLIST CHECK */ /* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) { if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) {
@ -276,9 +268,9 @@ public class BlockListener implements Listener {
BlockState blockState = event.getBlock().getState(); BlockState blockState = event.getBlock().getState();
if (!BlockUtils.shouldBeWatched(blockState)) { // if (!BlockUtils.shouldBeWatched(blockState)) {
return; // return;
} // }
mcMMO.getPlaceStore().setFalse(blockState); mcMMO.getPlaceStore().setFalse(blockState);
} }
@ -308,9 +300,9 @@ public class BlockListener implements Listener {
BlockState blockState = event.getBlock().getState(); BlockState blockState = event.getBlock().getState();
Location location = blockState.getLocation(); Location location = blockState.getLocation();
if (!BlockUtils.shouldBeWatched(blockState)) { // if (!BlockUtils.shouldBeWatched(blockState)) {
return; // return;
} // }
/* ALCHEMY - Cancel any brew in progress for that BrewingStand */ /* ALCHEMY - Cancel any brew in progress for that BrewingStand */
if (blockState instanceof BrewingStand && Alchemy.brewingStandMap.containsKey(location)) { if (blockState instanceof BrewingStand && Alchemy.brewingStandMap.containsKey(location)) {