Advertisement
Guest User

psihuy

a guest
Mar 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.11 KB | None | 0 0
  1. <?php
  2.  
  3. namespace HUYYYYYYYYY; //НЕ ЗАБУДЬ ИЗМЕНИТЬ ЗДЕСЬ
  4.  
  5. use pocketmine\event\player\{PlayerQuitEvent,PlayerInteractEvent};
  6.  
  7. class PsiHuy /*НЕ ЗАБУДЬ ИЗМЕНИТЬ ЗДЕСЬ*/ extends \pocketmine\plugin\PluginBase implements \pocketmine\event\Listener{
  8.  
  9.     public $in = [];
  10.  
  11.     public function onEnable(){
  12.         $this->getServer()->getPluginManager()->registerEvents($this,$this);
  13.         $this->in = [];
  14.     }
  15.  
  16.     public function joinEvent(PlayerQuitEvent $e){
  17.         if(isset($this->in[$e->getPlayer()->getName()])) unset($this->in[$e->getPlayer()->getName()]);
  18.     }
  19.  
  20.     public function interactEvent(PlayerInteractEvent $e){
  21.         $p = $e->getPlayer();
  22.         if($e->getAction() == PlayerInteractEvent::RIGHT_CLICK_AIR or $e->getAction() == PlayerInteractEvent::LEFT_CLICK_AIR){
  23.             if($e->getItem()->getId() == 409 and $e->getItem()->getCustomName() == " §r§a§lПси-Ускоритель материи§r"){
  24.                 if($p->getLevel()->getName() == "lobby" and $this->getServer()->getPluginManager()->getPlugin("PurePerms")->getUserDataMgr()->getGroup($p)->getName() !== "Player"){
  25.                     if(isset($this->in[$p->getName()])){
  26.                         $p->sendMessage("§cТы уже юзал психуй сука! Учись ждать");
  27.                         return false;
  28.                     }
  29.                     $p->setMotion(new \pocketmine\math\Vector3(0,0.7,0));
  30.                     $p->setMotion($p->getDirectionVector()->multiply(1.3));
  31.                     $p->sendPopup("§7Ускорение в пространстве...");
  32.                     $p->setGliding(true);
  33.                     $this->in[$p->getName()] = "yes";
  34.                     $this->getServer()->getScheduler()->scheduleDelayedTask(new PsiHuyTask($this,$p),20); //МОЖЕШЬ ИЗМЕНИТЬ ЗДЕСЬ КУЛДАУН
  35.                 }
  36.             }
  37.         }
  38.     }
  39. }
  40.  
  41. class PsiHuyTask extends \pocketmine\scheduler\PluginTask{
  42.  
  43.     public $p;
  44.  
  45.     public function __construct(PsiHuy /*НЕ ЗАБУДЬ ИЗМЕНИТЬ ЗДЕСЬ*/$pg, $p){
  46.         parent::__construct($pg);
  47.     }
  48.  
  49.     public function onRun($currentTick){
  50.         if(isset($this->getOwner()->in[$this->p->getName()])) unset($this->getOwner()->in[$this->p->getName()]);
  51.         $this->getOwner()->getScheduler()->cancelTask($this->getTaskId());
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement