public function onRun(array $args, Faction $faction, Player $player) { if (!isset($args[0])) { $args[0] = "default"; } if (!$faction->hasChunk(Chunk::fromObject($player))) { return "Homes must be created in chunks claimed by your faction!"; } $homes = $faction->getHomes(); if (isset($homes[$args[0]])) { $fee = $this->getMain()->getMoveHomeFee(); $account = $faction->getAccount($fee["account"]); if (!$account->canPay($fee["amount"])) { return "Your faction doesn't have enough " . $fee["account"] . " money to move a home."; } $account->pay($this->getMain()->getXEconService(), $fee["amount"], "Moving home"); $faction->setHome($args[0], $player); // a new position will be created instead of the player position $faction->sendMessage("Faction {$args['0']} home has been moved to " . $player->getName() . "'s location.", Faction::CHAT_ANNOUNCEMENT); return ""; } if (count($homes) + 1 > ($max = $this->getMain()->getMaxHomes())) { //whaaaaa??? || only 1 home foreach factions please xD return "A faction can only set a maximum of {$max} home(s)!"; //what???????? || on FactionsBukkit, their is only 1 home. } $fee = $this->getMain()->getNewHomeFee(); $account = $faction->getAccount($fee["account"]); if (!$account->canPay($fee["amount"])) { return "Your faction doesn't have enough " . $fee["account"] . " money to add a new home."; } $account->pay($this->getMain()->getXEconService(), $fee["amount"], "Adding new home"); $faction->setHome($args[0], $player); $faction->sendMessage("A new home of {$args['0']} has been created at " . $player->getName() . "'s location.", Faction::CHAT_ANNOUNCEMENT); return ""; }
public function onRun(array $args, Faction $faction, Player $player) { return "Homes of {$faction}: " . implode(", ", array_keys($faction->getHomes())); }