Пример #1
11
 public function onPlace(BlockPlaceEvent $event)
 {
     if ($event->getBlock()->getId() != Block::CHEST) {
         return;
     }
     $block = $event->getBlock();
     if ($this->sideCheck($block->x + 1, $block->y, $block->z, $block->getLevel(), $event->getPlayer()->getName()) == Block::CHEST or $this->sideCheck($block->x - 1, $block->y, $block->z, $block->getLevel(), $event->getPlayer()->getName()) == Block::CHEST or $this->sideCheck($block->x, $block->y, $block->z + 1, $block->getLevel(), $event->getPlayer()->getName()) == Block::CHEST or $this->sideCheck($block->x, $block->y, $block->z - 1, $block->getLevel(), $event->getPlayer()->getName()) == Block::CHEST) {
         $event->getPlayer()->sendMessage(TextFormat::RED . "바로 옆에 다른사람의 상자가 있습니다, 설치 불가능 !");
         return;
     }
     $this->configData["{$block->x}:{$block->y}:{$block->z}"] = $event->getPlayer()->getName();
 }
Пример #2
0
 public function blockPlace(BlockPlaceEvent $event)
 {
     //2
     $id = $event->getItem()->getId();
     if ($id == $this->id) {
         $player = $event->getPlayer();
         $username = $player->getName();
         if (empty($this->data[$user][2])) {
             $x = $event->getBlock()->x;
             $y = $event->getBlock()->y;
             $z = $event->getBlock()->z;
             $this->data[$user][2] = 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;
 }
Пример #3
0
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     $block = $event->getBlock()->getName();
     if ($block == "Chest") {
         $this->arenaManager->onChestPlaced($event);
     }
 }
Пример #4
0
 public function PlaceQueeue(BlockPlaceEvent $event)
 {
     $block = $event->getBlock();
     if ($block->getID() === Item::BED_BLOCK) {
         $player = $event->getPlayer();
         $this->placeQueeue[$player->getName()] = 1;
     }
 }
Пример #5
0
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     $player = $event->getPlayer();
     $block = $event->getBlock();
     if ($player->hasPermission('log.placed.block')) {
         $this->plugin->addPlacedBlock($block, $player);
         // ADD TIME
     }
 }
Пример #6
0
 /**
  * @param BlockPlaceEvent $event
  *
  * @priority HIGH
  */
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     // PowerTool
     if ($this->getAPI()->executePowerTool($event->getPlayer(), $event->getItem())) {
         $event->setCancelled(true);
     } elseif ($this->getAPI()->isUnlimitedEnabled($event->getPlayer())) {
         $event->setCancelled(true);
         $pos = new Vector3($event->getBlockReplaced()->getX(), $event->getBlockReplaced()->getY(), $event->getBlockReplaced()->getZ());
         $event->getPlayer()->getLevel()->setBlock($pos, $event->getBlock(), true);
     }
 }
Пример #7
0
 public function onBanblock(BlockPlaceEvent $event)
 {
     $blocklist = array("46", "327", "10", "11");
     foreach ($blocklist as $Bancode) {
         if ($event->getBlock()->getId() == $Bancode) {
             $event->setCancelled(true);
             $player = $event->getPlayer();
             $player->sendMessage(TextFormat::RED . $player->getName() . "님이 금지된 아이템을 사용하였습니다");
         }
     }
 }
Пример #8
0
 public function onPlace(BlockPlaceEvent $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
0
 /**
  * @priority HIGHEST
  */
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     if (!$event->isCancelled()) {
         $block = $event->getBlock();
         if (isset($this->levelTickBlocks[$levelName = $block->getLevel()->getFolderName()]) && isset($this->randomTickBlocks[$levelName])) {
             if (in_array($block->getID(), $this->randomTickBlocks[$levelName]) && $block->getID() !== Block::GLASS && !isset($this->levelTickBlocks[$levelName][$posKey = $block->x . ":" . $block->y . ":" . $block->z])) {
                 $this->levelTickBlocks[$levelName][$posKey] = new Position($block->x, $block->y, $block->z, $block->level);
             }
         }
     }
 }
