
<?php
echo "PocketMine-MP plugin npc v3.0.0
This file has been generated using DevTools v1.13.4 at Wed, 27 May 2020 15:48:13 +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:3:"npc";s:7:"version";s:5:"3.0.0";s:4:"main";s:16:"tatchan\npc\Main";s:3:"api";s:6:"3.11.6";s:6:"depend";s:0:"";s:11:"description";s:12:"npcの管理";s:7:"authors";s:0:"";s:7:"website";s:0:"";s:12:"creationDate";i:1590565693;}
   plugin.yml  >^  w         src/tatchan/npc/Form/npc.php  >^           src/tatchan/npc/Main.php
  >^
  +6      #Name of your plugin. This is self-explanatory. Plugin names SHOULD NOT contain spaces.
name: npc

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

#Version name/number of your plugin
version: 3.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: 3.11.6

#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

#Simple description of what the plugin is or does. Try to keep this short.
description: "npcの管理"

#Website for your plugin. This could be a GitHub repository URL, a website of your own, or anything you like. This is optional

#Commands that your plugin has. You can capture the execution of these via the `onCommand()` method in your PluginBase, or the registered CommandExecutor for the command.
#This node is optional and can be removed if your plugin will not have any commands.
commands:
 npc:
  description: "NPCを出す"
  default: op
 npcremover:
  description: "NPCを消す"
  default: op<?php

namespace tatchan\npc\Form;

use pocketmine\form\Form;
use pocketmine\Player;
use pocketmine\item\Item;
use pocketmine\nbt\tag\StringTag;
use pocketmine\math\Vector3;
use pocketmine\level\Level;
use pocketmine\entity\{Entity, Human};
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\DoubleTag;
use pocketmine\utils\Config;
class npc implements Form{
public function onEnable() {
 }
    public function handleResponse(Player $player, $data): void {

        if ($data === null) {
            return;
        }

$nbt = Human::createBaseNBT($player, null, $player->yaw, $player->pitch);
$nbt->setTag($player->namedtag->getTag("Skin"));
$npc = new Human($player->getLevel(), $nbt);
$npc->setNameTag($data[0]);
$type = $npc->namedtag->getCompoundTag("type") ?? new CompoundTag("type");
$speak = $npc->namedtag->getCompoundTag("speak") ?? new CompoundTag("speak");
$speak->setString($data[1], $data[1]);
$type->setString("npc","npc");
$npc->namedtag->setTag($speak);
$npc->namedtag->setTag($type);
$npc->setImmobile();
$npc->spawnToAll();
    }

    public function jsonSerialize(){

        return [
            "type" => "custom_form",
            "title" => "NPC",
            "content" => [
                [
                    "type" => "input",
                    "text" => "名前",
                    "placeholder" => "ここに記入",
                    "default" => "",
                ],
                [
                    "type" => "input",
                    "text" => "しゃべること",
                    "placeholder" => "ここに記入",
                    "default" => ""
                ]
            ]
        ];
    }
}<?php


namespace tatchan\npc;

use pocketmine\Player;
use pocketmine\plugin\PluginBase;
use pocketmine\command\CommandSender;
use pocketmine\command\Command;
use pocketmine\math\Vector3;
use pocketmine\level\Level;
use pocketmine\entity\Entity;
use  pocketmine\entity\Human;
use tatchan\npc\Form\npc;
use pocketmine\event\Listener;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\event\entity\EntityDamageByEntityEvent;
use pocketmine\utils\Config;
use pocketmine\item\Item;
class main extends PluginBase implements Listener
{

    public function onEnable(): void
    {
        $this->getLogger()->info("Hello World!");
        $this->getServer()->getPluginManager()->registerEvents($this, $this);
        Entity::registerEntity(NPC::class, true);
    }

    public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool
    {
        switch ($command->getName()) {

            case "npc":
                if ($sender instanceof Player) {
                    $sender->sendForm(new npc());
                    return true;
                }
            case "npcremover":
                if ($sender instanceof Player) {
                    $item = Item::get(369, 0, 1);
                    $item->setCustomName("§aNPCREMOVER");
                    $sender->getInventory()->addItem($item);
                    $sender->sendMessage("§a<<NPCリムーバーを出しました");
                    return true;
                }
            default:
                return false;
        }
    }

    public function onDamage(EntityDamageEvent $event)
    {
        if ($event->getCause() === 1) {
            $damager = $event->getDamager();
            $entity = $event->getEntity();
            $name = $damager->getInventory()->getItemInHand()->getName();
            $id = $entity->getId();
            if (($speak = $entity->namedtag->getCompoundTag("speak")) !== null) {
                foreach ($speak as $stringTag) {
                    $damager->sendMessage($stringTag->getValue());
                }
            }
        }
        $damager = $event->getDamager();
        $name = $damager->getInventory()->getItemInHand()->getName();
        $entity = $event->getEntity();
        if (($type = $entity->namedtag->getCompoundTag("type")) !== null) {

            foreach ($type as $stringTag2) {
                if ($stringTag2->getValue() == "npc") {
                    if ($name == "§aNPCREMOVER") {
                        $entity->kill();
                    }
                    if ($event->getCause() === 2) {
                        $event->setCancelled(true);
                    }
                    $event->setCancelled(true);
                }
            }
        }
    }
}
`[2V!'.F^R   GBMB