public void addTown(Town town) throws AlreadyRegisteredException { if (hasTown(town)) throw new AlreadyRegisteredException(); else { towns.add(town); town.setWorld(this); } }
public void removeTown(Town town) throws NotRegisteredException { if (!hasTown(town)) throw new NotRegisteredException(); else { towns.remove(town); try { town.setWorld(null); } catch (AlreadyRegisteredException e) { } } }