本文整理匯總了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);
}
}