本文整理汇总了PHP中item::get方法的典型用法代码示例。如果您正苦于以下问题:PHP item::get方法的具体用法?PHP item::get怎么用?PHP item::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item
的用法示例。
在下文中一共展示了item::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: crateKeys
public function crateKeys(PlayerInteractEvent $event)
{
$player = $event->getPlayer();
$block = $event->getBlock();
if ($block->getId() == $this->getConfig()->get("Crate") && !$event->isCancelled()) {
if ($player->getInventory()->getItemInHand()->getId() == $this->getConfig()->get("CrateKey-Item")) {
$prizes = array(Item::get(rand($this->getConfig()->get("ID-1"), $this->getConfig()->get("ID-2")), 0, $this->getConfig()->get("number-of-items")));
foreach ($prizes as $prize) {
$player->getInventory()->addItem($prize);
}
$player->sendMessage($this->getConfig()->get("completed"));
$player->getInventory()->removeItem(item::get($this->getConfig()->get("CrateKey-Item"), 0, 1));
$event->setCancelled(true);
} else {
$player->sendMessage($this->getConfig()->get("failed"));
$event->setCancelled(true);
}
} elseif (!$event->isCancelled()) {
$event->setCancelled(false);
}
}
示例2: get
function get($var)
{
if (in_array($var, $this->gettable_members)) {
return $this->{$var};
} else {
return parent::get($var);
}
}