當前位置: 首頁>>代碼示例>>PHP>>正文


PHP economyapi\EconomyAPI類代碼示例

本文整理匯總了PHP中onebone\economyapi\EconomyAPI的典型用法代碼示例。如果您正苦於以下問題:PHP EconomyAPI類的具體用法?PHP EconomyAPI怎麽用?PHP EconomyAPI使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了EconomyAPI類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: payTax

 public function payTax()
 {
     if (($percent = $this->config->get("tax-as-percentage")) !== "") {
         $players = $this->getServer()->getOnlinePlayers();
         foreach ($players as $player) {
             if ($player->hasPermission("economytax.tax.avoid")) {
                 continue;
             }
             $money = $this->api->myMoney($player);
             $taking = $money * ($percent / 100);
             $this->api->reduceMoney($player, min($money, $taking), true, "EconomyTax");
             $player->sendMessage("Your " . EconomyAPI::getInstance()->getMonetaryUnit() . "{$taking} has taken by tax.");
         }
     } else {
         $money = $this->config->get("tax-as-money");
         $players = $this->getServer()->getOnlinePlayers();
         foreach ($players as $player) {
             if ($player->hasPermission("economytax.tax.avoid")) {
                 continue;
             }
             $this->api->reduceMoney($player, min($this->api->myMoney($player), $money), true, "EconomyTax");
             $player->sendMessage("Your " . EconomyAPI::getInstance()->getMonetaryUnit() . "{$money} has taken by tax.");
         }
     }
 }
開發者ID:Tolo0,項目名稱:EconomyS,代碼行數:25,代碼來源:EconomyTax.php

示例2: __construct

 public function __construct(EconomyAPI $plugin)
 {
     $desc = $plugin->getCommandMessage("seemoney");
     parent::__construct("seemoney", $desc["description"], $desc["usage"]);
     $this->setPermission("economyapi.command.seemoney");
     $this->plugin = $plugin;
 }
開發者ID:dog194,項目名稱:EconomyS,代碼行數:7,代碼來源:SeeMoneyCommand.php

示例3: onEnable

 public function onEnable()
 {
     @mkdir($this->getDataFolder());
     $this->initMessage();
     $this->db = (new Config($this->getDataFolder() . "GambleDB.yml", Config::YAML, ["allow-gamble" => true]))->getAll();
     if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") != null) {
         $this->economyAPI = \onebone\economyapi\EconomyAPI::getInstance();
     } else {
         $this->getLogger()->error($this->get("there-are-no-economyapi"));
         $this->getServer()->getPluginManager()->disablePlugin($this);
     }
     $this->registerCommand($this->get("commands-gamble"), $this->get("commands-gamble"), "economygamble.commands.gamble", $this->get("commands-gamble-usage"));
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
     $this->packet["AddItemEntityPacket"] = new AddItemEntityPacket();
     $this->packet["AddItemEntityPacket"]->yaw = 0;
     $this->packet["AddItemEntityPacket"]->pitch = 0;
     $this->packet["AddItemEntityPacket"]->roll = 0;
     $this->packet["AddItemEntityPacket"]->item = Item::get(Item::GOLD_INGOT);
     $this->packet["RemoveEntityPacket"] = new RemoveEntityPacket();
     $this->packet["AddPlayerPacket"] = new AddPlayerPacket();
     $this->packet["AddPlayerPacket"]->clientID = 0;
     $this->packet["AddPlayerPacket"]->yaw = 0;
     $this->packet["AddPlayerPacket"]->pitch = 0;
     $this->packet["AddPlayerPacket"]->meta = 0;
     $this->packet["AddPlayerPacket"]->metadata = [0 => ["type" => 0, "value" => 0], 1 => ["type" => 1, "value" => 0], 16 => ["type" => 0, "value" => 0], 17 => ["type" => 6, "value" => [0, 0, 0]]];
     $this->packet["RemovePlayerPacket"] = new RemovePlayerPacket();
     $this->packet["RemovePlayerPacket"]->clientID = 0;
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this, "EconomyGamble"]), 20);
 }
開發者ID:EmreTr1,項目名稱:rtr,代碼行數:29,代碼來源:EconomyGamble.php

