Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void loadChunk(Chunk chunk) {
- Bukkit.getScheduler().runTaskLater(MiceCats.getPLUGIN(), new Runnable() {
- @Override
- public void run() {
- try {
- chunk.getWorld().loadChunk(chunk.getX(), chunk.getZ());
- chunk.getWorld().setChunkForceLoaded(chunk.getX(), chunk.getZ(), true);
- } catch (NoSuchMethodError e) {
- }
- }
- }, 1);
- }
- public void loadChunks () {
- MiceCats.setIs_ChunksReload(true);
- World world = Bukkit.getWorld(new WorldUtil().world_name());
- List<Block> blocks = new ArrayList<>();
- for (int x = -150; x <= 150; x += 16) {
- for (int z = -150; z <= 150; z += 16) {
- blocks.add(world.getBlockAt(x, 100, z));
- }
- }
- for (Block block: blocks){
- loadChunk(block.getChunk());
- Bukkit.getLogger().info("Chunk load %s %s".formatted(block.getX(), block.getZ()));
- }
- Bukkit.getLogger().info(" ==== chunks load ==== ");
- MiceCats.setIs_ChunksReload(false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement