Skip to content

Instantly share code, notes, and snippets.

@WouterG
Created July 15, 2019 23:10
Show Gist options
  • Select an option

  • Save WouterG/ecf84828f0637f3e6d40ffb042821c50 to your computer and use it in GitHub Desktop.

Select an option

Save WouterG/ecf84828f0637f3e6d40ffb042821c50 to your computer and use it in GitHub Desktop.
import net.menoni.rd.RuntimeDebugger;
import net.menoni.rd.model.Debugger;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
public class GetSpawnChunks implements Debugger {
private CommandSender cs;
@Override
public void debug(RuntimeDebugger plugin, CommandSender cs) {
this.cs = cs;
World world = plugin.getServer().getWorlds().get(0);
msg("Force loaded chunk count: " + world.getForceLoadedChunks().size());
for (Chunk forceLoadedChunk : world.getForceLoadedChunks()) {
msg("\tforce loaded chunk{x:%d,z:%d}", forceLoadedChunk.getX(), forceLoadedChunk.getZ());
}
msg("Loaded chunk count: " + world.getLoadedChunks().length);
for (Chunk loadedChunk : world.getLoadedChunks()) {
msg("\tloaded chunk{x:%d,z:%d}", loadedChunk.getX(), loadedChunk.getZ());
}
}
void msg(String msg, Object... args) {
if (args != null && args.length > 0) {
msg = String.format(msg, args);
}
this.cs.sendMessage(ChatColor.YELLOW + msg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment