diff --git a/src/main/java/com/bgsoftware/wildloaders/listeners/BlocksListener.java b/src/main/java/com/bgsoftware/wildloaders/listeners/BlocksListener.java index 47cdc37..05cda49 100644 --- a/src/main/java/com/bgsoftware/wildloaders/listeners/BlocksListener.java +++ b/src/main/java/com/bgsoftware/wildloaders/listeners/BlocksListener.java @@ -11,8 +11,10 @@ import org.bukkit.Location; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.PlayerInteractEvent; import java.util.Optional; @@ -82,4 +84,13 @@ public final class BlocksListener implements Listener { plugin.getNMSAdapter().updateSpawner(e.getBlock().getLocation(), false); } + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onLoaderInteract(PlayerInteractEvent e){ + if(e.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if(plugin.getLoaders().getChunkLoader(e.getClickedBlock().getLocation()).isPresent()) + e.setCancelled(true); + } + }