示例4: onEnable

 public function onEnable()
 {
     @mkdir($this->getDataFolder());
     $this->initMessage();
     $this->db = (new Config($this->getDataFolder() . "pluginDB.yml", Config::YAML, ["Format" => "%info%\n%online%\n%mymoney%"]))->getAll();
     if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") != null) {
         $this->economyAPI = \onebone\economyapi\EconomyAPI::getInstance();
     } else {
         $this->getLogger()->error($this->get("there-are-no-economyapi"));
         $this->getServer()->getPluginManager()->disablePlugin($this);
     }
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
     if (self::$instance == null) {
         self::$instance = $this;
     }
     $this->specialLineQueue["all"] = [];
     $this->packet["AddPlayerPacket"] = new AddPlayerPacket();
     $this->packet["AddPlayerPacket"]->clientID = 0;
     $this->packet["AddPlayerPacket"]->yaw = 0;
     $this->packet["AddPlayerPacket"]->pitch = 0;
     $this->packet["AddPlayerPacket"]->item = 0;
     $this->packet["AddPlayerPacket"]->meta = 0;
     $this->packet["AddPlayerPacket"]->slim = \false;
     $this->packet["AddPlayerPacket"]->skin = \str_repeat("", 64 * 32 * 4);
     $this->packet["AddPlayerPacket"]->metadata = [Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 1 << Entity::DATA_FLAG_INVISIBLE], Entity::DATA_AIR => [Entity::DATA_TYPE_SHORT, 300], Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE, 1], Entity::DATA_NO_AI => [Entity::DATA_TYPE_BYTE, 1]];
     $this->packet["RemovePlayerPacket"] = new RemovePlayerPacket();
     $this->packet["RemovePlayerPacket"]->clientID = 0;
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new EDGETask($this), 20);
 }
開發者ID:nesgohood,項目名稱:PMMP-Plugins,代碼行數:30,代碼來源:EDGE.php

示例5: onEnable

 public function onEnable()
 {
     @mkdir($this->getDataFolder());
     $this->initMessage();
     $this->db = (new Config($this->getDataFolder() . "GambleDB.yml", Config::YAML, ["allow-gamble" => true]))->getAll();
     if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") != null) {
         $this->economyAPI = \onebone\economyapi\EconomyAPI::getInstance();
     } else {
         $this->getLogger()->error($this->get("there-are-no-economyapi"));
         $this->getServer()->getPluginManager()->disablePlugin($this);
     }
     $this->registerCommand($this->get("commands-gamble"), $this->get("commands-gamble"), "economygamble.commands.gamble", $this->get("commands-gamble-usage"));
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
     $this->packet["AddItemEntityPacket"] = new AddItemEntityPacket();
     $this->packet["AddItemEntityPacket"]->item = Item::get(Item::GOLD_INGOT);
     $this->packet["RemoveEntityPacket"] = new RemoveEntityPacket();
     $this->packet["AddPlayerPacket"] = new AddPlayerPacket();
     $this->packet["AddPlayerPacket"]->clientID = 0;
     $this->packet["AddPlayerPacket"]->yaw = 0;
     $this->packet["AddPlayerPacket"]->pitch = 0;
     $this->packet["AddPlayerPacket"]->meta = 0;
     $this->packet["AddPlayerPacket"]->metadata = [Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 1 << Entity::DATA_FLAG_INVISIBLE], Entity::DATA_AIR => [Entity::DATA_TYPE_SHORT, 300], Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE, 1], Entity::DATA_NO_AI => [Entity::DATA_TYPE_BYTE, 1]];
     $this->packet["RemovePlayerPacket"] = new RemovePlayerPacket();
     $this->packet["RemovePlayerPacket"]->clientID = 0;
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new EconomyGambleTask($this), 20);
 }
開發者ID:nesgohood,項目名稱:PMMP-Plugins,代碼行數:26,代碼來源:EconomyGamble.php

示例6: getEconomyAPI

 /**
  * Get EconomyAPI instance
  *
  * @return \onebone\economyapi\EconomyAPI|null
  */
 public static function getEconomyAPI()
 {
     if (self::$economyAPI === null and Server::getInstance()->getPluginManager()->getPlugin("EconomyAPI") !== null) {
         self::$economyAPI = \onebone\economyapi\EconomyAPI::getInstance();
     }
     return self::$economyAPI;
 }
