use of com.palmergames.bukkit.towny.event.TownUnclaimEvent in project Towny by ElgarL.
the class TownClaim method townUnclaim.
private void townUnclaim(final Town town, final WorldCoord worldCoord, boolean force) throws TownyException {
try {
final TownBlock townBlock = worldCoord.getTownBlock();
if (town != townBlock.getTown() && !force)
throw new TownyException(TownySettings.getLangString("msg_area_not_own"));
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
TownyUniverse.getDataSource().removeTownBlock(townBlock);
// Raise an event to signal the unclaim
BukkitTools.getPluginManager().callEvent(new TownUnclaimEvent(town, worldCoord));
}
}, 1);
} catch (NotRegisteredException e) {
throw new TownyException(TownySettings.getLangString("msg_not_claimed_1"));
}
}
Aggregations