mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-26 20:25:53 +01:00
Don't run if chunk is not loaded.
This commit is contained in:
parent
620b12566b
commit
748538742c
@ -29,7 +29,7 @@ public class DisplayItemHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(instance, this::displayItems, 30L, 30L);
|
Bukkit.getServer().getScheduler().runTaskTimer(instance, this::displayItems, 30L, 30L);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayItems() {
|
private void displayItems() {
|
||||||
@ -48,6 +48,10 @@ public class DisplayItemHandler {
|
|||||||
if (list == null) return;
|
if (list == null) return;
|
||||||
|
|
||||||
if (list.isEmpty()) return;
|
if (list.isEmpty()) return;
|
||||||
|
|
||||||
|
if (!location.getWorld().isChunkLoaded((int) location.getX() >> 4, (int) location.getZ() >> 4))
|
||||||
|
return;
|
||||||
|
|
||||||
for (Entity e : location.getChunk().getEntities()) {
|
for (Entity e : location.getChunk().getEntities()) {
|
||||||
if (e.getType() != EntityType.DROPPED_ITEM
|
if (e.getType() != EntityType.DROPPED_ITEM
|
||||||
|| e.getLocation().getX() != location.getX()
|
|| e.getLocation().getX() != location.getX()
|
||||||
|
Loading…
Reference in New Issue
Block a user