Пример #10
0
 public function onPlace(BlockPlaceEvent $bpe)
 {
     $pl = $bpe->getPlayer();
     $name = $pl->getName();
     $bl = $bpe->getBlock();
     $blname = $bl->getName();
     $lvl = $pl->getLevel()->getName();
     $x = $pl->getX();
     $y = $pl->getY();
     $z = $pl->getZ();
     $this->getLogger()->info(C::YELLOW . "{$name}" . C::DARK_AQUA . " Placed/tried to Place (a)" . C::YELLOW . " {$blname}" . C::DARK_AQUA . " in World:" . C::YELLOW . " {$lvl}" . C::DARK_AQUA . " at Position:" . C::YELLOW . " {$x}, {$y}, {$z}");
 }
Пример #11
0
 public function place(BlockPlaceEvent $place)
 {
     $block = $place->getBlock();
     $player = $place->getPlayer();
     if ($block->getId() === 46) {
         $place->setCancelled();
         $mot = (new Random())->nextSignedFloat() * M_PI * 2;
         $tnt = Entity::createEntity("PrimedTNT", $block->getLevel()->getChunk($block->x >> 4, $block->z >> 4), new Compound("", ["Pos" => new EnumTag("Pos", [new DoubleTag("", $block->x + 0.5), new DoubleTag("", $block->y), new DoubleTag("", $block->z + 0.5)]), "Motion" => new EnumTag("Motion", [new DoubleTag("", -sin($mot) * 0.02), new DoubleTag("", 0.2), new DoubleTag("", -cos($mot) * 0.02)]), "Rotation" => new EnumTag("Rotation", [new FloatTag("", 0), new FloatTag("", 0)]), "Fuse" => new ByteTag("Fuse", 100)]));
         $tnt->spawnToAll();
         $player->getLevel()->addSound(new AnviluseSound($player), array($player));
         return true;
     }
 }
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     if ($this->plugin->cfg->get("debugmode") == "true") {
         $this->plugin->getServer()->getLogger()->info(MT::GREEN . "CommandTest BPosition Place");
     }
     $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);
     }
 }
Пример #13
0
 public function playerBlockPlace(BlockPlaceEvent $event)
 {
     $id = $event->getBlock()->getID();
     $player = $event->getPlayer();
     if ($id == in_array($id, $this->config->get("banned-items"))) {
         if ($player->isOp()) {
             if (!$this->config->get("ops-can-use-items") == true) {
                 $player->sendMessage($this->config->get("msg-item-use"));
                 $event->setCancelled();
             }
         } else {
             $player->sendMessage($this->config->get("msg-item-use"));
             $event->setCancelled();
         }
     }
 }
Пример #14
0
 /**
  * @param BlockPlaceEvent $event
  *
  * @priority        HIGH
  * @ignoreCancelled true
  */
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     $player = $event->getPlayer();
     if ($player->isOp()) {
         return;
     }
     foreach ($this->plugin->getAllZones() as $zone) {
         if ($zone->isIn($event->getBlock())) {
             if ($player->hasPermission($zone->getName() . MEMBER)) {
                 break;
             }
             $event->setCancelled(true);
             $player->sendMessage("[iZone] This is a private area.");
             break;
         }
     }
 }
Пример #15
0
 public function blockPlace(BlockPlaceEvent $event)
 {
     $block = $event->getBlock();
     if ($block->getId() == 52) {
         $block->setDamage(32);
         $event->setCancelled();
         $block->getLevel()->setBlock($block, $block);
     }
 }
Пример #16
0
 public function onBlockPlace(BlockPlaceEvent $ev)
 {
     $pl = $ev->getPlayer();
     if (!isset($this->places[$pl->getName()])) {
         return;
     }
     $id = $ev->getBlock()->getId();
     $ev->setCancelled();
     unset($this->places[$pl->getName()]);
 }
Пример #17
0
 public function onPlace(BlockPlaceEvent $event)
 {
     $player = $event->getPlayer();
     $block = $event->getBlock();
     if ($player->isOp()) {
         return;
     }
     $area = $this->db[$block->getLevel()->getFolderName()]->getArea($block->x, $block->z);
     if ($area != false) {
         if ($this->db[$block->getLevel()->getFolderName()]->checkResident($area["ID"], $player->getName())) {
             return;
         }
         if ($this->db[$block->getLevel()->getFolderName()]->isProtected($area["ID"])) {
             if ($this->db[$block->getLevel()->getFolderName()]->isAllowOption($area["ID"], $block->getID() . ":" . $block->getDamage())) {
                 return;
             }
             $this->getServer()->getPluginManager()->callEvent($ev = new AreaModifyEvent($player, $block, AreaModifyEvent::PLACE_PROTECT_AREA));
             if ($ev->isCancelled()) {
                 return;
             }
             if ($this->checkShowPreventMessage()) {
                 $this->alert($player, $this->get("block-change-denied"));
             }
             $event->setCancelled();
             return;
         } else {
             if ($this->db[$block->getLevel()->getFolderName()]->isForbidOption($area["ID"], $block->getID() . ":" . $block->getDamage())) {
                 $this->getServer()->getPluginManager()->callEvent($ev = new AreaModifyEvent($player, $block, AreaModifyEvent::PLACE_FORBID));
                 if ($ev->isCancelled()) {
                     return;
                 }
                 if ($this->checkShowPreventMessage()) {
                     $this->alert($player, $this->get("block-active-denied"));
                 }
                 $event->setCancelled();
             }
         }
     } else {
         if ($this->db[$block->getLevel()->getFolderName()]->isWhiteWorld()) {
             if ($this->db[$block->getLevel()->getFolderName()]->option["white-protect"] == true) {
                 if ($this->db[$block->getLevel()->getFolderName()]->isWhiteWorldAllowOption($block->getID() . ":" . $block->getDamage())) {
                     return;
                 }
                 $this->getServer()->getPluginManager()->callEvent($ev = new AreaModifyEvent($player, $block, AreaModifyEvent::PLACE_WHITE));
                 if ($ev->isCancelled()) {
                     return;
                 }
                 if ($this->checkShowPreventMessage()) {
                     $this->alert($player, $this->get("whiteworld-change-denied"));
                 }
                 $event->setCancelled();
             } else {
                 if ($this->db[$block->getLevel()->getFolderName()]->isWhiteWorldForbidOption($block->getID() . ":" . $block->getDamage())) {
                     return;
                 }
                 $this->getServer()->getPluginManager()->callEvent($ev = new AreaModifyEvent($player, $block, AreaModifyEvent::PLACE_WHITE_FORBID));
                 if ($ev->isCancelled()) {
                     return;
                 }
                 if ($this->checkShowPreventMessage()) {
                     $this->alert($player, $this->get("block-active-denied"));
                 }
                 $event->setCancelled();
             }
             return;
         }
     }
 }
Пример #18
0
 /**
  * @param BlockPlaceEvent $event
  * @priority MONITOR
  * @ignoreCancelled true
  */
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     if (!$this->isFactionWorld($event->getBlock()->getLevel()->getName())) {
         return;
     }
     if (self::$ACTIVITY_DEFINITION === self::ACTIVITY_BUILD) {
         $this->onLoggedIn($event->getPlayer());
     }
 }
Пример #19
0
 public function onBlockPlace(\pocketmine\event\block\BlockPlaceEvent $event)
 {
     if (!isset($this->editors[$name = $event->getPlayer()->getName()])) {
         if (isset($this->sh[$this->getPos($event->getBlock())])) {
             $event->setCancelled();
         } elseif (isset($this->place[$name])) {
             $event->setCancelled();
             unset($this->place[$name]);
         }
     }
 }
Пример #20
0
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     $block = $event->getBlock();
     if ($block instanceof Block) {
         $border = $this->checkBorder(array("level" => $block->getLevel()->getName(), "x" => round($block->getX()), "z" => round($block->getZ())));
         if ($border) {
             $event->setCancelled(true);
             $player->sendMessage("Don't place blocks out of the border!");
         }
     }
 }
