本文整理汇总了PHP中pocketmine\event\block\BlockPlaceEvent::setCancelled方法的典型用法代码示例。如果您正苦于以下问题:PHP BlockPlaceEvent::setCancelled方法的具体用法?PHP BlockPlaceEvent::setCancelled怎么用?PHP BlockPlaceEvent::setCancelled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\block\BlockPlaceEvent
的用法示例。
在下文中一共展示了BlockPlaceEvent::setCancelled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onPlace
public function onPlace(BlockPlaceEvent $event)
{
if ($event->getPlayer()->hasPermission("worldprotector.block.place")) {
$event->setCancelled(false);
} else {
$event->setCancelled(true);
}
}
示例2: onBlockPlace
/**
* @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);
}
}
示例3: onBlockPlace
/**
* @param BlockPlaceEvent $event
* @priority HIGHEST
* @ignoreCancelled true
*/
public function onBlockPlace(BlockPlaceEvent $event)
{
if (!$this->plugin->getStorage()->getShield($event->getPlayer()->getLevel())->isAllowed(Shield::PLACING)) {
$event->setCancelled(true);
$event->getPlayer()->sendTip($this->plugin->getConfig()->get("placeNotAllowed"));
}
}
示例4: playerBlockPlace
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();
}
}
}
示例5: onPlayerPlaceBlock
public function onPlayerPlaceBlock(BlockPlaceEvent $event)
{
if (!$event->getPlayer()->isOp()) {
$event->setCancelled(true);
$this->debug->onDebug('BlockPlaceEvent');
}
}
示例6: onBlockPlace
public function onBlockPlace(BlockPlaceEvent $event)
{
$player = $event->getPlayer();
if (!$player->hasPermission("xperms.build")) {
$player->sendMessage(TextFormat::RED . $this->plugin->getConfiguration()->getMSGonIBuildPerm());
$event->setCancelled(true);
}
}
示例7: onPlace
public function onPlace(BlockPlaceEvent $event)
{
$username = $event->getPlayer()->getName();
if (isset($this->PlacePrevent[$username])) {
$event->setCancelled(true);
unset($this->PlacePrevent[$username]);
}
}
示例8: onBlockPlace
public function onBlockPlace(BlockPlaceEvent $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);
}
}
示例9: onPlace
public function onPlace(BlockPlaceEvent $event)
{
foreach ($this->tntRun->arenas as $arena) {
if ($arena->getPlayerManager()->isInArena($event->getPlayer())) {
$event->setCancelled();
return;
}
}
}
示例10: onPlace
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");
}
}
}
}
示例11: onBanblock
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() . "님이 금지된 아이템을 사용하였습니다");
}
}
}
示例12: onBlockPlace
public function onBlockPlace(BlockPlaceEvent $event)
{
$player = $event->getPlayer();
$level = $player->getLevel();
$spawn = $level->getSpawnLocation();
$distance = $spawn->distance($player);
if ($distance <= $this->cfg->get($level->getName())) {
if (!$player->hasPermission("customradius.edit")) {
$event->setCancelled(true);
}
}
}
示例13: place
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;
}
}
示例14: onBlockPlace
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);
}
}
示例15: onBlockPlace
/**
* @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;
}
}
}