Revert "Move ChunkLoadEvent to separate ChunkListener class"
This reverts commit f234cdd73e
.
This commit is contained in:
parent
e073cab322
commit
f2b9cbce3e
|
@ -281,7 +281,6 @@ public class UltimateStacker extends SongodaPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
getServer().getPluginManager().registerEvents(new ChunkListener(this), this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addExp(Player player, EntityStack stack) {
|
public void addExp(Player player, EntityStack stack) {
|
||||||
|
|
|
@ -45,6 +45,14 @@ public class BlockListeners implements Listener {
|
||||||
this.plugin = plugin;
|
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)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockInteract(PlayerInteractEvent event) {
|
public void onBlockInteract(PlayerInteractEvent event) {
|
||||||
if (event.useInteractedBlock() == Event.Result.DENY) return;
|
if (event.useInteractedBlock() == Event.Result.DENY) return;
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.songoda.ultimatestacker.listeners;
|
|
||||||
|
|
||||||
import com.songoda.ultimatestacker.UltimateStacker;
|
|
||||||
import com.songoda.ultimatestacker.settings.Settings;
|
|
||||||
import com.songoda.ultimatestacker.stackable.block.BlockStackManager;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.world.ChunkLoadEvent;
|
|
||||||
|
|
||||||
public class ChunkListener implements Listener {
|
|
||||||
|
|
||||||
private final BlockStackManager blockStackManager;
|
|
||||||
private final UltimateStacker plugin;
|
|
||||||
|
|
||||||
public ChunkListener(UltimateStacker plugin) {
|
|
||||||
this.blockStackManager = plugin.getBlockStackManager();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,11 +8,10 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
public class BlockStackManager {
|
public class BlockStackManager {
|
||||||
|
|
||||||
private final Map<Location, BlockStack> registeredBlocks = new ConcurrentHashMap<>();
|
private final Map<Location, BlockStack> registeredBlocks = new HashMap<>();
|
||||||
|
|
||||||
public void addBlocks(Map<Location, BlockStack> blocks) {
|
public void addBlocks(Map<Location, BlockStack> blocks) {
|
||||||
this.registeredBlocks.putAll(blocks);
|
this.registeredBlocks.putAll(blocks);
|
||||||
|
|
Loading…
Reference in New Issue