本文整理汇总了PHP中pocketmine\event\block\BlockBreakEvent类的典型用法代码示例。如果您正苦于以下问题:PHP BlockBreakEvent类的具体用法?PHP BlockBreakEvent怎么用?PHP BlockBreakEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BlockBreakEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBreak
public function onBreak(BlockBreakEvent $event)
{
if ($event->getBlock()->getId() != Block::CHEST) {
return;
}
$block = $event->getBlock();
if (!isset($this->configData["{$block->x}:{$block->y}:{$block->z}"])) {
return;
}
if ($this->configData["{$block->x}:{$block->y}:{$block->z}"] == $event->getPlayer()->getName()) {
unset($this->configData["{$block->x}:{$block->y}:{$block->z}"]);
$event->getPlayer()->sendMessage(TextFormat::DARK_AQUA . "상자 보호가 해제되었습니다 !");
$event->setCancelled();
} else {
if ($event->getPlayer()->isOp()) {
return;
}
if ($this->simpleArea != null) {
$area = $this->simpleArea->db[$block->getLevel()->getFolderName()]->getArea($block->x, $block->z);
if ($area != null) {
if (isset($area["resident"][0]) and $area["resident"][0] == $event->getPlayer()->getName()) {
return;
}
}
}
$event->getPlayer()->sendMessage(TextFormat::RED . "이 상자는 " . $this->configData["{$block->x}:{$block->y}:{$block->z}"] . " 님의 소유입니다, 파괴 불가 !");
$event->setCancelled();
}
}
示例2: onBlockBreak
public function onBlockBreak(BlockBreakEvent $ev)
{
if ($ev->isCancelled()) {
return;
}
$pl = $ev->getPlayer();
if (!$this->getState($pl, false)) {
return;
}
if (!$pl->isCreative() || !$this->creative) {
if ($this->items && !isset($this->items[$ev->getItem()->getId()])) {
echo "Not using an Axe\n";
//##DEBUG
return;
}
}
if ($this->leaves) {
$damage = $this->destroyTree($ev->getBlock());
} else {
$damage = $this->destroyTrunk($ev->getBlock());
}
if ($damage && $this->items && $this->itemwear) {
$hand = $pl->getInventory()->getItemInHand();
$hand->setDamage($hand->getDamage() + $this->itemwear * $damage);
$pl->getInventory()->setItemInHand($hand);
if ($this->broadcast) {
$this->owner->getServer()->broadcastMessage(mc::_("%1% used TreeCapitator", $pl->getName()));
} else {
$pl->sendMessage(mc::_("Used TreeCapitator"));
}
}
}
示例3: onBreak
public function onBreak(BlockBreakEvent $event)
{
$player = $event->getPlayer();
if ($player->isCreative()) {
return;
}
$time = round(microtime(true) * 1000);
if ($event->getBlock()->getBreakTime($event->getItem()) <= 0.2) {
return;
}
if ($time - $this->tictock[$player->getName()] <= 200) {
if (!isset($this->kick[$player->getName()])) {
$this->kick[$player->getName()] = 1;
} else {
$this->kick[$player->getName()]++;
}
if ($this->kick > 2) {
$player->kick("파괴자모드 감지");
if (isset($this->kick[$player->getName()])) {
unset($this->kick[$player->getName()]);
}
}
$event->setCancelled();
} else {
if (isset($this->kick[$player->getName()])) {
unset($this->kick[$player->getName()]);
}
}
$this->tictock[$player->getName()] = $time;
}
示例4: onBlockBreak
/**
* @param BlockBreakEvent $event
* @priority HIGHEST
* @ignoreCancelled true
*/
public function onBlockBreak(BlockBreakEvent $event)
{
if (!$this->plugin->getStorage()->getShield($event->getPlayer()->getLevel())->isAllowed(Shield::BREAKING)) {
$event->setCancelled(true);
$event->getPlayer()->sendTip($this->plugin->getConfig()->get("breakNotAllowed"));
}
}
示例5: onBreak
public function onBreak(BlockBreakEvent $event)
{
if ($event->getBlock() instanceof Bed) {
foreach ($this->getConfig()->get("Arenas") as $arena => $g) {
$bx = $event->getBlock()->getX();
$by = $event->getBlock()->getY();
$bz = $event->getBlock()->getZ();
$blockpos = new Position($bx, $by, $bz);
$bl = $event->getBlock()->getLevel()->getName();
$bpos = $g["bluebed"];
$rpos = $g["redbed"];
$gpos = $g["greenbed"];
$ypos = $g["yellowbed"];
if ($blockpos === $bpos and $bl === $g["world"]) {
foreach ($this->getServer()->getLevelByName($g["world"])->getPlayers() as $p) {
$p->sendMessage(TextFormat::DARK_GRAY . "E' stato rotto il letto" . TextFormat::BLUE . "Blu" . TextFormat::DARK_GRAY . "! I giocatori blu sono stati eliminati!");
}
} elseif ($blockpos === $rpos and $bl === $g["world"]) {
foreach ($this->getServer()->getLevelByName($g["world"])->getPlayers() as $p) {
$p->sendMessage(TextFormat::DARK_GRAY . "E' stato rotto il letto" . TextFormat::RED . "Rosso" . TextFormat::DARK_GRAY . "! I giocatori rossi sono stati eliminati!");
}
} elseif ($blockpos === $gpos and $bl === $g["world"]) {
foreach ($this->getServer()->getLevelByName($g["world"])->getPlayers() as $p) {
$p->sendMessage(TextFormat::DARK_GRAY . "E' stato rotto il letto" . TextFormat::GREEN . "Verde" . TextFormat::DARK_GRAY . "! I giocatori verdi sono stati eliminati!");
}
} elseif ($blockpos === $ypos and $bl === $g["world"]) {
foreach ($this->getServer()->getLevelByName($g["world"])->getPlayers() as $p) {
$p->sendMessage(TextFormat::DARK_GRAY . "E' stato rotto il letto" . TextFormat::YELLOW . "Giallo" . TextFormat::DARK_GRAY . "! I giocatori gialli sono stati eliminati!");
}
}
}
}
}
示例6: onBlockBreakEvent
public function onBlockBreakEvent(BlockBreakEvent $event)
{
if (!$event->getPlayer()->isOp()) {
$event->setCancelled(true);
$this->debug->onDebug('BlockBreakEvent');
}
}
示例7: SignBreak
public function SignBreak(BlockBreakEvent $event)
{
$block = $event->getBlock();
if (isset($this->configData["{$block->x}:{$block->y}:{$block->z}"])) {
unset($this->configData["{$block->x}:{$block->y}:{$block->z}"]);
}
}
示例8: onBlockBreak
/**
*
* @param BlockBreakEvent $event
*/
public function onBlockBreak(BlockBreakEvent $event)
{
if ($event->getPlayer() instanceof Player) {
if ($this->plugin->gameLevelManager->setupModeAction === GameLevelManager::COMMAND_SETUP_WAND_GAME_LEVEL || $this->plugin->gameLevelManager->setupModeAction === GameLevelManager::COMMAND_SETUP_WAND_GAME_LEVEL_GATE) {
$this->plugin->gameLevelManager->handleBlockBreakSelection($event->getPlayer(), $event->getBlock());
}
}
}
示例9: onBreak
public function onBreak(BlockBreakEvent $event)
{
$player = $event->getPlayer();
if ($event->getBlock()->getId() === FlowerPotMain::BLOCK_ITEM_FRAME and !$player->isOp()) {
$player->sendMessage("You do not have permission.");
$event->setCancelled();
}
}
示例10: onBlockBreak
public function onBlockBreak(BlockBreakEvent $event)
{
if ($this->plugin->isJailed($event->getPlayer())) {
$event->getPlayer()->sendMessage("§eYou are not allowed to destroy the jail!\nAdded " . $this->getPlugin()->getConfig()->get("punish-additional-minutes") . " minutes as punishment.");
$this->getPlugin()->punish($event->getPlayer(), $this->getPlugin()->getConfig()->get("punish-additional-minutes"));
$event->setCancelled(true);
}
}
示例11: onBlockBreak
public function onBlockBreak(BlockBreakEvent $event)
{
$player = $event->getPlayer();
if (!$player->hasPermission("xperms.build")) {
$player->sendMessage(TextFormat::RED . $this->plugin->getConfiguration()->getMSGonIBuildPerm());
$event->setCancelled(true);
}
}
示例12: onBreak
public function onBreak(BlockBreakEvent $event)
{
if ($event->getPlayer()->hasPermission("worldprotector.block.break")) {
$event->setCancelled(false);
} else {
$event->setCancelled(true);
}
}
示例13: onBlockBreak
/**
*
* @param BlockBreakEvent $event
*/
public function onBlockBreak(BlockBreakEvent $event)
{
if ($event->getPlayer() instanceof Player) {
if ($this->plugin->arenaManager->setupModeAction === MapArenaManager::COMMAND_SETUP_WAND_ARENA_MAIN || $this->plugin->arenaManager->setupModeAction === MapArenaManager::COMMAND_SETUP_WAND_ARENA_MAIN_PLAYER_SPAWNS || $this->plugin->arenaManager->setupModeAction === MapArenaManager::COMMAND_SETUP_WAND_ARENA_DEATH_MATCH || $this->plugin->arenaManager->setupModeAction === MapArenaManager::COMMAND_SETUP_WAND_ARENA_DEATH_MATCH_SPAWN) {
$this->plugin->arenaManager->handleBlockBreakSelection($event->getPlayer(), $event->getBlock());
}
}
}
示例14: onBreak
public function onBreak(BlockBreakEvent $ev)
{
$player = $ev->getPlayer();
$cfg = $this->config->getAll();
if ($ev->isCancelled()) {
$player->setHeatlh($player->getHealth() - $cfg["Damage"]);
return;
}
}
示例15: onBlockBreak
public function onBlockBreak(BlockBreakEvent $event)
{
$player = $event->getPlayer();
$block = $event->getBlock();
if ($player->hasPermission('log.breaked.block')) {
$this->plugin->addBreakedBlock($block, $player);
// ADD TIME
}
}