setKeepInventory() 공개 메소드

public setKeepInventory ( boolean $keepInventory )
$keepInventory boolean
예제 #1
0
 public function onPlayerDeath(PlayerDeathEvent $e)
 {
     $pl = $e->getEntity();
     if (!$pl instanceof Player) {
         return;
     }
     if (!$pl->hasPermission("gb.cdeath")) {
         return;
     }
     $keepinv = $this->keepinv;
     if ($keepinv == "perms") {
         foreach (["keep", "nodrops", "default"] as $m) {
             if ($pl->hasPermission("gb.keepinv." . $m)) {
                 break;
             }
         }
     }
     switch ($keepinv) {
         case "keep":
             $e->setKeepInventory(true);
             $e->setDrops([]);
             break;
         case "nodrops":
             $e->setKeepInventory(false);
             $e->setDrops([]);
             break;
     }
 }
예제 #2
0
 public function onPlayerDeathEvent(PlayerDeathEvent $event)
 {
     if ($event->getEntity() instanceof Player) {
         $player = $event->getEntity();
         $name = $event->getEntity()->getName();
         if ($this->allEnabled == "true") {
             $event->setKeepInventory(true);
             $player->sendMessage(TextFormat::YELLOW . "Your inventory has been saved");
         } else {
             if (in_array($name, $this->playersEnabled)) {
                 $event->setKeepInventory(true);
                 $player->sendMessage(TextFormat::YELLOW . "Your inventory has been saved");
             }
         }
     }
 }
 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     $deadPlayer = $event->getEntity();
     $arena = $this->arenaManager->getPlayerArena($deadPlayer);
     if ($arena != NULL) {
         $event->setDrops([]);
         $event->setKeepInventory(false);
         $arena->onPlayerDeath($deadPlayer);
     }
 }
예제 #4
0
 public function h_onDeath(PlayerDeathEvent $event)
 {
     $event->setDrops([]);
     $event->setDeathMessage("");
     $event->setKeepInventory(false);
 }
예제 #5
0
 public function onDeath(PlayerDeathEvent $event)
 {
     $event->setKeepInventory($this->keepInventory);
     $event->setKeepExperience($this->keepExperience);
 }
예제 #6
0
 public function onDeath(PlayerDeathEvent $event)
 {
     $player = $event->getEntity();
     $area = $this->db[$player->getLevel()->getFolderName()]->getArea($player->x, $player->z);
     if ($area == null) {
         if ($this->db[$player->getLevel()->getFolderName()]->isWhiteWorld()) {
             if ($this->db[$player->getLevel()->getFolderName()]->option["white-invensave"]) {
                 $event->setKeepInventory(true);
             }
             return;
         }
         return;
     } else {
         if ($this->db[$player->getLevel()->getFolderName()]->isInvenSave($area["ID"])) {
             $event->setKeepInventory(true);
         }
     }
 }
