package dk.thoerup.bukkit.hoeruputils; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class RegenerateCommand implements CommandExecutor { @Override public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) { if (!(sender instanceof Player)) { return false; } Player p = (Player) sender; if ( p.isOp() == false) { p.sendMessage("Needs to be operator to use /regenerate"); return true; } Location loc = p.getLocation(); World world = loc.getWorld(); Chunk chunk = world.getChunkAt( loc ); int cx = chunk.getX(); int cz = chunk.getZ(); final int radius = 5; for (int x= (cx+radius); x>=(cx-radius); x--) { for (int z=(cz+radius); z>=(cz-radius); z--) { world.regenerateChunk(x,z); } } p.sendMessage("ok"); return true; } }