@Override public void run() { for (District district : Mafiacraft.getDistrictList()) { double pay = ((int) district.getLandCost()) >> 4; for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { LandOwner owner = district.getOwner(i, j); switch (owner.getOwnerType()) { case PLAYER: MPlayer player = (MPlayer) owner; player.addMoney(pay); break; case GOVERNMENT: Government gov = (Government) owner; gov.addMoney(pay); break; case DIVISION: Division div = (Division) owner; div.addMoney(pay); break; } } } } }
public String doClaim(MPlayer player) { if (!player.hasPermission("mafiacraft.citizen")) { return "You must be a citizen to use this command. " + "Apply for citizen on the website at " + MsgColor.URL + "http://voxton.net/" + "."; } Government gov = player.getGovernment(); if (gov == null) { return "You aren't in a government."; } if (!player.getPosition().isAtLeast(Position.VICE_LEADER)) { return "You aren't allowed to claim land for your government."; } Section section = player.getSection(); District district = player.getDistrict(); if (!district.canBeClaimed(section, gov)) { return "Your government isn't allowed to claim the given district."; } double price = district.getLandCost(); if (!gov.hasEnough(price)) { return "Your government does not have enough money to purchase this land."; } gov.claim(section); gov.subtractMoney(price); player.sendMessage( MsgColor.SUCCESS + "You have successfully claimed the section " + section.getName() + " for your " + gov.getType().getName() + "."); return null; }