Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.ultimamc.spigot.free.chunkunloader;
- import org.bukkit.plugin.*;
- import java.util.*;
- import org.bukkit.*;
- import org.bukkit.entity.*;
- public class ChunkBreaker {
- public static void clear(JavaPlugin p) {
- List<World> worlds = new ArrayList<>();
- for (World w : Bukkit.getWorlds()) {
- worlds.add(w);
- for (final String wo : this.p.getConfig().getStringList("disabled-worlds")) {
- if (Bukkit.getWorld(wo) != null) {
- worlds.remove(wo);
- }
- }
- for (final World world : this.worlds) {
- Chunk[] loadedChunks;
- for (int length = (loadedChunks = world.getLoadedChunks()).length, i = 0; i < length; ++i) {
- final Chunk c = loadedChunks[i];
- Collection<Player> onlinePlayers;
- for (int length2 = (onlinePlayers = Bukkit.getOnlinePlayers()).length, j = 0; j < length2; ++j) {
- final Player p = onlinePlayers[j];
- if (!p.getLocation().getChunk().equals(c)) {
- c.unload();
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement