当前位置: 首页>>代码示例>>PHP>>正文


PHP PlayerDeathEvent::setKeepInventory方法代码示例

本文整理汇总了PHP中pocketmine\event\player\PlayerDeathEvent::setKeepInventory方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerDeathEvent::setKeepInventory方法的具体用法?PHP PlayerDeathEvent::setKeepInventory怎么用?PHP PlayerDeathEvent::setKeepInventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\event\player\PlayerDeathEvent的用法示例。


在下文中一共展示了PlayerDeathEvent::setKeepInventory方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onPlayerDeath

 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;
     }
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:28,代码来源:CustomDeath.php

示例2: onPlayerDeathEvent

 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");
             }
         }
     }
 }
开发者ID:Blubberboy333,项目名称:EasyKeep,代码行数:16,代码来源:Main.php

示例3: onPlayerDeath

 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     $deadPlayer = $event->getEntity();
     $arena = $this->arenaManager->getPlayerArena($deadPlayer);
     if ($arena != NULL) {
         $event->setDrops([]);
         $event->setKeepInventory(false);
         $arena->onPlayerDeath($deadPlayer);
     }
 }
开发者ID:imjayl,项目名称:pocketmine-1vs1-plugin,代码行数:10,代码来源:EventsManager.php

示例4: h_onDeath

 public function h_onDeath(PlayerDeathEvent $event)
 {
     $event->setDrops([]);
     $event->setDeathMessage("");
     $event->setKeepInventory(false);
 }
开发者ID:LegionPE,项目名称:LegionPE-Eta,代码行数:6,代码来源:SessionInterface.php

示例5: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     $event->setKeepInventory($this->keepInventory);
     $event->setKeepExperience($this->keepExperience);
 }
开发者ID:ClearSkyTeam,项目名称:Plugins,代码行数:5,代码来源:MainClass.php

示例6: onDeath

 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);
         }
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:18,代码来源:SimpleArea.php

示例7: kill


//.........这里部分代码省略.........
                     $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);
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:101,代码来源:Player.php

示例8: onDeath

 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;
     }
 }
开发者ID:kam187,项目名称:pocketmine-plugins,代码行数:35,代码来源:Main.php

示例9: onPlayerDeath

 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     $player = $event->getEntity();
     $username = $player->getName();
     $event->setKeepInventory(true);
     $this->kickFromPvP($player);
 }
开发者ID:EXkurumi,项目名称:My-PVP-Plugin,代码行数:7,代码来源:PluginMain.php

示例10: onPlayerDeath

 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     if ($this->pvp["Inv"]) {
         $event->setKeepInventory(true);
     }
 }
开发者ID:stoastye85,项目名称:Plugins,代码行数:6,代码来源:PVPManager.php

示例11: onPlayerDeath

 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     $event->setKeepInventory();
 }
开发者ID:stoastye85,项目名称:Plugins,代码行数:4,代码来源:InventorySave.php

示例12: onPlayerDeath

 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     if (in_array(strtolower($event->getEntity()->getLevel()->getFolderName()), $this->wm["Inv"])) {
         $event->setKeepInventory(true);
     }
 }
开发者ID:Skull3x,项目名称:MineBlock,代码行数:6,代码来源:WorldManager.php

示例13: onPlayerDeath

 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     if ($this->players[$event->getEntity()->getName()] !== "NONE") {
         $event->setKeepInventory(true);
     }
 }
开发者ID:EpicArtz08999,项目名称:ZombieGame,代码行数:6,代码来源:GameGenius.php

示例14: onPlayerDeathEvent

 public function onPlayerDeathEvent(PlayerDeathEvent $event)
 {
     $event->setKeepInventory(true);
     $this->debug->onDebug('Keep Inventory from player');
 }
开发者ID:100henrik100,项目名称:Minecraft-Pocket-Edition,代码行数:5,代码来源:antipvp.php


注:本文中的pocketmine\event\player\PlayerDeathEvent::setKeepInventory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。