<?php __HALT_COMPILER(); ?>
p                     src/tatchan/GetItem/Main.php  k[        
   plugin.yml  k[         <?php


namespace tatchan\GetItem;

use pocketmine\plugin\PluginBase;
use pocketmine\command\CommandSender;
use pocketmine\command\Command;
use pocketmine\Player;
use pocketmine\utils\Config;
use pocketmine\item\Item;
use pocketmine\event\Listener;
$filename = "plugin_data\GetItem\config.yml";
class Main extends PluginBase implements Listener {
	public function onEnable(){
		$this->getServer()->getPluginManager()->registerEvents($this, $this);
		$this->getLogger()->info("§aGetItem起動しました");
$this->config = new Config($this->getDataFolder()."config.yml", Config::YAML, 
				[
				"アイテムID" => "0",
				"ダメージ値" => "0",
				"個数" => "0",
				]);
	}
	public function onDisable(){
		$this->getServer()->info("§aGetItem停止しました");
}

	public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool{
		switch($command->getName()){
			case "item";
			if(!$sender instanceof Player){
				$sender->senderMessage("§cゲーム内で実行してね");
				return true;
			}else{
				$player = $sender->getPlayer();
				$itemid = $this->config->get("アイテムID");
				$damage = $this->config->get("ダメージ値");
				$count = $this->config->get("個数");
			$item = Item::get($itemid, $damage, $count);
			$itemname = $item->getName();
			$player->getInventory()->addItem($item);
			$sender->sendMessage($itemname . "を" . $count . "個を与えました");
			return true;
		}

			

}
}
}#Name of your plugin. This is self-explanatory. Plugin names SHOULD NOT contain spaces.
name: GetItem

#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\GetItem\Main

#Version name/number of your plugin
version: 1.0.0

#API version that your plugin supports. If your plugin's API is not compatible with that of the server, the server will refuse to load your plugin.
#The API version is changed when:
# - Breaking changes are made to a development version, things that might cause your plugin to crash.
#     This is denoted by an API suffix, for example 3.0.0-ALPHA4. If the version does not match as a whole on a development version, the plugin will not be loaded. (Suffixes are non-case-sensitive.)
# - Breaking changes are made to a release version, things that might cause your plugin to crash.
#     This usually warrants a major API bump, e.g. 2.0.0 -> 3.0.0. If the major version does not match, the plugin will not be loaded.
# - Feature additions which do not break existing plugins.
#     This is denoted by a minor API bump, e.g. 2.0.0 -> 2.1.0. The server will load plugins with an equivalent or older minor version.
# - Minor bug fixes or insignificant alterations to the API.
#     This is denoted by a patch bump, e.g. 1.13.0 -> 1.13.1
api: 4.0.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

commands:
  item:
    description: "/itemで指定したアイテムをゲットできます"Ήn~C"~p3s   GBMB