mirror of
https://github.com/songoda/EpicHoppers.git
synced 2024-11-25 11:46:45 +01:00
fix
This commit is contained in:
parent
a753c929f4
commit
b13a02b6a5
@ -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.
|
||||
*
|
||||
|
@ -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)) {
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user