
<?php
echo "PocketMine-MP plugin code v2.0.0
This file has been generated using DevTools v1.13.4 at Thu, 23 Jul 2020 12:55:09 +0800
----------------
";

if(extension_loaded("phar")){
	$phar = new \Phar(__FILE__);
	foreach($phar->getMetadata() as $key => $value){
		echo ucfirst($key) . ": " . (is_array($value) ? implode(", ", $value) : $value) . "\n";
	}
}

__HALT_COMPILER(); ?>
ä             ÿ   a:9:{s:4:"name";s:4:"code";s:7:"version";s:5:"2.0.0";s:4:"main";s:18:"rain1208\code\Main";s:3:"api";s:5:"3.0.0";s:6:"depend";a:1:{i:0;s:10:"EconomyAPI";}s:11:"description";s:0:"";s:7:"authors";s:0:"";s:7:"website";s:0:"";s:12:"creationDate";i:1595480109;}
   plugin.yml  -_  $&("¶      !   src/rain1208/code/AddCodeForm.php‘  -_‘  ,¶         src/rain1208/code/CodeForm.php{  -_{  ¶lºa¶         src/rain1208/code/Main.php‰  -_‰  üìËé¶      main: rain1208\code\Main
name: code
author: rain1208
api: 3.0.0
version: 2.0.0
depend:
  - EconomyAPI

commands:
  code:
    description: "ã‚¢ã‚¤ãƒ†ãƒ ã‚’å—ã‘å–ã‚Šã¾ã™"
  addcode:
    description: "ã‚³ãƒ¼ãƒ‰ã‚’è¿½åŠ ã—ã¾ã™"
    permission: op<?php


namespace rain1208\code;


use pocketmine\form\Form;
use pocketmine\form\FormValidationException;
use pocketmine\Player;

class AddCodeForm implements Form
{
    /** @var Main */
    private $main;

    private $template = ["item" => [],"money" => 1000];

    public function __construct(Main $main)
    {
        $this->main = $main;
    }

    private function setItem(int $id,int $meta,int $count): void
    {
        $this->template["item"] = [$id,$meta,$count];
    }

    private function setMoney(int $amount): void
    {
        $this->template["money"] = $amount;
    }

    public function handleResponse(Player $player, $data): void
    {
        if ($data === null) return;
        if (count($data) <= 0) return;

        if ($data[1] !== null && $data[1] !== "") {
            $item = explode(":",$data[1]);
            $id = $item[0];
            $meta = $item[1] ?? 0;
            $count = $item[2] ?? 1;
            $this->setItem($id,$meta,$count);
        }

        if ($data[2] !== null && is_numeric($data[2])) {
            $this->setMoney($data[2]);
        }

        if ($data[0] === null || $data[0] === "") return;
        $config = $this->main->config;
        $config->set($data[0],$this->template);
        $config->save();

        $this->main->received->set($data[0],[]);
        $this->main->received->save();

        $player->sendMessage("ã‚³ãƒ¼ãƒ‰ã‚’è¿½åŠ ã—ã¾ã—ãŸ");
    }

    public function jsonSerialize()
    {
        return [
            "type" => "custom_form",
            "title" => "AddCode",
            "content" => [
                [
                    "type" => "input",
                    "text" => "ã‚³ãƒ¼ãƒ‰ã‚’å…¥åŠ›ã—ã¦ãã ã•ã„"
                ],
                [
                    "type" => "input",
                    "text" => "å—ã‘å–ã‚‹ã‚¢ã‚¤ãƒ†ãƒ (ä½•ã‚‚æ¸¡ã•ãªã„ã¨ãã¯æ›¸ã‹ãªã„) \nItemID:meta:Count"
                ],
                [
                    "type" => "input",
                    "text" => "å—ã‘å–ã‚‹é‡‘é¡(æ¸¡ã•ãªã„ã¨ãã¯æ›¸ã‹ãªã„)"
                ]
            ]
        ];
    }
}<?php


namespace rain1208\code;


use onebone\economyapi\EconomyAPI;
use pocketmine\form\Form;
use pocketmine\form\FormValidationException;
use pocketmine\item\Item;
use pocketmine\Player;
use pocketmine\utils\Config;

class CodeForm implements Form
{
    /** @var Main */
    private $main;

    public function __construct(Main $main)
    {
        $this->main = $main;
    }

    public function handleResponse(Player $player, $data): void
    {
        if ($data === null) return;
        if (count($data) <= 0) return;

        $config = $this->main->config;
        $received = $this->main->received;
        if ($config->exists($data[0])) {
            if (in_array($player->getName(),$received->get($data[0]))) {
                $player->sendMessage("ã‚ãªãŸã¯ã™ã§ã«å—ã‘å–ã£ã¦ã„ã¾ã™");
                return;
            }
            $give = $config->get($data[0]);
            if (count($give["item"]) >= 1) {
                $id = $give["item"][0];
                $meta = $give["item"][1] ?? 0;
                $count = $give["item"][2] ?? 1;
                $item = new Item($id,$meta);
                $item->setCount($count);
                if ($player->getInventory()->canAddItem($item)) {
                    $player->getInventory()->addItem($item);
                }
            }
            if ($give["money"] >= 1) {
                EconomyAPI::getInstance()->addMoney($player,$give["money"]);
            }
            $player->sendMessage("å—ã‘å–ã‚Šã¾ã—ãŸ");
            $list = $received->get($data[0]);
            $list[] = $player->getName();
            $received->set($data[0],$list);
            $received->save();
        } else {
            $player->sendMessage("ã‚³ãƒ¼ãƒ‰ãŒé•ã„ã¾ã™");
        }
    }

    public function jsonSerialize()
    {
        return [
            "type" => "custom_form",
            "title" => "Code Form",
            "content" => [
                [
                    "type" => "input",
                    "text" => "ã‚³ãƒ¼ãƒ‰ã‚’å…¥åŠ›ã—ã¦ãã ã•ã„"
                ]
            ]
        ];
    }
}<?php


namespace rain1208\code;


use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\item\Item;
use pocketmine\Player;
use pocketmine\plugin\PluginBase;
use pocketmine\utils\Config;

class Main extends PluginBase
{
    /** @var Config */
    public $config;
    /** @var Config */
    public $received;

    public function onEnable()
    {
        $this->config = new Config($this->getDataFolder()."code.yml",Config::YAML);
        $this->received = new Config($this->getDataFolder()."received.yml",Config::YAML);
    }

    public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool
    {
        if (!$sender instanceof Player) {
            $sender->sendMessage("ã‚µãƒ¼ãƒãƒ¼å†…ã‹ã‚‰ä½¿ç”¨ã—ã¦ãã ã•ã„");
            return true;
        }
        switch ($command->getName()) {
            case "code":
                $sender->sendForm(new CodeForm($this));
                break;
            case "addcode":
                $sender->sendForm(new AddCodeForm($this));
                break;
        }
        return true;
    }
}í?+Þt—À0vÃ¿1h-G	z ñ   GBMB