Town town;
try {
if (split.length != 2)
throw new TownyException(String.format(TownySettings.getLangString("msg_err_invalid_input"), "Eg: givebonus [town/player] [n]"));
try {
town = TownyUniverse.getDataSource().getTown(split[0]);
} catch (NotRegisteredException e) {
town = TownyUniverse.getDataSource().getResident(split[0]).getTown();
}
try {
town.setBonusBlocks(town.getBonusBlocks() + Integer.parseInt(split[1].trim()));
TownyMessaging.sendMsg(getSender(), String.format(TownySettings.getLangString("msg_give_total"), town.getName(), split[1], town.getBonusBlocks()));
} catch (NumberFormatException nfe) {
throw new TownyException(TownySettings.getLangString("msg_error_must_be_int"));
}
TownyUniverse.getDataSource().saveTown(town);
} catch (TownyException e) {
throw new TownyException(e.getMessage());
}
}