
<?php
echo "PocketMine-MP plugin Repair v1.5.0
This file has been generated using DevTools v1.13.0 at Sun, 24 Feb 2019 12:34:38 +0900
----------------
";

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:6:"Repair";s:7:"version";s:5:"1.5.0";s:4:"main";s:19:"tatchan\Repair\Main";s:3:"api";s:5:"3.6.0";s:6:"depend";s:0:"";s:11:"description";s:33:"コマンドで修理できるよ";s:7:"authors";s:0:"";s:7:"website";s:0:"";s:12:"creationDate";i:1550979278;}
   plugin.yml1  r\1  ?L+         src/tatchan/Repair/Main.php	  r\	  #=W      #Name of your plugin. This is self-explanatory. Plugin names SHOULD NOT contain spaces.
name: Repair

#Fully-qualified class-name of your plugin's main class. This is usually the one that extends PluginBase.
#Since PocketMine-MP's autoloader is PSR-0, your plugin's main-class namespace will usually be the same as the folder path.
main: tatchan\Repair\Main

#Version name/number of your plugin
version: 1.5.0


api: 3.6.0

#When to load the plugin. There are currently two options for this: STARTUP and POSTWORLD. Usually POSTWORLD will do fine.
load: POSTWORLD

#Name of the person who wrote the plugin. This can be anything you like.
author: tatchan

description: "コマンドで修理できるよ"
commands:

 repair:
  #Description to show in the Help command
  description: "コマンドで修理できるよ"
<?php



namespace tatchan\Repair;

use pocketmine\plugin\PluginBase;
use pocketmine\command\CommandSender;
use pocketmine\command\Command;
use pocketmine\Player;
use pocketmine\event\Lisnener;
use pocketmine\item\Armor;
use pocketmine\utils\Config;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\utils\TextFormat;
use pocketmine\utils\Utils;
use onebone\economyapi\EconomyAPI;




class Main extends PluginBase{

    public function onEnable(){
        $this->getLogger()->info("§d入れてくれてありがとう");
        $this->getLogger()->warning("§amake by tatchan バグ等あったら報告ください");
        $this->EconomyAPI = $this->getServer()->getPluginManager()->getPlugin("EconomyAPI");
        $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array(
'money' => '15000'
));
    }
public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool{
        switch($command->getName()){
            case "repair":
             if(!$sender instanceof Player){
                        $sender->sendMessage("[ItemRepair]ゲーム内で実行してください");
                       return true;
                    }else{
                    $pay = $this->config->get("money");
                    if ($this->hasEnoughMoney($sender, $pay)) {
                   $item = $sender->getInventory()->getItemInHand();
                    if($item->getDamage() > 0){
                         EconomyAPI::getInstance()->reduceMoney($sender, $pay);
                        $sender->getInventory()->setItemInHand($item->setDamage(0));
                        $sender->sendMessage("§6$".$pay."払って修復しました");
                    }else{
                        $sender->sendMessage("§6修理の必要がありません");
                    }
                    
                }else{
                $sender->sendMessage("§eお金が足りません");
                }
                }
                break;
            }
            return true;
        }
    public function onDisable(){
        $this->getLogger()->info("Bye");
    }
    public function hasEnoughMoney($sender, $pay)
    {
        $have = EconomyAPI::getInstance()->myMoney($sender);
        return ($have >= $pay) ? true : false;
    }
}pp5"#CVx   GBMB