Пример #21
0
 /**
  * @param BlockPlaceEvent|BlockBreakEvent|PlayerInteractEvent $event
  */
 private function onEventOnBlock($event)
 {
     $levelName = $event->getBlock()->getLevel()->getName();
     if (!$this->plugin->isLevelLoaded($levelName)) {
         return;
     }
     $plot = $this->plugin->getPlotByPosition($event->getBlock());
     if ($plot !== null) {
         $username = $event->getPlayer()->getName();
         if ($plot->owner == $username or $plot->isHelper($username) or $event->getPlayer()->hasPermission("myplot.admin.build.plot")) {
             return;
         }
     } elseif ($event->getPlayer()->hasPermission("myplot.admin.build.road")) {
         return;
     }
     $event->setCancelled(true);
 }
Пример #22
0
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     $b = $event->getBlock();
     $p = $event->getPlayer();
     $n = strtolower($p->getName());
     if (isset($this->sel1[$n])) {
         unset($this->sel1[$n]);
         $this->pos1[$n] = new Vector3($b->getX(), $b->getY(), $b->getZ());
         $p->sendMessage("Position 1 set to: (" . $this->pos1[$n]->getX() . ", " . $this->pos1[$n]->getY() . ", " . $this->pos1[$n]->getZ() . ")");
         $event->setCancelled();
     } else {
         if (isset($this->sel2[$n])) {
             unset($this->sel2[$n]);
             $this->pos2[$n] = new Vector3($b->getX(), $b->getY(), $b->getZ());
             $p->sendMessage("Position 2 set to: (" . $this->pos2[$n]->getX() . ", " . $this->pos2[$n]->getY() . ", " . $this->pos2[$n]->getZ() . ")");
             $event->setCancelled();
         } else {
             if (!$this->canEdit($p, $b)) {
                 $event->setCancelled();
             }
         }
     }
 }
Пример #23
0
 public function onPlace(BlockPlaceEvent $event)
 {
     if (!isset($this->sign)) {
         return;
     }
     $block = $event->getBlock();
     if ($this->PlayerIsInGame($event->getPlayer()->getName()) || $block->getLevel() == $this->level) {
         if (!$event->getPlayer()->isOp()) {
             $event->setCancelled();
         }
     }
     unset($block, $event);
 }
Пример #24
0
 /**
  * onBlockPlace
  *
  * @param BlockPlaceEvent $event        	
  *
  */
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     if (!$event->getPlayer()->isOp()) {
         $allow = $this->checkBlockBreakAndPlacementPermission($event->getPlayer(), $event->getBlock());
         $this->plugin->log("PlayerLobbyListener->onBlockPlace allow: " . $allow);
         if (!$allow) {
             $event->setCancelled(true);
             $this->plugin->log("[HG] PlayerLobbyListener: onBlockPlace cancelled for player " . $event->getPlayer()->getName());
         }
         if ($allow) {
             $event->setCancelled(false);
             $b = $event->getBlock();
             if (!empty($event->getPlayer()->getInventory())) {
                 $event->getPlayer()->getLevel()->setBlock(new Position($b->x, $b->y, $b->z, $b->getLevel()), $b);
                 $this->plugin->log("[HG] PlayerLobbyListener: onBlockPlace ALLOW " . $event->getPlayer()->isOp() . " | " . $event->getPlayer()->getGamemode() . "|" . $event->getPlayer()->getName() . "|" . $event->getPlayer()->getLevel()->getName());
                 $items[] = $event->getPlayer()->getInventory()->getContents();
                 $i = 0;
                 foreach ($items as $index) {
                     foreach ($index as $m) {
                         if ($m->getId() === $b->getId()) {
                             $i = $m->getCount();
                         }
                     }
                 }
                 if ($i > 0) {
                     $i--;
                     $event->getPlayer()->getInventory()->setItemInHand(new Item(Item::AIR));
                     $event->getPlayer()->getInventory()->addItem(new Item($b->getId(), 0, $i));
                 }
             }
         }
     }
 }
Пример #25
0
 /**
  * @priority LOWEST
  * @ignoreCancelled true
  * @param BlockPlaceEvent $event
  */
 public function onBlockPlace(BlockPlaceEvent $event)
 {
     $player = $event->getPlayer();
     $block = $event->getBlock();
     $job = $this->jobs->get($this->player->get($player->getName()));
     if ($job !== false) {
         if (isset($job[$block->getID() . ":" . $block->getDamage() . ":place"])) {
             $this->api->addMoney($player, $job[$block->getID() . ":" . $block->getDamage() . ":place"]);
         }
     }
 }
