From b13a02b6a5498d7a3d9d4f0a09c5f83afd7d83f8 Mon Sep 17 00:00:00 2001 From: Brianna O'Keefe Date: Fri, 28 Dec 2018 21:13:23 -0500 Subject: [PATCH] fix --- .../java/com/songoda/epichoppers/api/hopper/Hopper.java | 3 +++ .../java/com/songoda/epichoppers/handlers/HopHandler.java | 7 ++++++- .../main/java/com/songoda/epichoppers/hopper/EHopper.java | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/EpicHoppers-API/src/main/java/com/songoda/epichoppers/api/hopper/Hopper.java b/EpicHoppers-API/src/main/java/com/songoda/epichoppers/api/hopper/Hopper.java index 26f356f..8cfa8ae 100644 --- a/EpicHoppers-API/src/main/java/com/songoda/epichoppers/api/hopper/Hopper.java +++ b/EpicHoppers-API/src/main/java/com/songoda/epichoppers/api/hopper/Hopper.java @@ -3,6 +3,7 @@ package com.songoda.epichoppers.api.hopper; import com.songoda.epichoppers.api.hopper.levels.Level; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -32,6 +33,8 @@ public interface Hopper { */ Location getLocation(); + World getWorld(); + /** * Get the X coordinate for the hopper. * diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java index e2bd1af..98433b7 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java @@ -43,8 +43,10 @@ public class HopHandler { for (com.songoda.epichoppers.api.hopper.Hopper hopper : new HashMap<>(instance.getHopperManager().getHoppers()).values()) { Location location = hopper.getLocation(); - if (!location.getWorld().isChunkLoaded(location.getBlockX(), location.getBlockZ())) + Bukkit.broadcastMessage("first"); + if (!location.getWorld().isChunkLoaded(location.getBlockX() >> 4, location.getBlockZ() >> 4)) continue; + Bukkit.broadcastMessage("first2"); Block block = location.getBlock(); @@ -53,6 +55,7 @@ public class HopHandler { continue; } + Bukkit.broadcastMessage("first2"); if (block.isBlockPowered() || block.isBlockIndirectlyPowered()) continue; Hopper hopperBlock = hopper.getHopper(); @@ -76,9 +79,11 @@ public class HopHandler { for (Location destinationLocation : hopper.getLinkedBlocks()) { if (destinationLocation == null) continue; + Bukkit.broadcastMessage("before"); if (!destinationLocation.getWorld().isChunkLoaded(destinationLocation.getBlockX(), destinationLocation.getBlockZ())) continue; + Bukkit.broadcastMessage("after"); Block destinationBlock = destinationLocation.getBlock(); if (!(destinationBlock.getState() instanceof InventoryHolder)) { diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/EHopper.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/EHopper.java index a50529e..af6f003 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/EHopper.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/EHopper.java @@ -588,6 +588,11 @@ public class EHopper implements Hopper { return location.clone(); } + @Override + public World getWorld() { + return location.getWorld(); + } + @Override public int getX() { return location.getBlockX();