From 34fc9725b973ae975bdb7d86da1941604230ea7a Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Sat, 19 Jan 2019 15:41:33 -0500 Subject: [PATCH] Listen for block multiplace --- .../nossr50/listeners/BlockListener.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 17f5d7df3..fc893e91b 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -166,6 +166,30 @@ public class BlockListener implements Listener { } } + /** + * Monitor BlockMultiPlace events. + * + * @param event The event to watch + */ + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onBlockMultiPlace(BlockMultiPlaceEvent event) { + Player player = event.getPlayer(); + + if (!UserManager.hasPlayerDataKey(player)) { + return; + } + + for (BlockState replacedBlockState : event.getReplacedBlockStates()) + { + BlockState blockState = replacedBlockState.getBlock().getState(); + + /* Check if the blocks placed should be monitored so they do not give out XP in the future */ + if (BlockUtils.shouldBeWatched(blockState) && blockState.getType() != Material.CHORUS_FLOWER) { + mcMMO.getPlaceStore().setTrue(blockState); + } + } + } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockGrow(BlockGrowEvent event) {