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."); } } }
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); }
public function onEnable() { $this->saveDefaultConfig(); $this->cfg = $this->getConfig(); $this->api = EconomyAPI::getInstance(); $this->getLogger()->info("BrawlPVP has been enable"); }
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); }
public function onEnable() { @mkdir($this->getDataFolder()); // 플러그인 폴더생성 $this->initMessage(); // 기본언어메시지 초기화 // YAML 형식의 DB 생성 후 불러오기 $this->db = (new Config($this->getDataFolder() . "pluginDB.yml", Config::YAML, []))->getAll(); // 커스텀 패킷 이용 // 마스터모드시 커스텀패킷 없어도 사용가능하게끔 if ($this->getServer()->getPluginManager()->getPlugin("CustomPacket") === null) { $this->getLogger()->critical("[CustomPacket Example] CustomPacket plugin was not found. This plugin will be disabled."); $this->getServer()->getPluginManager()->disablePlugin($this); return; } // 이코노미 API 이용 if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") != null) { $this->economyAPI = EconomyAPI::getInstance(); } else { $this->getLogger()->error($this->get("there-are-no-economyapi")); $this->getServer()->getPluginManager()->disablePlugin($this); } // 플러그인의 인스턴스 정의 if (self::$instance == null) { self::$instance = $this; } // 플러그인의 명령어 등록 $this->registerCommand($this->get("commands-create"), "SwissBank.create", $this->get("commands-create-desc"), $this->get("commands-create-usage")); $this->registerCommand($this->get("commands-use"), "SwissBank.use", $this->get("commands-use-desc"), $this->get("commands-use-usage")); $this->getServer()->getPluginManager()->registerEvents($this, $this); if (!isset($this->db["mode"])) { $this->getLogger()->info(TextFormat::DARK_AQUA . $this->get("please-choose-mode")); } }
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); }
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; }
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); }
/** * 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; }
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); } }
public function onEnable() { @mkdir($this->getDataFolder()); $this->api = EconomyAPI::getInstance(); $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array("jackpot-winning" => 1000, "jackpot-money" => 5, "max-game" => 10)); $this->casino = array(); $this->getServer()->getPluginManager()->registerEvents($this, $this); }
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")); }
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); }
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); }
public function __construct($file) { $this->db = new \mysqli($file["host"], $file["user"], $file["password"], $file["db"], $file["port"]); if ($this->db->connect_error) { EconomyAPI::getInstance()->getLogger()->critical("Could not connect to MySQL server: " . $this->db->connect_error); return; } $this->db->query("CREATE TABLE IF NOT EXISTS user_money(\n\t\t\tusername VARCHAR(20) PRIMARY KEY,\n\t\t\tmoney FLOAT\n\t\t);"); EconomyAPI::getInstance()->getServer()->getScheduler()->scheduleRepeatingTask(new MySQLPingTask(EconomyAPI::getInstance(), $this->db), 600); }
public function onEnable() { @mkdir($this->getDataFolder()); $this->initMessage(); $this->saveResource("marketPrice.yml", false); $this->marketPrice = (new Config($this->getDataFolder() . "marketPrice.yml", Config::YAML))->getAll(); $this->saveResource("marketCount.yml", false); $this->saveResource($this->messages["default-language"] . "_item_data.yml", false); $this->messagesUpdate("marketPrice.yml"); $marketPrice_new = (new Config($this->getDataFolder() . "marketPrice.yml", Config::YAML))->getAll(); foreach ($this->marketPrice as $index => $data) { if ($index == "m_version") { continue; } if (!isset($marketPrice_new[$index])) { continue; } $marketPrice_new[$index] = $data; $this->marketPrice = $marketPrice_new; } // IF BLOCK ID OR DAMAGES LIST UPDATED, OLD DATA WILL RESTORED $this->messagesUpdate("marketCount.yml"); $this->messagesUpdate($this->messages["default-language"] . "_item_data.yml"); $this->db = (new Config($this->getDataFolder() . "marketDB.yml", Config::YAML, ["allow-purchase" => true]))->getAll(); $this->marketCount = (new Config($this->getDataFolder() . "marketCount.yml", Config::YAML))->getAll(); $this->itemName = (new Config($this->getDataFolder() . $this->messages["default-language"] . "_item_data.yml", Config::YAML))->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-buy"), "ce", "creativeeconomy.commands.buy", $this->get("commands-buy-usage")); $this->registerCommand($this->get("commands-sell"), "ce", "creativeeconomy.commands.sell", $this->get("commands-sell-usage")); $this->registerCommand($this->get("commands-ce"), "ce", "creativeeconomy.commands.ce", $this->get("commands-ce-usage")); if (self::$instance == null) { self::$instance = $this; } $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["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"]->item = 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, "CreativeEconomy"]), 20); }
public function setMoney($username, $money) { if (!$this->isEnabled) { return; } $result = EconomyAPI::getInstance()->setMoney($username, $money); if ($result == -1) { EconomyAPI::getInstance()->createAccount($username, $money); } $this->temp[$username . " " . $money] = true; }
public function reduceMoney(Player $player, $amount) { if ($amount == 0) { return true; } elseif ($amount < 0) { $ret = EconomyAPI::getInstance()->addMoney($player, -$amount, true); } else { $ret = EconomyAPI::getInstance()->reduceMoney($player, $amount, true); } return $ret === EconomyAPI::RET_SUCCESS; }
public function onCompletion(Server $server) { if ($this->sender !== null) { $plugin = EconomyAPI::getInstance(); $output = $plugin->getMessage("topmoney-tag", [$this->page, $this->max], $this->sender->getName()) . "\n"; $message = $plugin->getMessage("topmoney-format", [], $this->sender->getName()) . "\n"; foreach (unserialize($this->topList) as $n => $list) { $output .= str_replace(["%1", "%2", "%3"], [$n, $list[0], $list[1]], $message); } $output = substr($output, 0, -1); $this->sender->sendMessage($output); } }
public function onEnable() { $this->saveDefaultConfig(); $this->reloadConfig(); $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info(TextFormat::YELLOW . "[" . TextFormat::GOLD . "AdvancedPvP" . TextFormat::YELLOW . "] " . TextFormat::GREEN . "Plugin has been enabled!"); $this->getLogger()->info(TextFormat::YELLOW . "[" . TextFormat::GOLD . "AdvancedPvP" . TextFormat::YELLOW . "] " . TextFormat::GREEN . "Created by " . TextFormat::WHITE . "MinecrafterPH"); $this->money = EconomyAPI::getInstance(); if (!$this->money) { $this->getLogger()->info(TextFormat::RED . "Unable to find EconomyAPI."); return true; } }
public function onEnable() { @mkdir($this->getDataFolder()); if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") != null) { $this->api = EconomyAPI::getInstance(); } else { $this->getLogger()->error("'EconomyAPI' plugin was not exist!"); $this->getServer()->getPluginManager()->disablePlugin($this); } $this->initMessage(); $this->loadData(); $this->registerCommand($this->get("clan"), "pocketclan.command", $this->get("clan-desc"), $this->get("clan-help")); $this->registerCommand($this->get("clanManage"), "pocketclan.command", $this->get("clanManage-desc"), $this->get("clanManage-help")); $this->getServer()->getPluginManager()->registerEvents($this, $this); }
function onRun($currentTick) { foreach ($this->getOwner()->getServer()->getOnlinePlayers() as $player) { $x = $player->getFloorX(); $y = $player->getFloorY() + 1; $z = $player->getFloorZ(); $economyAPI = \onebone\economyapi\EconomyAPI::getInstance(); $money = $economyAPI->myMoney($player); $name = $player->getName(); $Health = $player->getHealth(); $MaxHealth = $player->getMaxHealth(); $item = $player->getInventory()->getItemInHand(); $playerCount = count($this->getOwner()->getServer()->getOnlinePlayers()); $player->sendTip("\n" . str_repeat(" ", 40) . TextFormat::STRIKETHROUGH . TextFormat::GOLD . " [SERVER] " . "\n" . str_repeat(" ", 41) . TextFormat::YELLOW . "[닉네임] " . TextFormat::DARK_AQUA . $name . "\n" . str_repeat(" ", 40) . TextFormat::RED . " [체력] " . TextFormat::YELLOW . $Health . TextFormat::RED . "/" . TextFormat::YELLOW . $MaxHealth . "\n" . str_repeat(" ", 41) . TextFormat::GRAY . "[내돈] " . TextFormat::AQUA . $money . TextFormat::WHITE . "원 " . "\n" . str_repeat(" ", 41) . TextFormat::GREEN . "[접속자] " . TextFormat::RED . $playerCount . TextFormat::WHITE . "명 " . "\n" . str_repeat(" ", 41) . TextFormat::DARK_GREEN . "[좌표] " . TextFormat::AQUA . "X:§a{$x} §bY:§a{$y} §bZ:§a{$z}"); } }
public function onCompletion(Server $server) { if (($player = $this->player) === "CONSOLE" or ($player = $server->getPlayerExact($this->player)) instanceof Player) { $plugin = EconomyAPI::getInstance(); $output = "- Showing top money list ({$this->page} of {$this->max}) - \n"; $message = $plugin->getMessage("topmoney-format", $this->player, ["%1", "%2", "%3", "%4"]) . "\n"; foreach ($this->topList as $n => $list) { $output .= str_replace(["%1", "%2", "%3"], [$n, $list[0], $list[1]], $message); } if ($player instanceof Player) { $player->sendMessage($output); } else { $plugin->getLogger()->info($output); } } }
public function getMessage($key, $val = ["%1", "%2", "%3", "%4"]) { if ($this->lang->exists($key)) { if (count($val) < 3) { $val[0] = isset($val[0]) ? $val[0] : "%1"; $val[1] = isset($val[1]) ? $val[1] : "%2"; $val[2] = isset($val[2]) ? $val[2] : "%3"; $val[3] = isset($val[3]) ? $val[3] : "%4"; $val[4] = isset($val[4]) ? $val[4] : "%5"; } $val[5] = "\n"; $val[6] = EconomyAPI::getInstance()->getMonetaryUnit(); return str_replace(["%1", "%2", "%3", "%4", "%5", "\\n", "%MONETARY_UNIT%"], $val, $this->lang->get($key)); } else { return $key; } }
public function onEnable() { $this->CompanyDB = (new Config($this->getDataFolder() . "Company.json", Config::JSON))->getAll(); if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") == null) { $this->getLogger()->error($this->get("cant-find-economyapi")); $this->getServer()->getPluginManager()->disablePlugin($this); } $this->economy = EconomyAPI::getInstance(); $this->Loadconfig(); $this->getServer()->getPluginManager()->registerEvent($this, $this); $commandmap = $this->getServer()->getCommandMap(); $command = new PluginCommand("회사", $this); $command->setDescription("회사를 개설합니다."); $command->setUsage("사용법 : /회사 생성 | 양도 | 목록 | 회사원추가 | 회사원목록 | 폐쇠"); $command->setPermission("Company.command.allow"); $command->register("회사", $command); }
public function onCompletion(Server $server) { if ($this->sender === "CONSOLE" or ($player = $server->getPlayerExact($this->sender)) instanceof Player) { // TODO: Rcon $plugin = EconomyAPI::getInstance(); $output = $plugin->getMessage("topmoney-tag", [$this->page, $this->max], $this->sender) . "\n"; $message = $plugin->getMessage("topmoney-format", [], $this->sender) . "\n"; foreach (unserialize($this->topList) as $n => $list) { $output .= str_replace(["%1", "%2", "%3"], [$n, $list[0], $list[1]], $message); } $output = substr($output, 0, -1); if ($this->sender === "CONSOLE") { $plugin->getLogger()->info($output); } else { $player->sendMessage($output); } } }
public function onEnable() { $this->initMessage(); $this->CompanyDB = (new Config($this->getDataFolder() . "Company.json", Config::JSON))->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); } $commandMap = $this->getServer()->getCommandMap(); $command = new PluginCommand("회사", $this); $command->setDescription("회사를 개설합니다."); $command->setUsage("사용법 : /회사 생성 | 양도 | 목록 | 회사원추가 | 회사원목록 | 폐쇠"); $command->setPermission("Company.command.allow"); $commandMap->register("회사", $command); $this->saveResource("config.yml", false); $this->CompanyPrice = (new Config($this->getDataFolder() . "Config.yml", Config::YAML))->getAll(); }
public function buy(Player $buyer) { $rpg = ToAruPG::getInstance()->getRPGPlayerByName($buyer); $job = JobManager::getJob($this->jobId); $rpg->changeJob($job); foreach ($job->getSkills() as $skill) { $skill = SkillManager::getSkill($skill); if (!$skill->canBeAcquired($rpg)) { $buyer->sendMessage(TextFormat::RED . ToAruPG::getTranslation("SKILL_COULD_NOT_ACQUIRE", ToAruPG::getTranslation($skill->getName()))); continue; } if ($rpg->hasSkill($skill->getId())) { $buyer->sendMessage(TextFormat::RED . ToAruPG::getTranslation("ALREADY_HAS_SKILL", ToAruPG::getTranslation($skill->getName()))); continue; } $rpg->acquireSkill($skill); } EconomyAPI::getInstance()->reduceMoney($buyer, $this->cost, true, "To Aru Shop"); $buyer->sendMessage(TextFormat::AQUA . ToAruPG::getTranslation("BOUGHT")); }
public function onEnable() { @mkdir($this->getDataFolder()); // 플러그인 폴더생성 $this->initMessage(); // 기본언어메시지 초기화 // YAML 형식의 DB생성 후 불러오기 $this->db = (new Config($this->getDataFolder() . "pluginDB.yml", Config::YAML, ["payback" => 10]))->getAll(); // 이코노미 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->registerCommand($this->get("commands-pvpmoney"), "PVPMoney.commands", $this->get("help-pvpmoney"), $this->get("help-pvpmoney")); // 서버이벤트를 받아오게끔 플러그인 리스너를 서버에 등록 $this->getServer()->getPluginManager()->registerEvents($this, $this); }
public function onEnable() { @mkdir($this->getDataFolder()); $this->initMessage(); 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); $this->packet["AddPlayerPacket"] = new AddPlayerPacket(); $this->packet["AddPlayerPacket"]->clientID = 0; $this->packet["AddPlayerPacket"]->yaw = 0; $this->packet["AddPlayerPacket"]->pitch = 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()->getPluginManager()->registerEvents($this, $this); $this->getServer()->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this, "EDGE"]), 20); }