예제 #7
0
파일: Player.php 프로젝트: iTXTech/Genisys
 public function kill()
 {
     if (!$this->spawned) {
         return;
     }
     $message = "death.attack.generic";
     $params = [$this->getDisplayName()];
     $cause = $this->getLastDamageCause();
     switch ($cause === null ? EntityDamageEvent::CAUSE_CUSTOM : $cause->getCause()) {
         case EntityDamageEvent::CAUSE_ENTITY_ATTACK:
             if ($cause instanceof EntityDamageByEntityEvent) {
                 $e = $cause->getDamager();
                 if ($e instanceof Player) {
                     $message = "death.attack.player";
                     $params[] = $e->getDisplayName();
                     break;
                 } elseif ($e instanceof Living) {
                     $message = "death.attack.mob";
                     $params[] = $e->getNameTag() !== "" ? $e->getNameTag() : $e->getName();
                     break;
                 } else {
                     $params[] = "Unknown";
                 }
             }
             break;
         case EntityDamageEvent::CAUSE_PROJECTILE:
             if ($cause instanceof EntityDamageByEntityEvent) {
                 $e = $cause->getDamager();
                 if ($e instanceof Player) {
                     $message = "death.attack.arrow";
                     $params[] = $e->getDisplayName();
                 } elseif ($e instanceof Living) {
                     $message = "death.attack.arrow";
                     $params[] = $e->getNameTag() !== "" ? $e->getNameTag() : $e->getName();
                     break;
                 } else {
                     $params[] = "Unknown";
                 }
             }
             break;
         case EntityDamageEvent::CAUSE_SUICIDE:
             $message = "death.attack.generic";
             break;
         case EntityDamageEvent::CAUSE_VOID:
             $message = "death.attack.outOfWorld";
             break;
         case EntityDamageEvent::CAUSE_FALL:
             if ($cause instanceof EntityDamageEvent) {
                 if ($cause->getFinalDamage() > 2) {
                     $message = "death.fell.accident.generic";
                     break;
                 }
             }
             $message = "death.attack.fall";
             break;
         case EntityDamageEvent::CAUSE_SUFFOCATION:
             $message = "death.attack.inWall";
             break;
         case EntityDamageEvent::CAUSE_LAVA:
             $message = "death.attack.lava";
             break;
         case EntityDamageEvent::CAUSE_FIRE:
             $message = "death.attack.onFire";
             break;
         case EntityDamageEvent::CAUSE_FIRE_TICK:
             $message = "death.attack.inFire";
             break;
         case EntityDamageEvent::CAUSE_DROWNING:
             $message = "death.attack.drown";
             break;
         case EntityDamageEvent::CAUSE_CONTACT:
             if ($cause instanceof EntityDamageByBlockEvent) {
                 if ($cause->getDamager()->getId() === Block::CACTUS) {
                     $message = "death.attack.cactus";
                 }
             }
             break;
         case EntityDamageEvent::CAUSE_BLOCK_EXPLOSION:
         case EntityDamageEvent::CAUSE_ENTITY_EXPLOSION:
             if ($cause instanceof EntityDamageByEntityEvent) {
                 $e = $cause->getDamager();
                 if ($e instanceof Player) {
                     $message = "death.attack.explosion.player";
                     $params[] = $e->getDisplayName();
                 } elseif ($e instanceof Living) {
                     $message = "death.attack.explosion.player";
                     $params[] = $e->getNameTag() !== "" ? $e->getNameTag() : $e->getName();
                     break;
                 }
             } else {
                 $message = "death.attack.explosion";
             }
             break;
         case EntityDamageEvent::CAUSE_MAGIC:
             $message = "death.attack.magic";
             break;
         case EntityDamageEvent::CAUSE_CUSTOM:
             break;
         default:
     }
     Entity::kill();
     $ev = new PlayerDeathEvent($this, $this->getDrops(), new TranslationContainer($message, $params));
     $ev->setKeepInventory($this->server->keepInventory);
     $ev->setKeepExperience($this->server->keepExperience);
     $this->server->getPluginManager()->callEvent($ev);
     if (!$ev->getKeepInventory()) {
         foreach ($ev->getDrops() as $item) {
             $this->level->dropItem($this, $item);
         }
         if ($this->inventory !== null) {
             $this->inventory->clearAll();
         }
     }
     if ($this->server->expEnabled and !$ev->getKeepExperience()) {
         $exp = min(91, $this->getTotalXp());
         //Max 7 levels of exp dropped
         $this->getLevel()->spawnXPOrb($this->add(0, 0.2, 0), $exp);
         $this->setTotalXp(0, true);
     }
     if ($ev->getDeathMessage() != "") {
         $this->server->broadcast($ev->getDeathMessage(), Server::BROADCAST_CHANNEL_USERS);
     }
     $pos = $this->getSpawn();
     $this->setHealth(0);
     $pk = new RespawnPacket();
     $pk->x = $pos->x;
     $pk->y = $pos->y;
     $pk->z = $pos->z;
     $this->dataPacket($pk);
 }
예제 #8
0
 public function onDeath(PlayerDeathEvent $e)
 {
     $p = $e->getEntity();
     if (!$p instanceof Player) {
         return;
     }
     if ($this->deathpos !== null) {
         $n = strtolower($p->getName());
         $this->deathpos[$n] = new Position($p->getX(), $p->getY(), $p->getZ(), $p->getLevel());
     }
     switch ($this->deathinv) {
         case "keep":
             if (!$p->hasPermission("spawnmgr.keepinv")) {
                 return;
             }
             $e->setKeepInventory(true);
             $e->setDrops([]);
             break;
         case "clear":
             if (!$p->hasPermission("spawnmgr.nodrops")) {
                 return;
             }
             $e->setKeepInventory(false);
             $e->setDrops([]);
             break;
         case "perms":
             if ($p->hasPermission("spawnmgr.keepinv")) {
                 $e->setKeepInventory(true);
             }
             if ($p->hasPermission("spawnmgr.nodrops")) {
                 $e->setDrops([]);
             }
             break;
     }
 }
예제 #9
0
 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     $player = $event->getEntity();
     $username = $player->getName();
     $event->setKeepInventory(true);
     $this->kickFromPvP($player);
 }
예제 #10
0
 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     if ($this->pvp["Inv"]) {
         $event->setKeepInventory(true);
     }
 }
예제 #11
0
 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     $event->setKeepInventory();
 }
예제 #12
0
 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     if (in_array(strtolower($event->getEntity()->getLevel()->getFolderName()), $this->wm["Inv"])) {
         $event->setKeepInventory(true);
     }
 }
예제 #13
0
 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     if ($this->players[$event->getEntity()->getName()] !== "NONE") {
         $event->setKeepInventory(true);
     }
 }
 public function onPlayerDeathEvent(PlayerDeathEvent $event)
 {
     $event->setKeepInventory(true);
     $this->debug->onDebug('Keep Inventory from player');
 }