
<?php
echo "PocketMine-MP plugin code v1.0.0
This file has been generated using DevTools v1.13.4 at Thu, 23 Jul 2020 05:33:32 +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:"1.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:1595453612;}
   plugin.ymlí   ¬°_í   ñ¼‰ó¶      !   src/rain1208/code/AddCodeForm.php  ¬°_  pÈü½¶         src/rain1208/code/CodeForm.php  ¬°_  ò<_¶         src/rain1208/code/Main.phpE  ¬°_E  ø°Sv¶      main: rain1208\code\Main
name: code
author: rain1208
api: 3.0.0
version: 1.0.0
depend:
  - EconomyAPI

commands:
  code:
    description: "ã‚¢ã‚¤ãƒ†ãƒ ã‚’å—ã‘å–ã‚Šã¾ã™"
  addcode:
    description: "a"
    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;

    public function __construct(Main $main)
    {
        $this->main = $main;
    }

    public function handleResponse(Player $player, $data): void
    {
        if ($data === null) return;
        if (count($data) <= 0) return;

        foreach ($this->main->received->getAll(true) as $name) {
            $this->main->received->remove($name);
        }
        $this->main->received->save();
        $this->main->config->set("code",(string)$data[0]);
        if ($data[1] !== null && $data[1] !== "") {
            $item = explode(":",$data[1]);
            $this->main->config->set("item",$item);
        }
        if ($data[2] !== null && $data[2] !== "") {
            $this->main->config->set("money", $data[2]);
        }
        $this->main->config->save();
        $player->sendMessage("ã‚³ãƒ¼ãƒ‰ã‚’å¤‰æ›´ã—ã¾ã—ãŸ");
    }

    public function jsonSerialize()
    {
        return [
            "type" => "custom_form",
            "title" => "AddCode",
            "content" => [
                [
                    "type" => "input",
                    "text" => "ã‚³ãƒ¼ãƒ‰ã‚’å…¥åŠ›ã—ã¦ãã ã•ã„"
                ],
                [
                    "type" => "input",
                    "text" => "å—ã‘å–ã‚‹ã‚¢ã‚¤ãƒ†ãƒ (ä½•ã‚‚æ¸¡ã•ãªã„ã¨ãã¯æ›¸ã‹ãªã„) \n ItemID: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;
        $code = $config->get("code");
        if ($data[0] === $code) {
            if ($this->main->received->exists($player->getName())) {
                $player->sendMessage("ã‚ãªãŸã¯ã™ã§ã«å—ã‘å–ã£ã¦ã„ã¾ã™");
                return;
            }

            if (is_array($config->get("item")) && count($config->get("item")) >= 1) {
                $item = $config->get("item");
                $give = new Item($item[0],$item[1]);
                $give->setCount($item[2]);
                $player->getInventory()->addItem($give);
            }

            if ($config->get("money") > 0) {
                EconomyAPI::getInstance()->addMoney($player,$config->get("money"));
            }
            $this->main->received->set($player->getName());
            $this->main->received->save();
            $player->sendMessage("å—ã‘å–ã‚Šã¾ã—ãŸ");
        } 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,
            [
                "code" => "Example",
                "item" => [
                    1,0,10
                ],
                "money" => 100
            ]
        );
        $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;
    }
}ö-?ç+ßŒ“_GRSXÛ†'   GBMB