public void onCommand( CommandSender sender, ChunkyCommand chunkyCommand, String s, String[] strings) { if (!(sender instanceof Player)) { Language.IN_GAME_ONLY.bad(sender); return; } Player player = (Player) sender; ChunkyResident chunkyResident = new ChunkyResident(player); ChunkyChunk chunkyChunk = chunkyResident.getChunkyPlayer().getCurrentChunk(); ChunkyTown chunkyTown = chunkyResident.getTown(); if (chunkyTown == null) { Strings.NO_TOWN.bad(chunkyResident); return; } if (!chunkyTown.isOwnerOf(chunkyChunk)) { Strings.NOT_TOWN_LAND.bad(chunkyResident); return; } if (!chunkyResident.owns(chunkyChunk) && !chunkyResident.isAssistantOrMayor()) { Strings.NOT_OWNED.bad(chunkyResident); return; } double cost = 100; if (strings.length > 0) { cost = Tools.parseDouble(strings[0]); if (cost < 0) Strings.SPECIFY_NUMBER.bad(chunkyResident); } new TownChunk(chunkyChunk).setForSale(cost); Strings.FORSALE.good(chunkyResident, Chunky.getMethod().format(cost)); }
public void onCommand( CommandSender sender, ChunkyCommand chunkyCommand, String s, String[] strings) { if (!(sender instanceof Player)) { Language.IN_GAME_ONLY.bad(sender); return; } Player player = (Player) sender; ChunkyResident chunkyResident = new ChunkyResident(player.getName()); ChunkyChunk chunkyChunk = chunkyResident.getChunkyPlayer().getCurrentChunk(); ChunkyTown chunkyTown = chunkyResident.getTown(); if (chunkyTown == null) { Language.sendBad(chunkyResident.getChunkyPlayer(), "You do not belong to a town."); return; } if (!chunkyTown.isOwnerOf(chunkyChunk)) { Language.sendBad(chunkyResident.getChunkyPlayer(), "This is not town land."); return; } if (!chunkyResident.owns(chunkyChunk) && !chunkyResident.isAssistantOrMayor()) { Language.sendBad(chunkyResident.getChunkyPlayer(), "You do not own this land."); return; } new TownChunk(chunkyChunk).setNotForSale(); Language.sendGood(chunkyResident.getChunkyPlayer(), "This plot is no longer for sale"); }