This is the code from a Bukkit Plugins. With this plugin you can claim chunks