<?php __HALT_COMPILER(); ?>
i                     src/CoinShop/Main.phpîh  0FÇ[îh  }ò š¶      
   plugin.ymlÑ   0FÇ[Ñ   øí>Ï¶      <?php

namespace CoinShop;

use pocketmine\utils\TextFormat;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\plugin\PluginBase;
use pocketmine\utils\Config;
use pocketmine\Player;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\event\Listener;
use pocketmine\event\server\DataPacketReceiveEvent;
use pocketmine\network\mcpe\protocol\ModalFormRequestPacket;
use pocketmine\item\Item;
use MixCoinSystem\MixCoinSystem;


class Main extends PluginBase implements Listener{


  

   public function onEnable(){
      $this->coin =  MixCoinSystem::getInstance();
      $this->getServer()->getPluginManager()->registerEvents($this,$this);
      $this->getLogger()->info(Textformat::AQUA."CoinShopã‚’èª­ã¿è¾¼ã¿ã¾ã—ãŸ ä½œæˆè€…mixpowder");
    
      if (!file_exists($this->getDataFolder())) {
       @mkdir($this->getDataFolder(), 0744, true);
      }
    
      $this->buyshop = new Config($this->getDataFolder(). "buyshop.yml", Config::YAML);
      $this->sellshop = new Config($this->getDataFolder(). "sellshop.yml", Config::YAML);

      if($this->getServer()->getPluginManager()->getPlugin("MixCoinSystem") == NULL){
          $this->getLogger()->error("MixCoinSystemãŒå…¥ã‚Œã‚‰ã‚Œã¦ã„ã¾ã›ã‚“ã€‚å…¥ã‚Œã¦ãã¦ãã ã•ã„");                
          $this->getServer()->shutdown();
        }else{
        $this->getLogger()->notice(Textformat::AQUA."MixCoinSystemã‚’ç¢ºèªã—ã¾ã—ãŸ");
        }
  }

  public function onJoin(PlayerJoinEvent $event){
      $this->allset();
        
        }

 public function sendForm(Player $player, $title, $come, $buttons, $id) {
      $pk = new ModalFormRequestPacket(); 
      $pk->formId = $id;
      $this->pdata[$pk->formId] = $player;
      $data = [ 
      'type'    => 'form', 
      'title'   => $title, 
      'content' => $come, 
      'buttons' => $buttons 
      ]; 
      $pk->formData = json_encode( $data, JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING | JSON_UNESCAPED_UNICODE );
      $player->dataPacket($pk);
      $this->lastFormData[$player->getName()] = $data;
      }

      public function sendCustom(Player $player, $title, $elements, $id) {
    
      $pk = new ModalFormRequestPacket(); 
      $pk->formId = $id;
      $this->pdata[$pk->formId] = $player;
      $data = [ 
      'type'    => 'custom_form', 
      'title'   => $title, 
      'content' => $elements
      ]; 
      $pk->formData = json_encode( $data, JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING | JSON_UNESCAPED_UNICODE );
      $player->dataPacket($pk);
      }

      public function onPrecessing(DataPacketReceiveEvent $event){

    $player = $event->getPlayer();
    $pk = $event->getPacket();
    $name = $player->getName();
    if($pk->getName() == "ModalFormResponsePacket"){
      $data = $pk->formData;
      if($data == "null\n"){
      }else{
          switch($pk->formId){

          case 20000;//è³¼å…¥
          $id = 0;
          $item = $this->buyshop->getAll(true);
          foreach($item as $Con){
           $a = $this->buyshop->get($Con);
          if(!($data == $a["number"])){
          $id++;
          }else{
          $player->shop = $Con;
          $buttons[] = ['text' => "ã¯ã„"];
          $buttons[] = ['text' => "ã„ã„ãˆ"];
          $this->sendForm($player,"ç¢ºèª","æœ¬å½“ã«{$Con}ã‚’è³¼å…¥ã—ã¾ã™ã‹ï¼Ÿ\nCoinå¿…è¦æžšæ•°{$a["coin"]}",$buttons,20001);
        }
      }
        break;

          case 20001://ç¢ºèª
          if($data == 0){
            $this->buyshop2($player);
        }
        break;

        case 20002://ç¢ºèª
          if($data == 0){
          $this->buyshop2($player);
          }elseif($data == 1){
          $this->buyshop($player);
          }
          break;



          case 21001://å¤‰æ›´ã®ç¢ºèª
          $data = json_decode($data,true);
          if($data[0] === ""){
            $this->error($player,1);
          }elseif($data[1] === ""){
            $this->error($player,1);
          }elseif($data[2] === ""){
            $this->error($player,1);
          }elseif($data[3] === ""){
            $this->error($player,1);
          }elseif($data[4] === ""){
            $this->error($player,1);
          }elseif(0 > $data[4]){
            $this->error($player,2);
          }else{
            $this->buyshop->set($data[0],["id" => $data[1],"damage" => $data[2],"amount" => $data[3],"coin" => $data[4]]);
            $this->buyshop->save();
            $this->allset();
          $buttons[] = ['text' => "ç¶šã‘ã¦è¿½åŠ ã™ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"æˆåŠŸ","è¿½åŠ ã§ãã¾ã—ãŸ",$buttons,21002);

        }
          break;


          case 21002://å¤‰æ›´ç¶šã‘ã‚‹ã‹ã©ã†ã‹
          if($data == 0){
          $this->SetItem($player);
        }
          break;


          case 22001://å‰Šé™¤
          $id = 0;
          $item = $this->buyshop->getAll(true);
          foreach($item as $Con){
            $a = $this->buyshop->get($Con);
          if(!($data == $a["number"])){
          $id++;
          }else{
          $player->shop = $Con;
          $buttons[] = ['text' => "ã¯ã„"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"ç¢ºèª","æœ¬å½“ã«{$Con}ã‚’æ¶ˆã—ã¾ã™ã‹ï¼Ÿ",$buttons,22002);
          }
        }
          break;


          case 22002://ã¯ã„ã‚’æŠ¼ã—ãŸã¨ãã®åå¿œ
          if($data == 0){
          $this->buyshop->remove($player->shop);
          $this->buyshop->save();
          $this->allset();
          $buttons[] = ['text' => "ç¶šã‘ã¦å‰Šé™¤ã™ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"å‰Šé™¤æˆåŠŸ","å‰Šé™¤ã—ã¾ã—ãŸ",$buttons,22003);
          }
          break;


          case 22003://æ¬¡ã®å‹•ä½œ
          if($data == 0){
            $this->debuyshop($player);
          }
          break;


          case 23001://å¤‰æ›´é–¢é€£
          $id = 0;
          $item = $this->buyshop->getAll(true);
          foreach($item as $Con){
          $a = $this->buyshop->get($Con);
          if(!($data == $a["number"])){
          $id++;
          }else{
          $player->shop = $Con;
          $elements[] = ['type' => "input",'text' => "è¡¨ç¤ºå","placeholder" => "",'default' => $Con];
          $elements[] = ['type' => "input",'text' => "ã‚¢ã‚¤ãƒ†ãƒ ID","placeholder" => "",'default' => $a["id"]];
          $elements[] = ['type' => "input",'text' => "ãƒ€ãƒ¡ãƒ¼ã‚¸å€¤","placeholder" => "",'default' => $a["damage"]];
          $elements[] = ['type' => "input",'text' => "å€‹æ•°","placeholder" => "",'default' => $a["amount"]];
          $elements[] = ['type' => "input",'text' => "å€¤æ®µ(coin)","placeholder" => "",'default' => $a["coin"]];
          $this->sendCustom($player,"æ‰“ã¡è¾¼ã‚“ã§ãã ã•ã„",$elements,23002);
          }
        }
            break;

            case 23002://è¨­å®šå¤‰æ›´
            $data = json_decode($data,true);
             if($data[0] === ""){
            $this->error($player,10);
          }elseif($data[1] === ""){
            $this->error($player,10);
          }elseif($data[2] === ""){
            $this->error($player,10);
          }elseif($data[3] === ""){
            $this->error($player,10);
          }elseif($data[4] === ""){
            $this->error($player,10);
          }elseif(0 > $data[4]){
            $this->error($player,11);
          }elseif($player->shop == $data[1]){
          $this->buyshop->set($data[0],["id" => $data[1],"damage" => $data[2],"amount" => $data[3],"coin" => $data[4]]);
          $this->buyshop->save();
          $this->allset();
          $buttons[] = ['text' => "ç¶šã‘ã¦å¤‰æ›´ã™ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"æˆåŠŸ","å¤‰æ›´ã§ãã¾ã—ãŸ",$buttons,23003);
          }else{
          $this->buyshop->remove($player->shop);
          $this->buyshop->set($data[0],["id" => $data[1],"damage" => $data[2],"amount" => $data[3],"coin" => $data[4]]);
          $this->buyshop->save();
          $this->allset();
          $buttons[] = ['text' => "ç¶šã‘ã¦å¤‰æ›´ã™ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"æˆåŠŸ","å¤‰æ›´ã§ãã¾ã—ãŸ",$buttons,23003);
          }
          break;

          case 23003://changebuyshopç§»å‹•
          if($data == 0){
          $this->changebuyshop($player);
        }
          break;
//--------------------------------------------------------------------------------------------------ã“ã“ã‹ã‚‰sellshop

          case 24000://å£²ã‚‹
          $id = 0;
          $item = $this->sellshop->getAll(true);
          foreach($item as $Con){
            $a = $this->sellshop->get($Con);
          if(!($data == $a["number"])){
          $id++;
          }else{
          $player->shop = $Con;
          $buttons[] = ['text' => "ã¯ã„"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"ç¢ºèª","æœ¬å½“ã«{$Con}ã‚’Coinã«ã—ã¾ã™ã‹ï¼Ÿ\nå¿…è¦ã‚¢ã‚¤ãƒ†ãƒ æ•°{$a["amount"]}",$buttons,24001);
          }
        }
        break;

          case 24001://å¤‰æ›´
          if($data == 0){
            $this->sellshop2($player);
        }
        break;

          case 24002://ç¢ºèª
          if($data == 0){
          $this->sellshop2($player);
          }elseif($data == 1){
          $this->sellshop($player);
          }
          break;

          case 25000://è¿½åŠ 
            $data = json_decode($data,true);
          if($data[0] === ""){
            $this->error($player,14);
          }elseif($data[1] === ""){
            $this->error($player,14);
          }elseif($data[2] === ""){
            $this->error($player,14);
          }elseif($data[3] === ""){
            $this->error($player,14);
          }elseif($data[4] === ""){
            $this->error($player,14);
          }elseif(0 > $data[4]){
            $this->error($player,11);
          }else{
          $this->sellshop->set($data[0],["id" => $data[1],"damage" => $data[2],"amount" => $data[3],"coin" => $data[4]]);
          $this->sellshop->save();
          $this->allset();
          $buttons[] = ['text' => "ç¶šã‘ã¦è¿½åŠ ã™ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"æˆåŠŸ","è¿½åŠ ã§ãã¾ã—ãŸ",$buttons,25001);
          }
          break;

          case 25001:
          if($data == 0){
          $this->SetItem2($player);
          }
          break;

          case 26000:
          $id = 0;
          $item = $this->sellshop->getAll(true);
          foreach($item as $Con){
          $a = $this->sellshop->get($Con);
          if(!($data == $a["number"])){
          $id++;
          }else{
          $player->shop = $Con;
          $elements[] = ['type' => "input",'text' => "è¡¨ç¤ºå","placeholder" => "",'default' => $Con];
          $elements[] = ['type' => "input",'text' => "ã‚¢ã‚¤ãƒ†ãƒ ID","placeholder" => "",'default' => $a["id"]];
          $elements[] = ['type' => "input",'text' => "ãƒ€ãƒ¡ãƒ¼ã‚¸å€¤","placeholder" => "",'default' => $a["damage"]];
          $elements[] = ['type' => "input",'text' => "å€‹æ•°","placeholder" => "",'default' => $a["amount"]];
          $elements[] = ['type' => "input",'text' => "å€¤æ®µ(coin)","placeholder" => "",'default' => $a["coin"]];
          $this->sendCustom($player,"æ‰“ã¡è¾¼ã‚“ã§ãã ã•ã„",$elements,26001);
          }
        }
        break;

            case 26001://å®Œå…¨ã«è¨­å®š
            $data = json_decode($data,true);
             if($data[0] === ""){
            $this->error($player,13);
          }elseif($data[1] === ""){
            $this->error($player,13);
          }elseif($data[2] === ""){
            $this->error($player,13);
          }elseif($data[3] === ""){
            $this->error($player,13);
          }elseif($data[4] === ""){
            $this->error($player,13);
          }elseif(0 > $data[4]){
            $this->error($player,15);
          }elseif($player->shop == $data[1]){
          $this->sellshop->set($data[0],["id" => $data[1],"damage" => $data[2],"amount" => $data[3],"coin" => $data[4]]);
          $this->sellhop->save();
          $this->allset();
          $buttons[] = ['text' => "ç¶šã‘ã¦å¤‰æ›´ã™ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"æˆåŠŸ","å¤‰æ›´ã§ãã¾ã—ãŸ",$buttons,26002);
          }else{
          $this->sellshop->remove($player->shop);
          $this->sellshop->set($data[0],["id" => $data[1],"damage" => $data[2],"amount" => $data[3],"coin" => $data[4]]);
          $this->sellshop->save();
          $this->allset();
          $buttons[] = ['text' => "ç¶šã‘ã¦å¤‰æ›´ã™ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"æˆåŠŸ","å¤‰æ›´ã§ãã¾ã—ãŸ",$buttons,26002);


          }
          break;

          case 26002:
          if($data == 0){
          $this->changesellshop($player);
        }
        break;


          case 27000://å‰Šé™¤
          $id = 0;
          $item = $this->sellshop->getAll(true);
          foreach($item as $Con){
            $a = $this->sellshop->get($Con);
          if(!($data == $a["number"])){
          $id++;
          }else{
          $player->shop = $Con;
          $buttons[] = ['text' => "ã¯ã„"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"ç¢ºèª","æœ¬å½“ã«{$Con}ã‚’æ¶ˆã—ã¾ã™ã‹ï¼Ÿ",$buttons,27001);
          }
        }
          break;


          case 27001://ã¯ã„ã‚’æŠ¼ã—ãŸã¨ãã®åå¿œ
          if($data == 0){
          $this->sellshop->remove($player->shop);
          $this->sellshop->save();
          $this->allset();
          $buttons[] = ['text' => "ç¶šã‘ã¦å‰Šé™¤ã™ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"å‰Šé™¤æˆåŠŸ","å‰Šé™¤ã—ã¾ã—ãŸ",$buttons,27002);
          }
          break;


          case 27002://æ¬¡ã®å‹•ä½œ
          if($data == 0){
            $this->desellshop($player);
          }
          break;




          case 99999:
          case 99998:
          if($data == 0){
          $this->SetItem($player);
          }
          break;

          case 99997:
          if($data == 0){
          $this->buyshop($player);
          }
          break;

          case 99990:
          if($data == 0){
          $this->sellshop($player);
          }
          break;

          case 99989:
          if($data == 0){
          $this->changesellshop($player);
          }
          break;


          }
        }
      }
    }

    public function allset(){
      $id = 0;
        $item = $this->buyshop->getAll(true);
          foreach($item as $Con){
            $a = $this->buyshop->get($Con);
            $this->buyshop->set($Con,["id" => $a["id"],"damage" => $a["damage"],"amount" => $a["amount"],"coin" => $a["coin"],"number" => $id]);
            $this->buyshop->save();
            $id++;
            }
            $id = 0;
          $item = $this->sellshop->getAll(true);
          foreach($item as $Con){
            $a = $this->sellshop->get($Con);
            $this->sellshop->set($Con,["id" => $a["id"],"damage" => $a["damage"],"amount" => $a["amount"],"coin" => $a["coin"],"number" => $id]);
            $this->sellshop->save();
            $id++;
           }
         }
         

    public function changebuyshop($player){
        $item = $this->buyshop->getAll(true);
          foreach($item as $Con){
            $a = $this->buyshop->get($Con);
          $buttons[] = ['text' => $Con." (æžšæ•°:".$a["coin"].") [å€‹æ•°".$a["amount"]."]"];
          }
          if(!isset($buttons)){
           $this->error($player,9);
           }else{
          $this->sendForm($player,"ã©ã‚Œã®å†…å®¹ã‚’å¤‰æ›´ã—ã¾ã™ã‹ï¼Ÿ","",$buttons,23001);
           }
          }

    public function debuyshop($player){
          $item = $this->buyshop->getAll(true);
          foreach($item as $Con){
             $a = $this->buyshop->get($Con);
          $buttons[] = ['text' => $Con." (æžšæ•°:".$a["coin"].") [å€‹æ•°".$a["amount"]."]"];
          }
          if(!isset($buttons)){
           $this->error($player,6);
           }else{
          $this->sendForm($player,"ã©ã‚Œã‚’æ¶ˆã—ã¾ã™ã‹ï¼Ÿ","",$buttons,22001);
           }
          }


      public function buyshop($player){
        $item = $this->buyshop->getAll(true);
          foreach($item as $Con){
             $a = $this->buyshop->get($Con);
          $buttons[] = ['text' => $Con." (æžšæ•°:".$a["coin"].") [å€‹æ•°".$a["amount"]."]"];
          }
          if(!isset($buttons)){
           $this->error($player,5);
          }else{
          $this->sendForm($player,"ã©ã‚Œã‚’Coinã¨äº¤æ›ã—ã¾ã™ã‹ï¼Ÿ","(Coinæžšæ•°)ã¨[å€‹æ•°]",$buttons,20000);
        }
    }

      public function buyshop2($player){
          $a = $this->buyshop->get($player->shop);
          if($a["coin"] > $this->coin->GetCoin($player)){
          $this->error($player,3);
          }else{
          $this->coin->MinusCoin($player,$a["coin"]);
          $player->getInventory()->addItem(Item::get($a["id"],$a["damage"],$a["amount"]));
          $buttons[] = ['text' => "åŒã˜ã‚‚ã®ã‚’è³¼å…¥ã™ã‚‹"];
          $buttons[] = ['text' => "shopã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"æˆåŠŸ",$player->shop."ã¨Coinã‚’äº¤æ›ã—ã¾ã—ãŸ",$buttons,20002);
          }

    }

          public function sellshop($player){
        $item = $this->sellshop->getAll(true);
          foreach($item as $Con){
          $a = $this->sellshop->get($Con);
          $buttons[] = ['text' => $Con." (æžšæ•°:".$a["coin"].") [å€‹æ•°".$a["amount"]."]"];
          }
          if(!isset($buttons)){
          $this->error($player,11);
          }else{
          $this->sendForm($player,"ã©ã‚Œã‚’Coinã«ã—ã¾ã™ã‹ï¼Ÿ","(Coinæžšæ•°)ã¨[å€‹æ•°]",$buttons,24000);
        }
    }


        public function sellshop2($player){
          $a = $this->sellshop->get($player->shop);
          if(!$player->getInventory()->contains(Item::get($a["id"],$a["damage"],$a["amount"]))){
          $this->error($player,12);
          }else{
          $this->coin->PlusCoin($player,$a["coin"]);
          $player->getInventory()->removeItem(Item::get($a["id"],$a["damage"],$a["amount"]));
          $buttons[] = ['text' => "åŒã˜ã‚‚ã®ã‚’Coinã«ã™ã‚‹"];
          $buttons[] = ['text' => "sellshopã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"æˆåŠŸ",$player->shop."ã‚’Coinã«ã—ã¾ã—ãŸ",$buttons,24002);
          }
        }

        public function changesellshop($player){
        $item = $this->sellshop->getAll(true);
          foreach($item as $Con){
            $a = $this->sellshop->get($Con);
          $buttons[] = ['text' => $Con." (æžšæ•°:".$a["coin"].") [å€‹æ•°".$a["amount"]."]"];
          }
          if(!isset($buttons)){
           $this->error($player,9);
           }else{
          $this->sendForm($player,"ã©ã‚Œã®å†…å®¹ã‚’å¤‰æ›´ã—ã¾ã™ã‹ï¼Ÿ","",$buttons,26000);
           }
          }

    public function desellshop($player){
          $item = $this->sellshop->getAll(true);
          foreach($item as $Con){
             $a = $this->sellshop->get($Con);
          $buttons[] = ['text' => $Con." (æžšæ•°:".$a["coin"].") [å€‹æ•°".$a["amount"]."]"];
          }
          if(!isset($buttons)){
           $this->error($player,6);
           }else{
          $this->sendForm($player,"ã©ã‚Œã‚’æ¶ˆã—ã¾ã™ã‹ï¼Ÿ","",$buttons,27000);
           }
          }


        public function SetItem($player){
          $elements[] = ['type' => "input",'text' => "è¡¨ç¤ºå","placeholder" => "",'default' => ""];
          $elements[] = ['type' => "input",'text' => "ã‚¢ã‚¤ãƒ†ãƒ ID","placeholder" => "",'default' => ""];
          $elements[] = ['type' => "input",'text' => "ãƒ€ãƒ¡ãƒ¼ã‚¸å€¤","placeholder" => "",'default' => ""];
          $elements[] = ['type' => "input",'text' => "å€‹æ•°","placeholder" => "",'default' => ""];
          $elements[] = ['type' => "input",'text' => "å€¤æ®µ(coin)","placeholder" => "",'default' => ""];
            $this->sendCustom($player,"æ‰“ã¡è¾¼ã‚“ã§ãã ã•ã„",$elements,21001);
          }

        public function SetItem2($player){
          $elements[] = ['type' => "input",'text' => "è¡¨ç¤ºå","placeholder" => "",'default' => ""];
          $elements[] = ['type' => "input",'text' => "ã‚¢ã‚¤ãƒ†ãƒ ID","placeholder" => "",'default' => ""];
          $elements[] = ['type' => "input",'text' => "ãƒ€ãƒ¡ãƒ¼ã‚¸å€¤","placeholder" => "",'default' => ""];
          $elements[] = ['type' => "input",'text' => "å€‹æ•°","placeholder" => "",'default' => ""];
          $elements[] = ['type' => "input",'text' => "å€¤æ®µ(coin)","placeholder" => "",'default' => ""];
            $this->sendCustom($player,"æ‰“ã¡è¾¼ã‚“ã§ãã ã•ã„",$elements,25000);
          }








      public function error($player,$id){
          if($id === 1){
          $buttons[] = ['text' => "å…¥åŠ›ç”»é¢ã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"å…¥åŠ›ã—ã¦ãªã„ç®‡æ‰€ãŒã‚ã‚Šã¾ã™\nâ€»æ‰“ã¡ç›´ã—ã«ãªã‚Šã¾ã™",$buttons,99999);
        }elseif($id === 2){
          $buttons[] = ['text' => "å…¥åŠ›ç”»é¢ã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"å€¤æ®µãŒ0æœªæº€ã§ã™\nâ€»æ‰“ã¡ç›´ã—ã«ãªã‚Šã¾ã™",$buttons,99998);
        }elseif($id === 3){
          $buttons[] = ['text' => "buyshopã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"æ‰‹æŒã¡ã®coinãŒè¶³ã‚Šã¾ã›ã‚“",$buttons,99997);
        }elseif($id === 4){
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"opã§ã¯ãªã„ãŸã‚è¿½åŠ ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“",$buttons,99996);
        }elseif($id === 5){
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"shopã«äº¤æ›ã§ãã‚‹ã‚¢ã‚¤ãƒ†ãƒ ãŒå­˜åœ¨ã—ã¾ã›ã‚“\nopã«é ¼ã‚“ã§è¿½åŠ ã—ã¦ã‚‚ã‚‰ã£ã¦ãã ã•ã„",$buttons,99995);
        }elseif($id === 6){
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"shopã«æ¶ˆã›ã‚‹ã‚‚ã®ãŒã‚ã‚Šã¾ã›ã‚“",$buttons,99994);
        }elseif($id === 7){
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"opã§ã¯ãªã„ãŸã‚å‰Šé™¤ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“",$buttons,99993);
        }elseif($id === 8){
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"opã§ã¯ãªã„ãŸã‚å†…å®¹ã‚’å¤‰æ›´ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“",$buttons,99992);
        }elseif($id === 9){
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"å†…å®¹å¤‰æ›´ã§ãã‚‹ã‚‚ã®ãŒã‚ã‚Šã¾ã›ã‚“",$buttons,99991);
        }elseif($id === 10){
          $buttons[] = ['text' => "é¸æŠžç”»é¢ã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"å…¥åŠ›ã—ã¦ã„ãªã„ç®‡æ‰€ãŒã‚ã‚Šã¾ã™",$buttons,23003);
          }elseif($id === 11){
          $buttons[] = ['text' => "é¸æŠžç”»é¢ã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"å€¤æ®µãŒ0æœªæº€ã§ã™",$buttons,23003);
        }elseif($id === 12){
          $buttons[] = ['text' => "sellshopã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"æ‰‹æŒã¡ã®ã‚¢ã‚¤ãƒ†ãƒ ãŒè¶³ã‚Šã¾ã›ã‚“",$buttons,99990);
          }elseif($id === 13){
          $buttons[] = ['text' => "é¸æŠžç”»é¢ã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"æ‰“ã£ã¦ã„ãªã„ç®‡æ‰€ãŒã‚ã‚Šã¾ã™",$buttons,99989);
        }elseif($id === 14){
          $buttons[] = ['text' => "å…¥åŠ›ç”»é¢ã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"å…¥åŠ›ã—ã¦ãªã„ç®‡æ‰€ãŒã‚ã‚Šã¾ã™\nâ€»æ‰“ã¡ç›´ã—ã«ãªã‚Šã¾ã™",$buttons,25001);
        }elseif($id === 15){
          $buttons[] = ['text' => "é¸æŠžç”»é¢ã«æˆ»ã‚‹"];
          $buttons[] = ['text' => "é–‰ã˜ã‚‹"];
          $this->sendForm($player,"error number.".$id,"å€¤æ®µãŒ0æœªæº€ã§ã™\n",$buttons,26002);
        }
        }

   public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool{
        switch($command->getName()){

          case "bshop":
          if(!isset($args[0])){
          $this->buyshop($sender);
          break;
          }elseif($args[0] == "add" or $args[0] == "a"){
          if($sender->isOp()){
          $this->SetItem($sender,21001);
          }else{
          $this->error($sender,4);
          }
          }elseif($args[0] == "delete" or $args[0] == "d"){
          if($sender->isOp()){
          $this->debuyshop($sender);
          }else{
          $this->error($sender,7);
          }
          }elseif($args[0] == "change" or $args[0] == "c"){
          if($sender->isOp()){
          $this->changebuyshop($sender);
          }else{
          $this->error($sender,8);
          }
        }else{
          $this->buyshop($sender);
        }
          break;

          case "sshop":
          if(!isset($args[0])){
          $this->sellshop($sender);
          break;
          }elseif($args[0] == "add" or $args[0] == "a"){
          if($sender->isOp()){
          $this->SetItem2($sender);
          }else{
          $this->error($sender,4);
          }
          }elseif($args[0] == "delete" or $args[0] == "d"){
          if($sender->isOp()){
          $this->desellshop($sender);
          }else{
          $this->error($sender,7);
          }
          }elseif($args[0] == "change" or $args[0] == "c"){
          if($sender->isOp()){
          $this->changesellshop($sender);
          }else{
          $this->error($sender,8);
          }
        }else{
          $this->sellshop($sender);
        }






        }
        return true;
}
}
name: CoinShop
main: CoinShop\Main
api: [3.0.0,4.0.0]
version: 2.0.0
author: mixpowder
commands:
 bshop:
  usage: /bshop
  description: buyshopã‚’é–‹ã
 sshop:
  usage: /sshop
  description: sellshopã‚’é–‹ãlœƒ°·ôƒOFH+½«¤õeÕ>   GBMB