mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-26 12:16:30 +01:00
Fix stackable displays sometimes endlessly stacking up armor stands
This commit is contained in:
parent
b281f61eef
commit
b8d17f466d
@ -5,6 +5,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import me.goodandevil.skyblock.utils.NumberUtil;
|
import me.goodandevil.skyblock.utils.NumberUtil;
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -92,6 +93,10 @@ public class Stackable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisplay() {
|
private void updateDisplay() {
|
||||||
|
// The chunk needs to be loaded otherwise the getNearbyEntities() in removeDisplay() won't find anything
|
||||||
|
if (!this.location.getWorld().isChunkLoaded(this.location.getBlockX() >> 4, this.location.getBlockZ() >> 4))
|
||||||
|
this.location.getChunk().load();
|
||||||
|
|
||||||
if (this.size > 1) {
|
if (this.size > 1) {
|
||||||
this.createDisplay();
|
this.createDisplay();
|
||||||
this.display.setCustomName(this.getCustomName());
|
this.display.setCustomName(this.getCustomName());
|
||||||
@ -125,7 +130,7 @@ public class Stackable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find any stragglers
|
// Find any stragglers
|
||||||
for (Entity entity : this.location.getWorld().getNearbyEntities(this.location.clone().add(0.5, 0.55, 0.5), 0.1, 0.5, 0.1))
|
for (Entity entity : this.location.getWorld().getNearbyEntities(this.location.clone().add(0.5, 0.55, 0.5), 0.25, 0.5, 0.25))
|
||||||
if (entity instanceof ArmorStand)
|
if (entity instanceof ArmorStand)
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user