本文整理汇总了PHP中pocketmine\Player::isCreative方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::isCreative方法的具体用法?PHP Player::isCreative怎么用?PHP Player::isCreative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Player
的用法示例。
在下文中一共展示了Player::isCreative方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($player instanceof Player) {
$top = $this->getSide(1);
if ($top->isTransparent() !== true) {
return true;
}
$t = $this->getLevel()->getTile($this);
$chest = null;
if ($t instanceof TileChest) {
$chest = $t;
} else {
$nbt = new CompoundTag("", [new EnumTag("Items", []), new StringTag("id", Tile::CHEST), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$chest = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if (isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag) {
if ($chest->namedtag->Lock->getValue() !== $item->getCustomName()) {
return true;
}
}
if ($player->isCreative() and $player->getServer()->limitedCreative) {
return true;
}
$player->addWindow($chest->getInventory());
}
return true;
}
示例2: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($player instanceof Player) {
$t = $this->getLevel()->getTile($this);
if ($t instanceof FurnaceTile) {
$furnace = $t;
} else {
$nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::FURNACE), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$furnace = Tile::createTile("Furnace", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if (isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof StringTag) {
if ($furnace->namedtag->Lock->getValue() !== $item->getCustomName()) {
return true;
}
}
if ($player->isCreative() and $player->getServer()->limitedCreative) {
return true;
}
$player->addWindow($furnace->getInventory());
}
return true;
}
示例3: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($player instanceof Player) {
$t = $this->getLevel()->getTile($this);
$dispenser = null;
if ($t instanceof TileDispenser) {
$dispenser = $t;
} else {
$nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id", Tile::DISPENSER), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$dispenser = Tile::createTile(Tile::DISPENSER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if ($player->isCreative() and $player->getServer()->limitedCreative) {
return true;
}
$player->addWindow($dispenser->getInventory());
}
return true;
}
示例4: onActivate
public function onActivate(Item $item, Player $player = null)
{
if (!$this->getLevel()->getServer()->anviletEnabled) {
return true;
}
if ($player instanceof Player) {
//TODO lock
if ($player->isCreative() and $player->getServer()->limitedCreative) {
return true;
}
$tile = $this->getLevel()->getTile($this);
$enchantTable = null;
if ($tile instanceof EnchantTable) {
$enchantTable = $tile;
}
} else {
$this->getLevel()->setBlock($this, $this, true, true);
$nbt = new CompoundTag("", [new StringTag("id", Tile::ENCHANT_TABLE), new IntTag("x", $this->x), new IntTag("y", $this->y), new IntTag("z", $this->z)]);
if ($item->hasCustomName()) {
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if ($item->hasCustomBlockData()) {
foreach ($item->getCustomBlockData() as $key => $v) {
$nbt->{$key} = $v;
}
}
$enchantTable = Tile::createTile(Tile::ENCHANT_TABLE, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
$player->addWindow($enchantTable->getInventory());
return true;
}
示例5: clearInventory
/**
* Clear players inventory
* @param Player $target
*/
public static function clearInventory(Player $target)
{
if ($target->isCreative() || $target->isSpectator()) {
return;
}
$target->getInventory()->clearAll();
}
示例6: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($player instanceof Player) {
if ($player->getServer()->limitedCreative and $player->isCreative()) {
return true;
}
$player->craftingType = Player::CRAFTING_BIG;
}
return true;
}
示例7: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($player instanceof Player) {
if ($player->isCreative()) {
return true;
}
$player->addWindow(new AnvilInventory($this));
}
return true;
}
示例8: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($player instanceof Player) {
//TODO lock
if ($player->isCreative()) {
return true;
}
// $player->addWindow(new EnchantInventory($this));
}
return true;
}
示例9: execute
public function execute(Player $source) : bool
{
$droppedItem = $this->getTargetItem();
if (!$source->getServer()->getAllowInvCheats() and !$source->isCreative()) {
if (!$source->getFloatingInventory()->contains($droppedItem)) {
return false;
}
$source->getFloatingInventory()->removeItem($droppedItem);
}
$source->dropItem($droppedItem);
return true;
}
示例10: onActivate
public function onActivate(Item $item, Player $player = null)
{
if (!$this->getLevel()->getServer()->anviletEnabled) {
return true;
}
if ($player instanceof Player) {
if ($player->isCreative()) {
return true;
}
$player->addWindow(new AnvilInventory($this));
}
return true;
}
示例11: prime
public function prime(Player $player = null)
{
$this->meta = 1;
if ($player != null and $player->isCreative()) {
$dropItem = false;
} else {
$dropItem = true;
}
$mot = (new Random())->nextSignedFloat() * M_PI * 2;
$tnt = Entity::createEntity("PrimedTNT", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new CompoundTag("", ["Pos" => new ListTag("Pos", [new DoubleTag("", $this->x + 0.5), new DoubleTag("", $this->y), new DoubleTag("", $this->z + 0.5)]), "Motion" => new ListTag("Motion", [new DoubleTag("", -sin($mot) * 0.02), new DoubleTag("", 0.2), new DoubleTag("", -cos($mot) * 0.02)]), "Rotation" => new ListTag("Rotation", [new FloatTag("", 0), new FloatTag("", 0)]), "Fuse" => new ByteTag("Fuse", 80)]), $dropItem);
$tnt->spawnToAll();
$this->level->addSound(new TNTPrimeSound($this));
}
示例12: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($player instanceof Player) {
//TODO lock
if ($player->isCreative()) {
return true;
}
if (($t = $this->getLevel()->getTile($this)) instanceof TileBrewingStand) {
$player->addWindow(new BrewingInventory($t));
}
}
return true;
}
示例13: onActivate
public function onActivate(Item $item, Player $player = null)
{
if (!$this->getLevel()->getServer()->anvilEnabled) {
return true;
}
if ($player instanceof Player) {
if ($player->isCreative() and $player->getServer()->limitedCreative) {
return true;
}
$player->addWindow(new AnvilInventory($this));
$player->craftingType = Player::CRAFTING_ANVIL;
}
return true;
}
示例14: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($player instanceof Player) {
$t = $this->getLevel()->getTile($this);
$furnace = false;
if ($t instanceof Furnace) {
$furnace = $t;
} else {
$nbt = new Compound("", [new Enum("Items", []), new String("id", Tile::FURNACE), new Int("x", $this->x), new Int("y", $this->y), new Int("z", $this->z)]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$furnace = Tile::createTile("Furnace", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if ($player->isCreative()) {
return true;
}
$player->addWindow($furnace->getInventory());
}
return true;
}
示例15: onRename
public function onRename(Player $player, Item $resultItem) : bool
{
if (!$resultItem->deepEquals($this->getItem(self::TARGET), true, false, true)) {
//Item does not match target item. Everything must match except the tags.
return false;
}
if ($player->getExpLevel() < $resultItem->getRepairCost()) {
//Not enough exp
return false;
}
$player->setExpLevel($player->getExpLevel() - $resultItem->getRepairCost());
$this->clearAll();
if (!$player->getServer()->allowInventoryCheats and !$player->isCreative()) {
if (!$player->getFloatingInventory()->canAddItem($resultItem)) {
return false;
}
$player->getFloatingInventory()->addItem($resultItem);
}
return true;
}