mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-01-28 02:01:21 +01:00
Update holograms on chunk load to prevent missing holograms
This commit is contained in:
parent
bdb548fbd6
commit
4bf2d9b479
@ -16,6 +16,7 @@ import com.songoda.ultimatestacker.utils.Methods;
|
||||
import io.lumine.mythic.bukkit.utils.menu.ClickAction;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@ -31,6 +32,7 @@ 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 org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
|
||||
@ -45,6 +47,14 @@ public class BlockListeners implements Listener {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
if (!Settings.STACK_BLOCKS.getBoolean()) return;
|
||||
Chunk chunk = event.getChunk();
|
||||
BlockStackManager blockStackManager = plugin.getBlockStackManager();
|
||||
blockStackManager.getStacks().stream().filter(stack -> stack.getLocation().getChunk().equals(chunk)).forEach(plugin::updateHologram);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onBlockInteract(PlayerInteractEvent event) {
|
||||
if (event.useInteractedBlock() == Event.Result.DENY) return;
|
||||
|
Loading…
Reference in New Issue
Block a user