コード例 #1
0
ファイル: ApiAsyncTask.php プロジェクト: GeenoMC/BuyCraft
 /**
  * @param BuyCraft $main
  * @param array $data
  * @param bool $player
  */
 public function __construct(BuyCraft $main, $data = [], $player = false)
 {
     DebugUtils::construct($this);
     if ($main->getConfig()->get("https")) {
         $this->apiUrl = "https://api.buycraft.net/v4";
     } else {
         $this->apiUrl = "http://api.buycraft.net/v4";
     }
     $data["secret"] = $main->getConfig()->get("secret");
     $data["playersOnline"] = count($main->getServer()->getOnlinePlayers());
     $this->data = serialize($data);
     $this->player = $player;
     $this->isAuthenticated = $main->isAuthenticated();
     $this->autoloader = unserialize(serialize($main->getServer()->getLoader()));
     //TODO improve this
     $this->onConfig($main);
 }
コード例 #2
0
ファイル: CommandFetchTask.php プロジェクト: GeenoMC/BuyCraft
 public function onConfig(BuyCraft $plugin)
 {
     $data = $this->getData();
     $data["action"] = Actions::COMMANDS;
     $data["do"] = Actions::DO_LOOKUP;
     if (is_array($data["users"])) {
         $data["users"] = json_encode($data["users"]);
         //I think that's right
     }
     $data["offlineCommandLimit"] = $plugin->getConfig()->get('commandThrottleCount');
     $this->setData($data);
 }
コード例 #3
0
ファイル: VisitLinkTask.php プロジェクト: GeenoMC/BuyCraft
 public function onOutput(BuyCraft $main, CommandSender $sender)
 {
     $out = $this->getOutput()['payload'];
     if ($out !== null && $out !== false) {
         if (isset($out['url']) && $out['url'] !== null) {
             $sender->sendMessage($main->getConfig()->get('pleaseVisit') . ": " . $out['url']);
         } else {
             $sender->sendMessage($out['errormessage']);
         }
     } else {
         $sender->sendMessage("HTTP request error during url shortening.");
     }
 }
コード例 #4
0
ファイル: BuyCommand.php プロジェクト: GeenoMC/BuyCraft
 public function __construct(BuyCraft $main)
 {
     parent::__construct($main->getConfig()->get('buyCommand'), "Buy command!", "/buy", []);
     $this->main = $main;
 }