Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. <?php
  2.  
  3. namespace NPS;
  4.  
  5. use pocketmine\plugin\PluginBase;
  6. use pocketmine\event\Listener;
  7. use pocketmine\event\player\PlayerCommandPreprocessEvent;
  8. use pocketmine\level\Position;
  9. use pocketmine\entity\Human;
  10. use pocketmine\nbt\tag\CompoundTag;
  11. use pocketmine\nbt\tag\ListTag;
  12. use pocketmine\nbt\tag\DoubleTag;
  13. use pocketmine\nbt\tag\FloatTag;
  14. use pocketmine\nbt\tag\StringTag;
  15. use pocketmine\item\Item;
  16. use pocketmine\entity\Entity;
  17. use pocketmine\utils\TextFormat;
  18. use pocketmine\inventory\PlayerInventory;
  19.  
  20. class NPS extends PluginBase implements Listener{
  21.  
  22. public function onEnable(){
  23. $this->getServer()->getPluginManager()->registerEvents($this, $this);
  24. $this->getLogger()->info('§2NPS load!');
  25. }
  26.  
  27. public function help(PlayerCommandPreprocessEvent $event){
  28. $cmd = explode(" ", strtolower($event->getMessage()) );
  29. if ($cmd[0] == '/nps'){
  30.  
  31. $player = $event->getPlayer();
  32.  
  33. $npc = new Human($player->chunk,
  34. new CompoundTag("", [
  35. "Pos" => new ListTag("Pos", [
  36. new DoubleTag("", $player->getX()),
  37. new DoubleTag("", $player->getY()),
  38. new DoubleTag("", $player->getZ())
  39. ]),
  40. "Motion" => new ListTag("Motion", [
  41. new DoubleTag("", 0),
  42. new DoubleTag("", 0),
  43. new DoubleTag("", 0)
  44. ]),
  45. "Rotation" => new ListTag("Rotation", [
  46. new FloatTag("", $player->getYaw()),
  47. new FloatTag("", $player->getPitch())
  48. ]),
  49. "Skin" => new CompoundTag("Skin", [
  50. "Data" => new StringTag("Data", $player->getSkinData())
  51. ])
  52. ]
  53. ));
  54. $npc->setNameTag(TextFormat::GOLD.'Hunger Game');
  55. $npc->getInventory()->setItemInHand( Item::get(340,0,1));
  56. $npc->spawnToAll();
  57.  
  58.  
  59.  
  60. }
  61. }//end function
  62. } //end class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement