本文整理汇总了PHP中pocketmine\event\block\BlockBreakEvent::getPlayer方法的典型用法代码示例。如果您正苦于以下问题:PHP BlockBreakEvent::getPlayer方法的具体用法?PHP BlockBreakEvent::getPlayer怎么用?PHP BlockBreakEvent::getPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\block\BlockBreakEvent
的用法示例。
在下文中一共展示了BlockBreakEvent::getPlayer方法的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
/**
* @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"));
}
}
示例3: onBlockBreak
/**
* @param BlockBreakEvent $event
*/
public function onBlockBreak(BlockBreakEvent $event)
{
$player = $event->getPlayer();
$b = $event->getBlock();
if ($this->getPlugin()->pos_display_flag == 1) {
$event->getPlayer()->sendMessage("BREAKED: [x=" . $b->x . " y=" . $b->y . " z=" . $b->z . "]");
}
// @fix1- team can only break enermy flag and not own
$redTeamFlagPos = $this->getSetup()->getFlagPos(CTFSetup::CTF_FLAG_RED_TEAM);
if (round($b->x) == round($redTeamFlagPos->x) && round($b->y) == round($redTeamFlagPos->y) && round($b->z) == round($redTeamFlagPos->y)) {
if (isset($this->pgin->redTeamPlayers[$player->getName()])) {
// update again to fix color issue
$this->getBuilder()->addBlueTeamFlag($player->getLevel(), 171, 14);
$event->setCancelled(true);
}
}
$blueTeamFlagPos = $this->getSetup()->getFlagPos(CTFSetup::CTF_FLAG_BLUE_TEAM);
if (round($b->x) == round($blueTeamFlagPos->x) && round($b->y) == round($blueTeamFlagPos->y) && round($b->z) == round($blueTeamFlagPos->z)) {
if (isset($this->pgin->blueTeamPLayers[$player->getName()])) {
// update again to fix color issue
$this->getBuilder()->addBlueTeamFlag($player->getLevel(), 171, 11);
$event->setCancelled(true);
}
}
// @fix #2 stop player break anything else other than the flags
if (strtolower($player->level->getName()) == strtolower($this->getSetup()->getCTFWorldName())) {
if ($this->getSetup()->isCTFWorldBlockBreakDisable() || !$player->isOp()) {
if ($b->getId() != 171) {
$event->setCancelled(true);
}
}
}
}
示例4: onBreak
public function onBreak(BlockBreakEvent $event)
{
if ($event->isCancelled()) {
return;
}
$player = $event->getPlayer();
$block = $event->getBlock();
$drops = $block->getDrops($event->getItem());
$x = $block->x + 0.5;
$y = $block->y + 0.5;
$z = $block->z + 0.5;
$tile = $block->getLevel()->getTile($block);
if ($tile instanceof Chest) {
return;
}
if ($event->getItem() instanceof Item) {
$event->getItem()->useOn($block);
if ($event->getItem()->isTool() and $event->getItem()->getDamage() >= $event->getItem()->getMaxDurability()) {
$event->getPlayer()->getInventory()->setItemInHand(Item::get(Item::AIR, 0, 0));
}
}
if (!$player instanceof Player) {
foreach ($drops as $drop) {
if ($drop[2] > 0) {
$event->getBlock()->getLevel()->dropItem($event->getBlock()->add(0.5, 0.5, 0.5), Item::get(...$drop));
}
}
} else {
if ($player->isSurvival()) {
$this->breakQueue["{$block->x}:{$block->y}:{$block->z}"]["drop"] = $drops;
$this->breakQueue["{$block->x}:{$block->y}:{$block->z}"]["player"] = $player;
$this->itemQueue["{$x}:{$y}:{$z}"] = $drops;
}
}
}
示例5: 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());
}
}
}
示例6: 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);
}
}
示例7: 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());
}
}
}
示例8: onBreak
public function onBreak(BlockBreakEvent $event)
{
if (!$event->getPlayer()->hasPermission("customareas.bypass")) {
foreach ($this->plugin->areas as $area) {
if ($area->isInside($event->getBlock()) and !$area->canBuild($event->getPlayer())) {
$event->setCancelled();
$event->getPlayer()->sendMessage("This is " . $area->owner . "'s private area");
}
}
}
}
示例9: onBlockBeak
public function onBlockBeak(BlockBreakEvent $event)
{
$log = $event->getPlayer()->getID();
if (in_array($log, $this->locations)) {
$ru = $event->getBlock();
$zoo = strtolower($event->getPlayer()->getName());
$this->pos[$zoo] = new Vector3($ru->getX(), $ru->getY(), $ru->getZ());
$event->getPlayer()->sendMessage("BlockPosition :[x->" . $this->pos[$zoo]->getX() . "y->" . $this->pos[$zoo]->getY() . "z->" . $this->pos[$zoo]->getZ() . "]");
$event->setCancelled(true);
}
}
示例10: onBlockBreak
public function onBlockBreak(BlockBreakEvent $event)
{
if (!$event->getPlayer()->hasPermission("warp.del")) {
return;
}
$loc = $this->encodeLoc($event->getBlock());
if (!isset(self::$warpData[$loc])) {
return;
}
unset(self::$warpData[$loc]);
$event->getPlayer()->sendMessage(TextFormat::AQUA . "Successfully deleted the warp.");
$this->saveWarpData();
}
示例11: onBlockBreak
public function onBlockBreak(BlockBreakEvent $event)
{
if ($this->plugin->cfg->get("debugmode") == "true") {
$this->plugin->getServer()->getLogger()->info(MT::GREEN . "CommandTest BPosition Break");
}
$id = $event->getPlayer()->getID();
if (in_array($id, $this->schalter)) {
$bl = $event->getBlock();
$n = strtolower($event->getPlayer()->getName());
$this->pos[$n] = new Vector3($bl->getX(), $bl->getY(), $bl->getZ());
$event->getPlayer()->sendMessage(MT::GOLD . "Position(" . $this->pos[$n]->getX() . "," . $this->pos[$n]->getY() . "," . $this->pos[$n]->getZ() . ")");
$event->setCancelled(true);
}
}
示例12: 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"));
}
}
}
示例13: onBreak
public function onBreak(BlockBreakEvent $e)
{
$p = $e->getPlayer();
$b = $e->getBlock();
if ($e->getBlock()->getId() == 1 && mt_rand(0, $this->getConfig()->get("t1-chance")) == "1") {
for ($i = 0; $i <= 5; $i++) {
$p->getLevel()->addParticle(new LavaParticle($b, 2));
}
$p->getLevel()->addSound(new PopSound($p));
$this->getServer()->broadcastMessage(TextFormat::LIGHT_PURPLE . TextFormat::BOLD . "<TL> " . TextFormat::RESET . TextFormat::GREEN . $p->getName() . TextFormat::AQUA . " found " . TextFormat::BOLD . TextFormat::RED . "Tier 1" . TextFormat::RESET . TextFormat::AQUA . " loot underground!");
foreach ($this->getConfig()->get("t1-loot") as $loot) {
$p->getInventory()->addItem(Item::get($loot, 0, mt_rand(0, $this->getConfig()->get("t1-item-max"))));
}
}
if ($e->getBlock()->getId() == 1 && mt_rand(0, $this->getConfig()->get("t2-chance")) == "1") {
for ($i = 0; $i <= 8; $i++) {
$p->getLevel()->addParticle(new LavaParticle($b, 2));
}
$p->getLevel()->addSound(new PopSound($p));
$this->getServer()->broadcastMessage(TextFormat::LIGHT_PURPLE . TextFormat::BOLD . "<TL> " . TextFormat::RESET . TextFormat::GREEN . $p->getName() . TextFormat::AQUA . " found " . TextFormat::BOLD . TextFormat::GOLD . "Tier 2" . TextFormat::RESET . TextFormat::AQUA . " loot underground!");
foreach ($this->getConfig()->get("t2-loot") as $loot) {
$p->getInventory()->addItem(Item::get($loot, 0, mt_rand(0, $this->getConfig()->get("t2-item-max"))));
}
}
if ($e->getBlock()->getId() == 1 && mt_rand(0, $this->getConfig()->get("t3-chance")) == "1") {
for ($i = 0; $i <= 11; $i++) {
$p->getLevel()->addParticle(new LavaParticle($b, 2));
}
$p->getLevel()->addSound(new PopSound($p));
$this->getServer()->broadcastMessage(TextFormat::LIGHT_PURPLE . TextFormat::BOLD . "<TL> " . TextFormat::RESET . TextFormat::GREEN . $p->getName() . TextFormat::AQUA . " found " . TextFormat::BOLD . TextFormat::YELLOW . "Tier 3" . TextFormat::RESET . TextFormat::AQUA . " loot underground!");
foreach ($this->getConfig()->get("t3-loot") as $loot) {
$p->getInventory()->addItem(Item::get($loot, 0, mt_rand(0, $this->getConfig()->get("t3-item-max"))));
}
}
}
示例14: blockBreak
public function blockBreak(BlockBreakEvent $event)
{
//1
$id = $event->getItem()->getId();
if ($id == $this->id) {
$player = $event->getPlayer();
$username = $player->getName();
if (empty($this->data[$user][1])) {
$x = $event->getBlock()->x;
$y = $event->getBlock()->y;
$z = $event->getBlock()->z;
$this->data[$user][1] = array($x, $y, $z);
$ms = "";
if (isset($this->data[$user][2])) {
//片方がセットされていたら
$ms = "[FiredNubesco] Second position has been set to: {$x}, {$y}, {$z}";
$size = $this->countBlocks($player);
if ($num != false) {
$ms .= " (Size: " . $size[0] . "X" . $size[1] . ")";
}
} else {
$ms = "[FiredNubesco] First position has been set to: {$x}, {$y}, {$z}";
}
$player->sendMessage($ms);
$event->setCancelled(true);
}
}
return true;
}
示例15: 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;
}