Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace NPS;
- use pocketmine\plugin\PluginBase;
- use pocketmine\event\Listener;
- use pocketmine\event\player\PlayerCommandPreprocessEvent;
- use pocketmine\level\Position;
- use pocketmine\entity\Human;
- use pocketmine\nbt\tag\CompoundTag;
- use pocketmine\nbt\tag\ListTag;
- use pocketmine\nbt\tag\DoubleTag;
- use pocketmine\nbt\tag\FloatTag;
- use pocketmine\nbt\tag\StringTag;
- use pocketmine\item\Item;
- use pocketmine\entity\Entity;
- use pocketmine\utils\TextFormat;
- use pocketmine\inventory\PlayerInventory;
- class NPS extends PluginBase implements Listener{
- public function onEnable(){
- $this->getServer()->getPluginManager()->registerEvents($this, $this);
- $this->getLogger()->info('§2NPS load!');
- }
- public function help(PlayerCommandPreprocessEvent $event){
- $cmd = explode(" ", strtolower($event->getMessage()) );
- if ($cmd[0] == '/nps'){
- $player = $event->getPlayer();
- $npc = new Human($player->chunk,
- new CompoundTag("", [
- "Pos" => new ListTag("Pos", [
- new DoubleTag("", $player->getX()),
- new DoubleTag("", $player->getY()),
- new DoubleTag("", $player->getZ())
- ]),
- "Motion" => new ListTag("Motion", [
- new DoubleTag("", 0),
- new DoubleTag("", 0),
- new DoubleTag("", 0)
- ]),
- "Rotation" => new ListTag("Rotation", [
- new FloatTag("", $player->getYaw()),
- new FloatTag("", $player->getPitch())
- ]),
- "Skin" => new CompoundTag("Skin", [
- "Data" => new StringTag("Data", $player->getSkinData())
- ])
- ]
- ));
- $npc->setNameTag(TextFormat::GOLD.'Hunger Game');
- $npc->getInventory()->setItemInHand( Item::get(340,0,1));
- $npc->spawnToAll();
- }
- }//end function
- } //end class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement