mirror of
https://github.com/kaboomserver/extras.git
synced 2024-06-01 01:41:22 +00:00
27 lines
666 B
Java
27 lines
666 B
Java
package pw.kaboom.extras.commands;
|
|
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.Chunk;
|
|
import org.bukkit.World;
|
|
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandExecutor;
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
public class CommandUnloadChunks implements CommandExecutor {
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
int chunkCount = 0;
|
|
|
|
for (World world : Bukkit.getServer().getWorlds()) {
|
|
for (Chunk chunk : world.getLoadedChunks()) {
|
|
if (chunk.unload()) {
|
|
chunkCount++;
|
|
}
|
|
}
|
|
}
|
|
|
|
sender.sendMessage("Unloaded " + chunkCount + " unused chunks");
|
|
return true;
|
|
}
|
|
}
|