getTarget() public method

public getTarget ( )
Ejemplo n.º 1
0
 public function onLevelChange(EntityLevelChangeEvent $event)
 {
     $player = $event->getEntity();
     $level = $event->getTarget();
     if ($player instanceof Player) {
         $this->plugin->setPermissions($level, $player);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param EntityLevelChangeEvent $event
  * @priority LOWEST
  */
 public function onLevelChange(EntityLevelChangeEvent $event)
 {
     $player = $event->getEntity();
     $isMultiWorldPermsEnabled = $this->plugin->getConfigValue("enable-multiworld-perms");
     $levelName = $isMultiWorldPermsEnabled ? $event->getTarget()->getName() : null;
     if ($player instanceof Player) {
         $this->plugin->updatePermissions($player, $levelName);
     }
 }
Ejemplo n.º 3
0
 public function onLevelChange(EntityLevelChangeEvent $ev)
 {
     if (!$this->auto) {
         return;
     }
     $pl = $ev->getEntity();
     if (!$pl instanceof Player) {
         return;
     }
     $level = $ev->getTarget()->getName();
     $this->showMotd($pl, $level);
 }
Ejemplo n.º 4
0
 public function onLevelChange(EntityLevelChangeEvent $event)
 {
     if ($event->getEntity() instanceof Player and $event->getTarget()->getName() == $this->getConfig()->get('aworld')) {
         foreach ($this->getServer()->getLevelByName($this->getConfig()->get('aworld'))->getPlayers() as $p) {
             $p->sendMessage("A player joined the game!");
             $playersleft = $this->getConfig()->get('neededplayers') - $this->aplayers;
             $p->sendMessage("Players left untill the game begin: " . $playersleft);
         }
     }
 }
Ejemplo n.º 5
0
 public function onLevelChange(EntityLevelChangeEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $pl = $ev->getEntity();
     if (!$pl instanceof Player) {
         return;
     }
     //echo $pl->getName()." Level Change\n";
     foreach ($this->getServer()->getLevels() as $lv) {
         $this->despawnPlayerCases($pl, $lv);
     }
     $this->getServer()->getScheduler()->scheduleDelayedTask(new PluginCallbackTask($this, [$this, "spawnPlayerCases"], [$pl, $ev->getTarget()]), 20);
     //$this->spawnPlayerCases($pl,$ev->getTarget());
 }
Ejemplo n.º 6
0
 /**
  * @param EntityLevelChangeEvent $event
  *
  * @priority MONITOR
  */
 public function onEntityLevelChange(EntityLevelChangeEvent $event)
 {
     $entity = $event->getEntity();
     if ($entity instanceof Player) {
         $this->getPlugin()->switchLevelVanish($entity, $event->getOrigin(), $event->getTarget());
     }
 }
Ejemplo n.º 7
0
 /**
  * @priority HIGHEST
  */
 public function levelChg(EntityLevelChangeEvent $ev)
 {
     echo __METHOD__ . "," . __LINE__ . "\n";
     //##DEBUG
     if ($ev->isCancelled()) {
         return;
     }
     $player = $ev->getEntity();
     if (!$player instanceof Player) {
         return;
     }
     if ($player->isCreative()) {
         return;
     }
     if ($player->hasPermission("liab.keep")) {
         return;
     }
     if (!$this->saveInventory($player, $ev->getOrigin())) {
         return;
     }
     $player->getInventory()->clearAll();
     if (!$this->loadInventory($player, $ev->getTarget())) {
         return;
     }
 }
Ejemplo n.º 8
0
 public function onWorldChange(EntityLevelChangeEvent $event)
 {
     $entity = $event->getEntity();
     CustomAlerts::getAPI()->setWorldChangeMessage("");
     //Check if the Entity is a Player
     if ($entity instanceof Player) {
         $player = $entity;
         $origin = $event->getOrigin();
         $target = $event->getTarget();
         //Check if Default WorldChange Message is enabled
         if (CustomAlerts::getAPI()->isDefaultWorldChangeMessageEnabled()) {
             CustomAlerts::getAPI()->setWorldChangeMessage(CustomAlerts::getAPI()->getDefaultWorldChangeMessage($player, $origin, $target));
         }
         //WorldChange Event
         $this->plugin->getServer()->getPluginManager()->callEvent(new CustomAlertsWorldChangeEvent($player, $origin, $target));
         if (CustomAlerts::getAPI()->getWorldChangeMessage() != "") {
             Server::getInstance()->broadcastMessage(CustomAlerts::getAPI()->getWorldChangeMessage());
         }
     }
 }
Ejemplo n.º 9
0
 public function onLevelChange(EntityLevelChangeEvent $event)
 {
     echo __METHOD__ . "," . __LINE__ . "\n";
     if ($event->isCancelled()) {
         return;
     }
     $player = $event->getEntity();
     if (!$player instanceof Player) {
         return;
     }
     if ($player->isCreative()) {
         return;
     }
     if (!$this->saveInventory($player, $event->getOrigin())) {
         return;
     }
     $player->getInventory()->clearAll();
     if (!$this->loadInventory($player, $event->getTarget())) {
         return;
     }
     $slot = $this->getConfig()->get("slot");
     $item = $this->getConfig()->get("ID");
     $damage = $this->getConfig()->get("Damage");
     $ammount = $this->getConfig()->get("Ammount");
     $level = $event->getLevel();
     $world = $this->getConfig()->get("world");
     if ($level == $world && $slot <= 35) {
         $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount));
     }
     $slot = $this->getConfig()->get("slot2");
     $item = $this->getConfig()->get("ID2");
     $damage = $this->getConfig()->get("Damage2");
     $ammount = $this->getConfig()->get("Ammount2");
     $level = $event->getLevel();
     $world = $this->getConfig()->get("world");
     if ($level == $world && $slot <= 35) {
         $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount));
     }
     $slot = $this->getConfig()->get("slot3");
     $item = $this->getConfig()->get("ID3");
     $damage = $this->getConfig()->get("Damage3");
     $ammount = $this->getConfig()->get("Ammount3");
     $level = $event->getLevel();
     $world = $this->getConfig()->get("world");
     if ($level == $world && $slot <= 35) {
         $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount));
     }
     $slot = $this->getConfig()->get("slot4");
     $item = $this->getConfig()->get("ID4");
     $damage = $this->getConfig()->get("Damage4");
     $ammount = $this->getConfig()->get("Ammount4");
     $level = $event->getLevel();
     $world = $this->getConfig()->get("world");
     if ($level == $world && $slot <= 35) {
         $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount));
     }
     $slot = $this->getConfig()->get("slot5");
     $item = $this->getConfig()->get("ID5");
     $damage = $this->getConfig()->get("Damage5");
     $ammount = $this->getConfig()->get("Ammount5");
     $level = $event->getLevel();
     $world = $this->getConfig()->get("world");
     if ($level == $world && $slot <= 35) {
         $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount));
     }
     $slot = $this->getConfig()->get("slot6");
     $item = $this->getConfig()->get("ID6");
     $damage = $this->getConfig()->get("Damage6");
     $ammount = $this->getConfig()->get("Ammount6");
     $level = $event->getLevel();
     $world = $this->getConfig()->get("world");
     if ($level == $world && $slot <= 35) {
         $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount));
     }
     $slot = $this->getConfig()->get("slot7");
     $item = $this->getConfig()->get("ID7");
     $damage = $this->getConfig()->get("Damage7");
     $ammount = $this->getConfig()->get("Ammount7");
     $level = $event->getLevel();
     $world = $this->getConfig()->get("world");
     if ($level == $world && $slot <= 35) {
         $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount));
     }
     $slot = $this->getConfig()->get("slot8");
     $item = $this->getConfig()->get("ID8");
     $damage = $this->getConfig()->get("Damage8");
     $ammount = $this->getConfig()->get("Ammount8");
     $level = $event->getLevel();
     $world = $this->getConfig()->get("world");
     if ($level == $world && $slot <= 35) {
         $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount));
     }
     $slot = $this->getConfig()->get("slot9");
     $item = $this->getConfig()->get("ID9");
     $damage = $this->getConfig()->get("Damage9");
     $ammount = $this->getConfig()->get("Ammount9");
     $level = $event->getLevel();
     $world = $this->getConfig()->get("world");
     if ($level == $world && $slot <= 35) {
         $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount));
     }
     $slot = $this->getConfig()->get("slot10");
     $item = $this->getConfig()->get("ID10");
     $damage = $this->getConfig()->get("Damage10");
     $ammount = $this->getConfig()->get("Ammount10");
     $level = $event->getLevel();
     $world = $this->getConfig()->get("world");
     if ($level == $world && $slot <= 35) {
         $player->getInventory()->setItem($slot, Item::get($item, $damage, $ammount));
     }
 }
