Towny is a plugin for Bukkit (originally from but discontinued from hMod) that allows players to create towns and nations, along with simple alliance controls. The world is broken up into a grid using 16x16 grid cells as default. Each town is given a certain number of these cells and gains more as the town holds more players. These cells can be controlled by a town's mayor to remove mobs, animals, set build/destroy permissions, and define PvP zones. The mayor can also section off some of these cells for sale among its residents. Once a town joins a nation, it's residents can then start building in it's allied towns, but is susceptible to it's enemies destroying it when war time is announced.
Make sure to add Bukkit.jar as a library. You will also need iConomy as a library.