本文整理汇总了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;
}
}
示例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");
}
}
}
}
示例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);
}
}
示例4: h_onDeath
public function h_onDeath(PlayerDeathEvent $event)
{
$event->setDrops([]);
$event->setDeathMessage("");
$event->setKeepInventory(false);
}
示例5: onDeath
public function onDeath(PlayerDeathEvent $event)
{
$event->setKeepInventory($this->keepInventory);
$event->setKeepExperience($this->keepExperience);
}
示例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);
}
}
}
示例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);
}
示例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;
}
}
示例9: onPlayerDeath
public function onPlayerDeath(PlayerDeathEvent $event)
{
$player = $event->getEntity();
$username = $player->getName();
$event->setKeepInventory(true);
$this->kickFromPvP($player);
}
示例10: onPlayerDeath
public function onPlayerDeath(PlayerDeathEvent $event)
{
if ($this->pvp["Inv"]) {
$event->setKeepInventory(true);
}
}
示例11: onPlayerDeath
public function onPlayerDeath(PlayerDeathEvent $event)
{
$event->setKeepInventory();
}
示例12: onPlayerDeath
public function onPlayerDeath(PlayerDeathEvent $event)
{
if (in_array(strtolower($event->getEntity()->getLevel()->getFolderName()), $this->wm["Inv"])) {
$event->setKeepInventory(true);
}
}
示例13: onPlayerDeath
public function onPlayerDeath(PlayerDeathEvent $event)
{
if ($this->players[$event->getEntity()->getName()] !== "NONE") {
$event->setKeepInventory(true);
}
}
示例14: onPlayerDeathEvent
public function onPlayerDeathEvent(PlayerDeathEvent $event)
{
$event->setKeepInventory(true);
$this->debug->onDebug('Keep Inventory from player');
}