/** * @priority LOWEST */ public function onCrafting(CraftItemEvent $event) { echo __METHOD__ . "," . __LINE__ . "\n"; //##DEBUG foreach ($event->getTransaction()->getInventories() as $inv) { echo __METHOD__ . "," . __LINE__ . "\n"; //##DEBUG if ($inv instanceof PlayerInventory) { continue; } echo __METHOD__ . "," . __LINE__ . "\n"; //##DEBUG $player = $inv->getHolder(); if (!$this->auth->isPlayerAuthenticated($inv->getHolder())) { echo __METHOD__ . "," . __LINE__ . "\n"; //##DEBUG $event->setCancelled(true); return; } } }
public function onCraftItem(CraftItemEvent $event) { $t = $event->getTransaction(); if (!($p = $t->getSource()) instanceof Player) { return; } $r = $t->getResult(); if (!$p->hasPermission("mineblock.bancraft.craft") && in_array($id = $r->getID() . ":" . $r->getDamage(), $this->bc)) { $p->sendMessage("[BanCraft] {$id}" . ($this->isKorean() ? "는 조합금지 아이템입니다. 조합할수없습니다." : " is Ban. You can't craft.")); $p->getInventory()->sendContents($p); $event->setCancelled(); } }