Advertisement
jujjka

Untitled

Sep 15th, 2023
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. public void loadChunk(Chunk chunk) {
  2. Bukkit.getScheduler().runTaskLater(MiceCats.getPLUGIN(), new Runnable() {
  3. @Override
  4. public void run() {
  5. try {
  6. chunk.getWorld().loadChunk(chunk.getX(), chunk.getZ());
  7. chunk.getWorld().setChunkForceLoaded(chunk.getX(), chunk.getZ(), true);
  8. } catch (NoSuchMethodError e) {
  9. }
  10. }
  11. }, 1);
  12. }
  13. public void loadChunks () {
  14. MiceCats.setIs_ChunksReload(true);
  15. World world = Bukkit.getWorld(new WorldUtil().world_name());
  16. List<Block> blocks = new ArrayList<>();
  17. for (int x = -150; x <= 150; x += 16) {
  18. for (int z = -150; z <= 150; z += 16) {
  19. blocks.add(world.getBlockAt(x, 100, z));
  20. }
  21. }
  22. for (Block block: blocks){
  23. loadChunk(block.getChunk());
  24. Bukkit.getLogger().info("Chunk load %s %s".formatted(block.getX(), block.getZ()));
  25. }
  26. Bukkit.getLogger().info(" ==== chunks load ==== ");
  27. MiceCats.setIs_ChunksReload(false);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement