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


PHP Player::isSurvival方法代码示例

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


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

示例1: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     $entity = null;
     $chunk = $level->getChunk($block->getX() >> 4, $block->getZ() >> 4);
     if (!$chunk instanceof FullChunk) {
         return false;
     }
     $nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $block->getX() + 0.5), new Double("", $block->getY()), new Double("", $block->getZ() + 0.5)]), "Motion" => new Enum("Motion", [new Double("", 0), new Double("", 0), new Double("", 0)]), "Rotation" => new Enum("Rotation", [new Float("", lcg_value() * 360), new Float("", 0)])]);
     $entity = Entity::createEntity($this->meta, $chunk, $nbt);
     if ($entity instanceof Entity) {
         if ($player->isSurvival()) {
             --$this->count;
         }
         $entity->spawnToAll();
         return true;
     }
     return false;
 }
开发者ID:mattiasaxelsson,项目名称:PocketMine-MP,代码行数:18,代码来源:SpawnEgg.php

示例2: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     $tile = $this->getLevel()->getTile($this);
     if ($this->meta == 0) {
         switch ($item->getId()) {
             case Item::BUCKET:
                 if ($item->getDamage() === 8) {
                     $this->meta = 6;
                     $this->getLevel()->setBlock($this, $this, true, false);
                     if ($player->isSurvival()) {
                         $item->setDamage(0);
                         $player->getInventory()->setItemInHand($item(), $player);
                     }
                 }
                 return true;
                 break;
         }
     }
     return false;
 }
开发者ID:NUMAKAGE,项目名称:NIGHTMARE,代码行数:20,代码来源:Cauldron.php

示例3: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     if ($this->meta < 0x7 && $item->getID() === Item::DYE && $item->getDamage() === 0xf) {
         //Bonemeal
         $block = clone $this;
         $block->meta += mt_rand(2, 5);
         if ($block->meta > 0x7) {
             $block->meta = 0x7;
         }
         Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
         if (!$ev->isCancelled()) {
             $this->getLevel()->setBlock($this, $ev->getNewState(), true, true);
             if ($player->isSurvival()) {
                 $item->count--;
             }
             return true;
         }
     }
     return false;
 }
开发者ID:organization,项目名称:CropPlus,代码行数:20,代码来源:Crops.php

示例4: checkInVIP

 private function checkInVIP(Player $player)
 {
     //if ($player->getLevel ()->getName () === $this->plugin->vipLevelName) {
     if (isset($this->vips[$player->getName()])) {
         $this->plugin->log("[HG] VIPPlayerListener->VIPCheck-IN: " . $player->getName());
         return true;
     } else {
         $vip = $this->plugin->profileManager->isPlayerVIP($player->getName());
         if (!$vip) {
             return false;
         }
         if (!$player->isOp()) {
             if (!$player->isSurvival()) {
                 $player->setGamemode(Player::SURVIVAL);
             }
         }
         $this->vips[$player->getName()] = $player->getName();
         $this->plugin->log("[HG] VIPPlayerListener->VIPCheck-IN: " . $player->getName());
         return true;
     }
     //}
     return false;
 }
开发者ID:robozeri,项目名称:SG,代码行数:23,代码来源:VIPPlayerListener.php

示例5: targetOption

 public function targetOption(Player $player, $distance)
 {
     return $player->spawned && $player->isAlive() && !$player->closed && $player->isSurvival() && $distance <= 81;
 }
开发者ID:rilex04,项目名称:EntityManager,代码行数:4,代码来源:Monster.php

示例6: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     if ($target->isTransparent() === false and $face > 1 and $block->isSolid() === false) {
         $faces = [2 => 0, 3 => 2, 4 => 1, 5 => 3];
         $motives = [["Kebab", 1, 1], ["Aztec", 1, 1], ["Alban", 1, 1], ["Aztec2", 1, 1], ["Bomb", 1, 1], ["Plant", 1, 1], ["Wasteland", 1, 1], ["Wanderer", 1, 2], ["Graham", 1, 2], ["Pool", 2, 1], ["Courbet", 2, 1], ["Sunset", 2, 1], ["Sea", 2, 1], ["Creebet", 2, 1], ["Match", 2, 2], ["Bust", 2, 2], ["Stage", 2, 2], ["Void", 2, 2], ["SkullAndRoses", 2, 2], ["Fighters", 4, 2], ["Skeleton", 4, 3], ["DonkeyKong", 4, 3], ["Pointer", 4, 4], ["Pigscene", 4, 4], ["Flaming Skull", 4, 4]];
         $motive = $motives[mt_rand(0, count($motives) - 1)];
         $data = ["x" => $target->x, "y" => $target->y + 0.4, "z" => $target->z, "yaw" => $faces[$face] * 90, "Motive" => $motive[0]];
         $nbt = new CompoundTag("", ["Motive" => new StringTag("Motive", $data["Motive"]), "Pos" => new EnumTag("Pos", [new DoubleTag("", $data["x"]), new DoubleTag("", $data["y"]), new DoubleTag("", $data["z"])]), "Motion" => new EnumTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), "Rotation" => new EnumTag("Rotation", [new FloatTag("", $data["yaw"]), new FloatTag("", 0)])]);
         $painting = new PaintingEntity($player->getLevel()->getChunk($block->getX() >> 4, $block->getZ() >> 4), $nbt);
         $painting->spawnToAll();
         if ($player->isSurvival()) {
             $item = $player->getInventory()->getItemInHand();
             $count = $item->getCount();
             if (--$count <= 0) {
                 $player->getInventory()->setItemInHand(Item::get(Item::AIR));
                 return;
             }
             $item->setCount($count);
             $player->getInventory()->setItemInHand($item);
         }
         //TODO
         //$e = $server->api->entity->add($level, ENTITY_OBJECT, OBJECT_PAINTING, $data);
         //$e->spawnToAll();
         /*if(($player->gamemode & 0x01) === 0x00){
         			$player->removeItem(Item::get($this->getId(), $this->getDamage(), 1));
         		}*/
         return true;
     }
     return false;
 }
开发者ID:MrDoni98,项目名称:Genisys,代码行数:30,代码来源:Painting.php

示例7: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     $tile = $this->getLevel()->getTile($this);
     if (!$tile instanceof ItemFrameTile) {
         $nbt = new CompoundTag("", [new StringTag("id", Tile::ITEM_FRAME), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z), new ByteTag("ItemRotation", 0), new FloatTag("ItemDropChance", 1.0)]);
         Tile::createTile(Tile::ITEM_FRAME, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
     }
     $tile = $this->getLevel()->getTile($this);
     if (!$tile instanceof ItemFrameTile) {
         return false;
     }
     if ($tile->getItem()->getId() === 0) {
         $tile->setItem(Item::get($item->getId(), $item->getDamage(), 1));
         if ($player instanceof Player) {
             if ($player->isSurvival()) {
                 $count = $item->getCount();
                 if (--$count <= 0) {
                     $player->getInventory()->setItemInHand(Item::get(Item::AIR));
                     return true;
                 }
                 $item->setCount($count);
                 $player->getInventory()->setItemInHand($item);
             }
         }
     } else {
         $itemRot = $tile->getItemRotation();
         if ($itemRot === 7) {
             $itemRot = 0;
         } else {
             $itemRot++;
         }
         $tile->setItemRotation($itemRot);
     }
     return true;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:35,代码来源:ItemFrame.php

示例8: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     if ($target->getId() == Block::MONSTER_SPAWNER) {
         return true;
     } else {
         $entity = null;
         $chunk = $level->getChunk($block->getX() >> 4, $block->getZ() >> 4);
         if (!$chunk instanceof FullChunk) {
             return false;
         }
         $nbt = new CompoundTag("", ["Pos" => new EnumTag("Pos", [new DoubleTag("", $block->getX() + 0.5), new DoubleTag("", $block->getY()), new DoubleTag("", $block->getZ() + 0.5)]), "Motion" => new EnumTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), "Rotation" => new EnumTag("Rotation", [new FloatTag("", lcg_value() * 360), new FloatTag("", 0)])]);
         if ($this->hasCustomName()) {
             $nbt->CustomName = new StringTag("CustomName", $this->getCustomName());
         }
         $entity = Entity::createEntity($this->meta, $chunk, $nbt);
         if ($entity instanceof Entity) {
             if ($player->isSurvival()) {
                 --$this->count;
             }
             $entity->spawnToAll();
             return true;
         }
     }
     return false;
 }
开发者ID:PepbookPvP,项目名称:Genisys,代码行数:25,代码来源:SpawnEgg.php

示例9: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     if ($item->getId() === Item::DYE and $item->getDamage() === Dye::BONEMEAL) {
         $grow = false;
         if ($this->getSide(0)->getId() !== self::SUGARCANE_BLOCK && $this->getSide(0, 2)->getId() !== self::SUGARCANE_BLOCK) {
             for ($y = 1; $y < 2; $y++) {
                 $b = $this->getSide(1, $y);
                 if ($b->getId() === self::AIR) {
                     Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Sugarcane()));
                     if (!$ev->isCancelled()) {
                         $this->getLevel()->setBlock($b, $ev->getNewState(), true);
                         $grow = true;
                     }
                     break;
                 } else {
                     break;
                 }
             }
             $this->meta = 0;
             $this->getLevel()->setBlock($this, $this, true);
         }
         if ($grow && $player->isSurvival()) {
             $item->count--;
         }
         return true;
     }
     return false;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:28,代码来源:Sugarcane.php

