mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-08 11:41:28 +01:00
fix missing holograms after server restart
This commit is contained in:
parent
09cce89d75
commit
5d68d7d886
@ -146,6 +146,7 @@ public class UltimateKits extends SongodaPlugin {
|
||||
PluginManager pluginManager = getServer().getPluginManager();
|
||||
guiManager.init();
|
||||
pluginManager.registerEvents(new BlockListeners(this), this);
|
||||
pluginManager.registerEvents(new ChunkListeners(this), this);
|
||||
pluginManager.registerEvents(new ChatListeners(this), this);
|
||||
pluginManager.registerEvents(new EntityListeners(this), this);
|
||||
pluginManager.registerEvents(new InteractListeners(this, guiManager), this);
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.songoda.ultimatekits.listeners;
|
||||
|
||||
import com.songoda.ultimatekits.UltimateKits;
|
||||
import com.songoda.ultimatekits.key.Key;
|
||||
import com.songoda.ultimatekits.kit.Kit;
|
||||
import com.songoda.ultimatekits.kit.KitBlockData;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by songoda on 2/24/2017.
|
||||
*/
|
||||
public class ChunkListeners implements Listener {
|
||||
|
||||
private final UltimateKits instance;
|
||||
|
||||
public ChunkListeners(UltimateKits instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
instance.getKitManager().getKitLocations().values().stream()
|
||||
.filter(l -> l.getLocation().getWorld() == event.getWorld()
|
||||
&& l.getLocation().getBlockX() >> 4 == event.getChunk().getX()
|
||||
&& l.getLocation().getBlockZ() >> 4 == event.getChunk().getZ())
|
||||
.forEach(instance::updateHologram);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user