Ejemplo n.º 10
0
 public function onTeleport(EntityLevelChangeEvent $event)
 {
     $to = $event->getTarget();
     $player = $event->getEntity();
     foreach ($this->getConfig()->get("Arenas") as $arena => $g) {
         if ($to instanceof Level and $player instanceof Player) {
             if ($to->getName() === $g["world"] and $g["status"] === "in-gioco") {
                 $event->setCancelled(true);
                 $player->sendMessage(TextFormat::RED . "Partita già iniziata! Scegli un'altra arena!");
             } elseif ($to->getName() === $g["name"] and count($this->getServer()->getLevelByName($g["name"])->getPlayers()) === 8 and $g["status"] === "pieno") {
                 $event->setCancelled(true);
                 $player->sendMessage(TextFormat::RED . "Arena piena! Scegli un'altra arena!");
             } elseif ($to->getName() === $g["name"] and count($this->getServer()->getLevelByName($g["name"])->getPlayers()) < 8 and $g["status"] === "in-attesa") {
                 foreach ($this->getServer()->getLevelByName($g["world"])->getPlayers() as $p) {
                     $name = $player->getName();
                     $p->sendMessage(TextFormat::DARK_GRAY . "{$name} è entrato/a in partita!");
                 }
             }
         }
     }
 }