示例10: onActivate

 public function onActivate(Item $item, Player $player = null)
 {
     $tile = $this->getLevel()->getTile($this);
     if ($tile instanceof FlowerPotTile) {
         if ($tile->getFlowerPotItem() === Item::AIR) {
             switch ($item->getId()) {
                 case Item::TALL_GRASS:
                     if ($item->getDamage() === 1) {
                         break;
                     }
                 case Item::SAPLING:
                 case Item::DEAD_BUSH:
                 case Item::DANDELION:
                 case Item::RED_FLOWER:
                 case Item::BROWN_MUSHROOM:
                 case Item::RED_MUSHROOM:
                 case Item::CACTUS:
                     $tile->setFlowerPotData($item->getId(), $item->getDamage());
                     $this->setDamage($item->getId());
                     $this->getLevel()->setBlock($this, $this, true, false);
                     if ($player->isSurvival()) {
                         $item->count--;
                     }
                     return true;
                     break;
             }
         }
     }
     return false;
 }
开发者ID:abc12309874,项目名称:Genisys,代码行数:30,代码来源:FlowerPot.php

示例11: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     if ($player === null or $player->isSurvival() !== true) {
         return false;
     }
     if ($target->getId() === Block::STILL_WATER or $target->getId() === Block::WATER) {
         $player->getServer()->getPluginManager()->callEvent($ev = new PlayerGlassBottleEvent($player, $target, $this));
         if ($ev->isCancelled()) {
             return false;
         } else {
             if ($this->count <= 1) {
                 $player->getInventory()->setItemInHand(Item::get(Item::POTION, 0, 1));
                 return true;
             } else {
                 $this->count--;
                 $player->getInventory()->setItemInHand($this);
             }
             if ($player->getInventory()->canAddItem(Item::get(Item::POTION, 0, 1)) === true) {
                 $player->getInventory()->AddItem(Item::get(Item::POTION, 0, 1));
             } else {
                 $motion = $player->getDirectionVector()->multiply(0.4);
                 $position = clone $player->getPosition();
                 $player->getLevel()->dropItem($position->add(0, 0.5, 0), Item::get(Item::POTION, 0, 1), $motion, 40);
             }
             return true;
         }
     }
     return false;
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:29,代码来源:GlassBottle.php

示例12: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     $realPos = $target->getSide($face)->add(0.5, 0.4, 0.5);
     $camera = new TripoidCamera($player->getLevel()->getChunk($realPos->getX() >> 4, $realPos->getZ() >> 4), new CompoundTag("", ["Pos" => new ListTag("Pos", [new DoubleTag("", $realPos->getX()), new DoubleTag("", $realPos->getY()), new DoubleTag("", $realPos->getZ())]), "Motion" => new ListTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), "Rotation" => new ListTag("Rotation", [new FloatTag("", 0), new FloatTag("", 0)])]));
     $camera->spawnToAll();
     if ($player->isSurvival()) {
         --$this->count;
     }
     return true;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:10,代码来源:Camera.php

示例13: __construct

 public function __construct(Player $player, Block $block, Item $item, $instaBreak = \false)
 {
     $this->block = $block;
     $this->item = $item;
     $this->player = $player;
     $this->instaBreak = (bool) $instaBreak;
     $drops = $player->isSurvival() ? $block->getDrops($item) : [];
     foreach ($drops as $i) {
         $this->blockDrops[] = Item::get($i[0], $i[1], $i[2]);
     }
 }
开发者ID:kazuemon,项目名称:NIGHTMARE,代码行数:11,代码来源:BlockBreakEvent.php

示例14: onActivate

 public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz)
 {
     if (!in_array($target->getId(), array(Block::RAIL, Block::ACTIVATOR_RAIL, Block::DETECTOR_RAIL, Block::POWERED_RAIL))) {
         return false;
     }
     $realPos = $target->add(0.5, 0, 0.5);
     $cart = new MinecartHopperEntity($player->getLevel()->getChunk($realPos->getX() >> 4, $realPos->getZ() >> 4), new CompoundTag("", ["Pos" => new ListTag("Pos", [new DoubleTag("", $realPos->getX()), new DoubleTag("", $realPos->getY()), new DoubleTag("", $realPos->getZ())]), "Motion" => new ListTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), "Rotation" => new ListTag("Rotation", [new FloatTag("", 0), new FloatTag("", 0)])]));
     $cart->spawnToAll();
     if ($player->isSurvival()) {
         --$this->count;
     }
     return true;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:13,代码来源:MinecartHopper.php

示例15: __construct

 public function __construct(Player $player, Block $block, Item $item, int $xpAmount = 0, bool $instaBreak = false, bool $speed = false)
 {
     $this->block = $block;
     $this->item = $item;
     $this->player = $player;
     $this->instaBreak = (bool) $instaBreak;
     $this->xpAmount = (int) $xpAmount;
     $this->blocked = (bool) $speed;
     $drops = $player->isSurvival() ? $block->getDrops($item) : [];
     foreach ($drops as $i) {
         $this->blockDrops[] = Item::get($i[0], $i[1], $i[2]);
     }
 }
开发者ID:Cecil107,项目名称:PocketMine-0.13.0,代码行数:13,代码来源:BlockBreakEvent.php


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