Ejemplo n.º 1
0
 /**
  * @param string|Player		$player
  * @param float				$defaultMoney
  * @param bool				$force
  *
  * @return bool
  */
 public function createAccount($player, $defaultMoney = false, bool $force = false) : bool
 {
     if ($player instanceof Player) {
         $player = $player->getName();
     }
     $player = strtolower($player);
     if (!$this->provider->accountExists($player)) {
         $defaultMoney = $defaultMoney === false ? $this->getConfig()->get("default-money") : $defaultMoney;
         $this->getServer()->getPluginManager()->callEvent($ev = new CreateAccountEvent($this, $player, $defaultMoney, "none"));
         if (!$ev->isCancelled() or $force === true) {
             $this->provider->createAccount($player, $ev->getDefaultMoney());
         }
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * @param PlayerLoginEvent $event
  */
 public function onLoginEvent(PlayerLoginEvent $event)
 {
     $username = strtolower($event->getPlayer()->getName());
     if (!isset($this->money["money"][$username])) {
         $this->getServer()->getPluginManager()->callEvent($ev = new CreateAccountEvent($this, $username, $this->config->get("default-money"), $this->config->get("default-debt"), null, "EconomyAPI"));
         $this->money["money"][$username] = round($ev->getDefaultMoney(), 2);
     }
     if (!isset($this->playerLang[$username])) {
         $this->setLang($this->config->get("default-lang"), $username);
     }
 }
Ejemplo n.º 3
0
 /**
  * @param Player|string $player
  * @param bool|float $default_money
  * @param bool $force
  *
  * @return boolean
  */
 public function createAccount($player, $default_money = false, $force = false)
 {
     if ($player instanceof Player) {
         $player = $player->getName();
     }
     $player = strtolower($player);
     if (!$this->provider->accountExists($player)) {
         $this->getServer()->getPluginManager()->callEvent($ev = new CreateAccountEvent($this, $player, $default_money === false ? $this->config->get("default-money") : $default_money, "EconomyAPI"));
         if (!$ev->isCancelled() and $force === false) {
             $this->provider->createAccount($player, $ev->getDefaultMoney());
             return true;
         }
     }
     return false;
 }