開發者ID:ChalkPE,項目名稱:ExamplePlugin,代碼行數:12,代碼來源:EconomyAPIListener.php

示例7: onCommand

 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command) == '확성기') {
         if (!isset($args[0])) {
             return false;
         }
         if ($this->economy == null) {
             $sender->sendMessage("EconomyAPI 플러그인이 없어서 이 명령어를 사용할 수 없습니다.");
             return true;
         }
         if ($this->isMute() && !$sender->isOp()) {
             $sender->sendMessage(TextFormat::RED . "현재 채팅을 할 수 없습니다.");
             return true;
         }
         if ($this->economy->reduceMoney($sender, $this->config["speaker-cost"]) != EconomyAPI::RET_SUCCESS) {
             $sender->sendMessage(TextFormat::RED . "확성기를 사용할 돈이 부족합니다. (비용: {$this->config["speaker-cost"]})");
             return true;
         }
         $message = implode(" ", $args);
         $this->getServer()->broadcastMessage(TextFormat::AQUA . "[확성기] " . $sender->getName() . " > " . $message);
         $sender->sendMessage("{$this->config["speaker-cost"]}원을 내고 확성기를 사용하였습니다.");
     } else {
         if (strtolower($command) == 'mute') {
             if ($this->isMute()) {
                 $this->setMute(false);
                 $this->getServer()->broadcastMessage(TextFormat::DARK_AQUA . "관리자가 채팅을 허용상태로 변경했습니다.");
             } else {
                 $this->setMute(true);
                 $this->getServer()->broadcastMessage(TextFormat::DARK_AQUA . "관리자가 채팅을 비허용상태로 변경했습니다.");
             }
         }
     }
     return true;
 }
開發者ID:organization,項目名稱:NearChat,代碼行數:34,代碼來源:NearChat.php

示例8: onEnable

 public function onEnable()
 {
     $this->saveDefaultConfig();
     $this->cfg = $this->getConfig();
     $this->api = EconomyAPI::getInstance();
     $this->getLogger()->info("BrawlPVP has been enable");
 }
開發者ID:SuperAdam47,項目名稱:BrawlPVP,代碼行數:7,代碼來源:Main.php

示例9: onPlayerInteract

 public function onPlayerInteract(PlayerInteractEvent $event)
 {
     $key = $this->getAxisKey($event->getBlock(), self::axisToken);
     if (isset($this->shops[$key]) === false) {
         return;
     }
     $this->economyAPI = EconomyAPI::getInstance();
     $event->setCancelled(true);
     if ($event->getItem()->isPlaceable()) {
         $this->lastInteractedPlayer = $event->getPlayer();
     }
     if ($event->getBlock() instanceof SignPost === false) {
         unset($this->shops[$key]);
         $event->getPlayer()->sendMessage(TextFormat::DARK_RED . self::tag . " Shop has been removed - Shop must be a sign block!");
         return;
     }
     $player = $event->getPlayer();
     if ($this->economyAPI->myMoney($player) < $this->price) {
         $event->getPlayer()->sendMessage(TextFormat::DARK_RED . self::tag . "You don't have enough money to buy!");
         return;
     }
     $this->economyAPI->reduceMoney($player, $this->price);
     array_push($this->box, $player->getName());
     $this->getServer()->broadcastMessage(TextFormat::DARK_AQUA . self::tag . " " . $player->getName() . " bought a lotto ticket!");
     if (count($this->box) == 101) {
         $this->getServer()->broadcastMessage(TextFormat::DARK_AQUA . self::tag . "The winning amount exceeded " . $this->price * 100 . " - Hurry to buy a lotto ticket!");
     }
 }
開發者ID:nesgohood,項目名稱:PMMP-Plugins,代碼行數:28,代碼來源:Lotto.php