Пример #26
0
 public function onBlockPlaceEvent(BlockPlaceEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $bl = $ev->getBlock();
     if ($bl->getId() != Block::CHEST || $bl->getSide(Vector3::SIDE_DOWN)->getId() != $this->base_block) {
         return;
     }
     $ev->getPlayer()->sendMessage(mc::_("Placed a NetherChest"));
 }
Пример #27
0
 public function onPlace(BlockPlaceEvent $event)
 {
     if ($event->getBlock()->distance($event->getPlayer()) > 7) {
         $event->setCancelled();
     }
 }
Пример #28
0
 /**
  * @param BlockPlaceEvent|BlockBreakEvent|PlayerInteractEvent $event
  */
 private function onEventOnBlock($event)
 {
     $levelName = $event->getBlock()->getLevel()->getName();
     if (!$this->plugin->isLevelLoaded($levelName)) {
         return;
     }
     $plot = $this->plugin->getPlotByPosition($event->getBlock());
     if ($plot !== null) {
         $username = $event->getPlayer()->getName();
         if ($plot->owner == $username or $plot->isHelper($username) or $event->getPlayer()->hasPermission("myplot.admin.build.plot")) {
             if (!($event instanceof PlayerInteractEvent and $event->getBlock() instanceof Sapling)) {
                 return;
             }
             /*
              * Prevent growing a tree near the edge of a plot
              * so the leaves won't go outside the plot
              */
             $block = $event->getBlock();
             $maxLengthLeaves = ($block->getDamage() & 0x7) == Sapling::SPRUCE ? 3 : 2;
             $beginPos = $this->plugin->getPlotPosition($plot);
             $endPos = clone $beginPos;
             $beginPos->x += $maxLengthLeaves;
             $beginPos->z += $maxLengthLeaves;
             $plotSize = $this->plugin->getLevelSettings($levelName)->plotSize;
             $endPos->x += $plotSize - $maxLengthLeaves;
             $endPos->z += $plotSize - $maxLengthLeaves;
             if ($block->x >= $beginPos->x and $block->z >= $beginPos->z and $block->x < $endPos->x and $block->z < $endPos->z) {
                 return;
             }
         }
     } elseif ($event->getPlayer()->hasPermission("myplot.admin.build.road")) {
         return;
     }
     $event->setCancelled(true);
 }
Пример #29
-1
 public function onBlockPlaceEvent(BlockPlaceEvent $ev)
 {
     $bl = $ev->getBlock();
     if ($bl->getId() == 39) {
         $event->setCancelled(true);
     }
     if ($bl->getId() == 32) {
         $event->setCancelled(true);
     }
     if ($ev->isCancelled()) {
         return;
     }
     if ($bl->getId() != Block::CHEST || $bl->getSide(Vector3::SIDE_DOWN)->getId() != Block::GLASS) {
         return;
     }
     $ev->getPlayer()->sendMessage("Placed Armour Crate...");
 }
 public function onPlayerPlaceBlock(BlockPlaceEvent $event)
 {
     $blockID = $event->getBlock()->getID();
     $bl = $event->getBlock();
     $pos = $event->getBlock(new Vector3($bl->x, $bl->y, $bl->z));
     if ($blockID == 54) {
         $block1 = $event->getBlock()->getLevel()->getBlock(new Vector3($bl->x + 1, $bl->y, $bl->z));
         $block2 = $event->getBlock()->getLevel()->getBlock(new Vector3($bl->x - 1, $bl->y, $bl->z));
         $block3 = $event->getBlock()->getLevel()->getBlock(new Vector3($bl->x, $bl->y, $bl->z + 1));
         $block4 = $event->getBlock()->getLevel()->getBlock(new Vector3($bl->x, $bl->y, $bl->z - 1));
         if ($block1->getID() == 54 || $block2->getID() == 54 || $block3->getID() == 54 || $block4->getID() == 54) {
             $event->getPlayer()->sendPopup(MT::RED . "Keine Doppelkisten! - no double chests!");
             $this->debug->onDebug('Doublechest placement');
             $event->setCancelled(true);
         }
     }
 }