本文整理汇总了PHP中pocketmine\event\inventory\InventoryPickupItemEvent::setCancelled方法的典型用法代码示例。如果您正苦于以下问题:PHP InventoryPickupItemEvent::setCancelled方法的具体用法?PHP InventoryPickupItemEvent::setCancelled怎么用?PHP InventoryPickupItemEvent::setCancelled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\inventory\InventoryPickupItemEvent
的用法示例。
在下文中一共展示了InventoryPickupItemEvent::setCancelled方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onPickUp
public function onPickUp(InventoryPickupItemEvent $event)
{
if ($event->getPlayer() instanceof Player && $this->plugin->status === "enabled" && $this->plugin->loginmanager[$event->getPlayer()->getId()] !== true && $this->plugin->allowPickup !== true) {
$event->setCancelled(true);
} elseif ($this->plugin->safemode === true and $this->plugin->status !== "enabled") {
$event->setCancelled(true);
$event->getPlayer()->sendMessage($this->disable);
}
}
示例2: onPickupItem
public function onPickupItem(InventoryPickupItemEvent $event)
{
$player = $event->getInventory()->getHolder();
if (!$this->isLogin($player)) {
$event->setCancelled();
return true;
}
}
示例3: onPickup
public function onPickup(InventoryPickupItemEvent $event)
{
$player = $event->getInventory()->getHolder();
if ($player instanceof Player) {
if ($event->getItem()->getItem()->getId() === self::GUN_ID) {
$this->players[$player->getName()][0]->addAmmo(30);
if ($player->getInventory()->contains(Item::get(self::GUN_ID))) {
$event->getItem()->kill();
$event->setCancelled();
}
} else {
$event->getItem()->kill();
}
}
}
示例4: onPickupItem
/**
* @param InventoryPickupItemEvent $event
*
* @priority LOWEST
*/
public function onPickupItem(InventoryPickupItemEvent $event)
{
$player = $event->getInventory()->getHolder();
if ($player instanceof Player and !$this->auth->isPlayerAuthenticated($player)) {
$event->setCancelled(true);
}
}
示例5: onPickupItem
public function onPickupItem(InventoryPickupItemEvent $event)
{
$holder = $event->getInventory()->getHolder();
if (!$holder instanceof Player) {
return;
}
$session = $this->main->getSession($holder);
if (!$session instanceof Session) {
$event->setCancelled();
return;
}
if ($session->onPickupItem($event) === false) {
$event->setCancelled();
}
}
示例6: h_onPickup
public function h_onPickup(InventoryPickupItemEvent $event)
{
if (!$this->isLoggedIn()) {
$event->setCancelled();
}
}
示例7: onPickupItem
/**
* @param InventoryPickupItemEvent $event
*
* @priority HIGH
* @ignoreCancelled true
*/
public function onPickupItem(InventoryPickupItemEvent $event)
{
$player = $event->getInventory()->getHolder();
if ($player instanceof Player and !$player->isOp()) {
foreach ($this->plugin->getAllZones() as $zone) {
if ($zone->isIn($event->getItem())) {
if ($player->hasPermission($zone->getName() . MEMBER)) {
break;
}
$event->setCancelled(true);
$player->sendMessage("[iZone] This is a private area.");
break;
}
}
}
}
示例8: onPickup
public function onPickup(InventoryPickupItemEvent $event)
{
$player = $event->getInventory()->getHolder();
if ($player instanceof Player) {
if ($this->inArena($player)) {
if (!in_array($event->getItem()->getId(), $this->pickup)) {
if ($event->getItem()->getItem()->getId() == Item::BRICK) {
$event->setCancelled();
$player->getLevel()->removeEntity($event->getItem());
$this->pickup[] = $event->getItem()->getId();
$player->setExpLevel($player->getExpLevel() + 1);
$player->sendTip(TextFormat::GOLD . "+" . TextFormat::GREEN . "1 Level!");
}
if ($event->getItem()->getItem()->getId() == Item::IRON_INGOT) {
$event->setCancelled();
$player->getLevel()->removeEntity($event->getItem());
$this->pickup[] = $event->getItem()->getId();
$player->setExpLevel($player->getExpLevel() + 10);
$player->sendTip(TextFormat::GOLD . "+" . TextFormat::GREEN . "10 Level!");
}
if ($event->getItem()->getItem()->getId() == Item::GOLD_INGOT) {
$event->setCancelled();
$player->getLevel()->removeEntity($event->getItem());
$this->pickup[] = $event->getItem()->getId();
$player->setExpLevel($player->getExpLevel() + 20);
$player->sendTip(TextFormat::GOLD . "+" . TextFormat::GREEN . "20 Level!");
}
}
}
}
}
示例9: onPick
public function onPick(InventoryPickupItemEvent $event)
{
$inv = $event->getInventory();
if (!$inv instanceof PlayerInventory) {
return;
}
$player = $inv->getHolder();
if (!$player instanceof Player) {
return;
}
$user = $this->main->getUserByPlayer($player);
if ($user === null or !$user->isPlaying()) {
$event->setCancelled();
}
}
示例10: onPickup
public function onPickup(InventoryPickupItemEvent $event)
{
$player = $event->getInventory()->getHolder();
if ($player instanceof Player) {
$item = $event->getItem()->getItem();
if (isset($this->loadedGuns[$item->getId() . ":" . $item->getDamage()])) {
$gun = $this->players[$player->getName()][0];
if ($gun->getGunItem() === $item->getId() . ":" . $item->getDamage()) {
$gun->addAmmo($gun->getMagazineAmmo());
$event->getItem()->kill();
}
$event->setCancelled();
} else {
$event->getItem()->kill();
}
}
}
示例11: onPickup
public function onPickup(InventoryPickupItemEvent $event)
{
$inv = $event->getInventory();
if (!$inv instanceof PlayerInventory) {
return;
}
$player = $inv->getHolder();
if (!$player instanceof Player) {
return;
}
$session = $this->getMain()->getSessions()->getSession($player);
if (!$session->inSession($this)) {
return;
}
$item = $event->getItem();
if ($item instanceof ItemBlock) {
if ($item->getBlock() === Block::SNOW_BLOCK) {
$event->setCancelled();
}
}
}