示例10: onCommand

 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if (strtolower($command->getName()) === "buyworld") {
         if (count($args) < 1 || count($args) > 4) {
             return false;
         }
         if (EconomyAPI::getInstance()->myMoney($sender->getName()) < 10000) {
             $sender->sendMessage(TextFormat::RED . "[HyperPlot] You don't have enought money. It cost \$10000");
             return true;
         }
         $world = array_shift($args);
         if (strlen($world) < 3) {
             $sender->sendMessage(TextFormat::RED . "[HyperPlot] Small World name");
             return true;
         }
         if ($this->getServer()->isLevelGenerated($world)) {
             $sender->sendMessage(TextFormat::RED . "[HyperPlot] A world named " . $world . " already exists");
             return true;
         }
         EconomyAPI::getInstance()->reduceMoney($sender->getName(), 10000);
         $this->getServer()->broadcastMessage($sender->sendMessage(TextFormat::RED . "[HyperPlot]  Creating level " . $sender->getName() . "-" . $world . "..."));
         $generator = Generator::getGenerator("ownworld");
         $this->getServer()->generateLevel($sender->getName() . "-" . $world, null, $generator, []);
         $this->getServer()->loadLevel($sender->getName() . "-" . $world);
         return true;
     }
     return false;
 }
開發者ID:Gumbrat,項目名稱:Pocketmine-Plugins,代碼行數:28,代碼來源:HyperPlotWorld.php

示例11: onEnable

 public function onEnable()
 {
     @mkdir($this->getDataFolder());
     // 플러그인 폴더생성
     $this->initMessage();
     // 기본언어메시지 초기화
     // YAML 형식의 DB생성 후 불러오기
     $this->db = (new Config($this->getDataFolder() . "pluginDB.yml", Config::YAML, []))->getAll();
     // 플러그인의 인스턴스 정의
     if (self::$instance == null) {
         self::$instance = $this;
     }
     // 플러그인의 명령어 등록
     // $this->registerCommand ( "명령어이름", "등록실패시 보조 명령어이름", "퍼미션명", "명령어설명", "쓰는법" );
     // 외부 플러그인의 API 이용
     $this->simpleAreaAPI = new API_SimpleAreaListner($this);
     // 심플에리어 API
     // 이코노미 API 이용
     if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") != null) {
         $this->economyAPI = \onebone\economyapi\EconomyAPI::getInstance();
     } else {
         $this->getLogger()->error($this->get("there-are-no-economyapi"));
         $this->getServer()->getPluginManager()->disablePlugin($this);
     }
     // 서버이벤트를 받아오게끔 플러그인 리스너를 서버에 등록
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
 }
開發者ID:EmreTr1,項目名稱:rtr,代碼行數:27,代碼來源:examplePlugin.php

示例12: __construct

 public function __construct(Plugin $plugin)
 {
     $server = Server::getInstance();
     if ($server->getPluginManager()->getPlugin("EconomyAPI") != null) {
         $this->economyAPI = \onebone\economyapi\EconomyAPI::getInstance();
         $server->getPluginManager()->registerEvents($this, $plugin);
     }
 }
開發者ID:Gumbrat,項目名稱:PlayHarder,代碼行數:8,代碼來源:EconomyAPIListener.php

示例13: buy

 public function buy(Player $buyer)
 {
     $rpg = ToAruPG::getInstance()->getRPGPlayerByName($buyer);
     $skill = SkillManager::getSkill($this->skillId);
     $rpg->acquireSkill($skill);
     EconomyAPI::getInstance()->reduceMoney($buyer, $this->cost, true, "To Aru Shop");
     $buyer->sendMessage(TextFormat::AQUA . ToAruPG::getTranslation("BOUGHT"));
 }
開發者ID:HelloWorld017,項目名稱:ToAruShop,代碼行數:8,代碼來源:SkillShop.php

示例14: onEnable

 public function onEnable()
 {
     @mkdir($this->getDataFolder());
     $this->api = EconomyAPI::getInstance();
     $this->listyml = new Config($this->getDataFolder() . "list.yml", Config::YAML);
     $this->list = $this->listyml->getAll();
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
 }
開發者ID:EmreTr1,項目名稱:rtr,代碼行數:8,代碼來源:GiveMeTheMoney.php

示例15: onEnable

 public function onEnable()
 {
     @mkdir($this->getDataFolder());
     $this->NydusCanal = new Config($this->getDataFolder() . "warpList.yml", Config::YAML);
     $this->NydusCanal_List = $this->NydusCanal->getAll();
     if ($this->checkEconomyAPI()) {
         $this->economyAPI = \onebone\economyapi\EconomyAPI::getInstance();
     }
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
 }
開發者ID:Gumbrat,項目名稱:Pocketmine-Plugins,代碼行數:10,代碼來源:AdvancedWarps.php


注:本文中的onebone\economyapi\EconomyAPI類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。