本文整理汇总了PHP中pocketmine\event\block\SignChangeEvent::getBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP SignChangeEvent::getBlock方法的具体用法?PHP SignChangeEvent::getBlock怎么用?PHP SignChangeEvent::getBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\block\SignChangeEvent
的用法示例。
在下文中一共展示了SignChangeEvent::getBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: placeSign
public function placeSign(SignChangeEvent $ev)
{
//echo __METHOD__.",".__LINE__."\n";//##DEBUG
if ($ev->getBlock()->getId() != Block::SIGN_POST && $ev->getBlock()->getId() != Block::WALL_SIGN) {
return;
}
$tile = $ev->getPlayer()->getLevel()->getTile($ev->getBlock());
if (!$tile instanceof Sign) {
return;
}
//echo __METHOD__.",".__LINE__."\n";//##DEBUG
$sign = $ev->getLines();
if (!isset($this->signtxt[$sign[0]])) {
return;
}
//echo __METHOD__.",".__LINE__."\n";//##DEBUG
$pl = $ev->getPlayer();
if (!MPMU::access($pl, "killrate.signs.place")) {
//echo __METHOD__.",".__LINE__."\n";//##DEBUG
SignUtils::breakSignLater($this->owner, $tile);
return;
}
//echo __METHOD__.",".__LINE__."\n";//##DEBUG
$pl->sendMessage(mc::_("Placed [KillRate] sign"));
//echo __METHOD__.",".__LINE__."\n";//##DEBUG
$this->owner->getServer()->getScheduler()->scheduleDelayedTask(new PluginCallbackTask($this->owner, [$this, "updateTimer"], []), 10);
}
示例2: onSignChange
public function onSignChange(SignChangeEvent $event)
{
$text = $event->getLines();
$prefix = strtoupper($text[0]);
if ($prefix !== "[ARUSHOP]") {
return;
}
if (!$event->getPlayer()->hasPermission("arushop.create")) {
$event->getPlayer()->sendMessage(TextFormat::RED . ToAruPG::getTranslation("NO_PERMISSION"));
return;
}
$cost = $text[2];
$meta = $text[3];
$tag = $event->getBlock()->getX() . ";" . $event->getBlock()->getY() . ";" . $event->getBlock()->getZ() . ";" . $event->getBlock()->getLevel()->getFolderName();
if (!is_numeric($cost) || !is_numeric($meta)) {
$event->getPlayer()->sendMessage(TextFormat::RED . ToAruPG::getTranslation("WRONG_SHOP_META"));
return;
}
switch (strtoupper($text[1])) {
case "JOB":
if (JobManager::getJob($meta) === null) {
$event->getPlayer()->sendMessage(TextFormat::RED . ToAruPG::getTranslation("WRONG_SHOP_META"));
return;
}
$this->shops[$tag] = new JobShop($meta, $cost, ToAruPG::getTranslation("TAP_ONE_MORE"));
$meta = ToAruPG::getTranslation(JobManager::getJob($meta)->getName());
$name = ToAruPG::getTranslation("JOB_SHOP");
break;
case "SKILL":
if (SkillManager::getSkill($meta) === null) {
$event->getPlayer()->sendMessage(TextFormat::RED . ToAruPG::getTranslation("WRONG_SHOP_META"));
return;
}
$this->shops[$tag] = new SkillShop($meta, $cost, ToAruPG::getTranslation("TAP_ONE_MORE"));
$meta = ToAruPG::getTranslation(SkillManager::getSkill($meta)->getName());
$name = ToAruPG::getTranslation("SKILL_SHOP");
break;
case "SET":
if (JobManager::getJob($meta) === null) {
$event->getPlayer()->sendMessage(TextFormat::RED . ToAruPG::getTranslation("WRONG_SHOP_META"));
return;
}
$this->shops[$tag] = new SetShop($meta, $cost, ToAruPG::getTranslation("TAP_ONE_MORE"));
$meta = ToAruPG::getTranslation(JobManager::getJob($meta)->getName());
$name = ToAruPG::getTranslation("SET_SHOP");
break;
default:
$event->getPlayer()->sendMessage(TextFormat::RED . ToAruPG::getTranslation("WRONG_SHOP_META"));
return;
}
$this->saveShops();
$event->setLine(0, $name);
$event->setLine(1, TextFormat::AQUA . $meta);
$event->setLine(2, $cost . EconomyAPI::getInstance()->getMonetaryUnit());
$event->setLine(3, "");
$event->getPlayer()->sendMessage(TextFormat::AQUA . ToAruPG::getTranslation("SHOP_CREATED"));
}
示例3: onSignPlace
public function onSignPlace(SignChangeEvent $event)
{
if (!$event->getPlayer()->isOp()) {
return;
}
if ($event->getLine(0) != $this->get("tutorial")) {
return;
}
switch (strtolower($event->getLine(1))) {
case $this->get("start"):
$event->setLine(0, TextFormat::WHITE . $this->get("sign-tutorial-start1"));
$event->setLine(1, TextFormat::WHITE . $this->get("sign-tutorial-start2"));
$event->setLine(2, TextFormat::WHITE . $this->get("sign-tutorial-start3"));
$this->setStartSign($event->getBlock());
break;
case $this->get("skip"):
$event->setLine(0, TextFormat::WHITE . $this->get("sign-tutorial-skip1"));
$event->setLine(1, TextFormat::WHITE . $this->get("sign-tutorial-skip2"));
$event->setLine(2, TextFormat::WHITE . $this->get("sign-tutorial-skip3"));
$this->setSkipSign($event->getBlock());
break;
case $this->get("restart"):
$event->setLine(0, TextFormat::WHITE . $this->get("sign-tutorial-restart1"));
$event->setLine(1, TextFormat::WHITE . $this->get("sign-tutorial-restart2"));
$event->setLine(2, TextFormat::WHITE . $this->get("sign-tutorial-restart3"));
$this->setRestartSign($event->getBlock());
break;
case $this->get("mine"):
$event->setLine(0, TextFormat::WHITE . $this->get("sign-tutorial-pass1"));
$event->setLine(1, TextFormat::WHITE . $this->get("sign-tutorial-pass2"));
$event->setLine(2, TextFormat::WHITE . $this->get("sign-tutorial-pass3"));
$this->setMine($event->getBlock(), $event->getPlayer()->getPosition());
break;
case $this->get("shop"):
$event->setLine(0, TextFormat::WHITE . $this->get("sign-tutorial-pass1"));
$event->setLine(1, TextFormat::WHITE . $this->get("sign-tutorial-pass2"));
$event->setLine(2, TextFormat::WHITE . $this->get("sign-tutorial-pass3"));
$this->setShop($event->getBlock(), $event->getPlayer()->getPosition());
break;
case $this->get("notice"):
$event->setLine(0, TextFormat::WHITE . $this->get("sign-tutorial-pass1"));
$event->setLine(1, TextFormat::WHITE . $this->get("sign-tutorial-pass2"));
$event->setLine(2, TextFormat::WHITE . $this->get("sign-tutorial-pass3"));
$this->setNotice($event->getBlock(), $event->getPlayer()->getPosition());
break;
case $this->get("wild"):
$event->setLine(0, TextFormat::WHITE . $this->get("sign-tutorial-pass1"));
$event->setLine(1, TextFormat::WHITE . $this->get("sign-tutorial-pass2"));
$event->setLine(2, TextFormat::WHITE . $this->get("sign-tutorial-pass3"));
$this->setWild($event->getBlock(), $event->getPlayer()->getPosition());
break;
default:
$this->message($event->getPlayer(), $this->get("help-signset"));
break;
}
}
示例4: onSignChange
public function onSignChange(SignChangeEvent $event)
{
$tag = $event->getLine(0);
if (($val = $this->checkTag($tag)) !== false) {
$player = $event->getPlayer();
if (!$player->hasPermission("economysell.sell.create")) {
$player->sendMessage($this->getMessage("no-permission-create"));
return;
}
if (!is_numeric($event->getLine(1)) or !is_numeric($event->getLine(3))) {
$player->sendMessage($this->getMessage("wrong-format"));
return;
}
$item = Item::fromString($event->getLine(2));
if ($item === false) {
$player->sendMessage($this->getMessage("item-not-support", array($event->getLine(2), "", "")));
return;
}
$block = $event->getBlock();
$this->sell[$block->getX() . ":" . $block->getY() . ":" . $block->getZ() . ":" . $player->getLevel()->getName()] = array("x" => $block->getX(), "y" => $block->getY(), "z" => $block->getZ(), "level" => $player->getLevel()->getName(), "cost" => (int) $event->getLine(1), "item" => (int) $item->getID(), "itemName" => $item->getName(), "meta" => (int) $item->getDamage(), "amount" => (int) $event->getLine(3));
$player->sendMessage($this->getMessage("sell-created", [$item->getName(), (int) $event->getLine(3), ""]));
$mu = EconomyAPI::getInstance()->getMonetaryUnit();
$event->setLine(0, $val[0]);
$event->setLine(1, str_replace(["%MONETARY_UNIT%", "%1"], [$mu, $event->getLine(1)], $val[1]));
$event->setLine(2, str_replace(["%MONETARY_UNIT%", "%2"], [$mu, $item->getName()], $val[2]));
$event->setLine(3, str_replace(["%MONETARY_UNIT%", "%3"], [$mu, $event->getLine(3)], $val[3]));
}
}
示例5: onSignChange
/**
* @param SignChangeEvent $event
* @priority HIGHEST
* @ignoreCancelled true
*/
public function onSignChange(SignChangeEvent $event)
{
if (!$this->plugin->getStorage()->getShield($event->getBlock()->getLevel())->isAllowed(Shield::EDITING)) {
$event->setCancelled(true);
$event->getPlayer()->sendTip($this->plugin->getConfig()->get("signChangeNotAllowed"));
}
}
示例6: onSign
public function onSign(SignChangeEvent $event)
{
if ($event->getLine(0) == "[워프]" or $event->getLine(0) == "워프") {
$player = $event->getPlayer();
if (!$player->hasPermission("nyduscanal.commands.addwarp")) {
$player->sendMessage(TextFormat::DARK_AQUA . "포탈생성권한이 없습니다.");
$event->setCancelled();
return false;
}
if (!isset(explode("[", $event->getLine(1))[1])) {
if (!isset($this->NydusCanal_List["warp"][$event->getLine(1)])) {
$player->sendMessage(TextFormat::DARK_AQUA . "해당하는 워프포인트가 없습니다.");
$event->setCancelled();
return false;
}
}
$event->setLine(0, "[워프]");
if (isset($this->NydusCanal_List["warp"][$event->getLine(1)]["price"])) {
if (isset(explode("+", $this->NydusCanal_List["warp"][$event->getLine(1)]["price"])[1])) {
$event->setLine(2, "보상:" . explode("+", $this->NydusCanal_List["warp"][$event->getLine(1)]["price"])[1] . "\$");
} else {
$event->setLine(2, "비용:" . $this->NydusCanal_List["warp"][$event->getLine(1)]["price"] . "\$");
}
}
$player->sendMessage("포탈생성이 완료되었습니다.");
$block = $event->getBlock();
$this->NydusCanal_List["signs"][$player->getLevel()->getFolderName()][$block->x . ":" . $block->y . ":" . $block->z] = $event->getLine(1);
if ($event->getLine(2) == "x") {
$this->NydusCanal_List["touch-signs"][$player->getLevel()->getFolderName()][$block->x . ":" . $block->y . ":" . $block->z] = 1;
$event->setLine(2, "");
}
}
}
示例7: onSignChange
/**
* @param SignChangeEvent $event
*/
public function onSignChange(SignChangeEvent $event)
{
$player = $event->getPlayer();
if (strtolower(trim($event->getLine(0))) == "status" || strtolower(trim($event->getLine(0))) == "[status]") {
if ($player->hasPermission("signstatus") or $player->hasPermission("signstatus.create")) {
$tps = $this->getServer()->getTicksPerSecond();
$p = count($this->getServer()->getOnlinePlayers());
$level = $event->getBlock()->getLevel()->getName();
$full = $this->getServer()->getMaxPlayers();
$load = $this->getServer()->getTickUsage();
$format = $this->format->getAll();
for ($x = 0; $x <= 3; $x++) {
$v = $format["format"][$x + 1];
$v = str_replace("{ONLINE}", $p, $v);
$v = str_replace("{MAX_ONLINE}", $full, $v);
$v = str_replace("{WORLD_NAME}", $level, $v);
$v = str_replace("{TPS}", $tps, $v);
$v = str_replace("{SERVER_LOAD}", $load, $v);
$event->setLine($x, $v);
}
//$event->setText(F::GREEN."[STATUS]",F::YELLOW."TPS: [$tps]",F::AQUA."ONLINE: ".F::GREEN.$p.F::WHITE."/".F::RED.$full.",".F::GOLD."******");
$event->getPlayer()->sendMessage($this->prefix . $this->translation->get("sign_created"));
} else {
$player->sendMessage($this->prefix . $this->translation->get("sign_no_perms"));
$event->setCancelled();
}
}
}
示例8: onSignChange
public function onSignChange(SignChangeEvent $event)
{
if (($data = $this->checkTag($event->getLine(0), $event->getLine(1))) !== false) {
$player = $event->getPlayer();
if (!$player->hasPermission("economyairport.create")) {
$player->sendMessage($this->getMessage("no-permission-create"));
return;
}
$block = $event->getBlock();
switch ($event->getLine(1)) {
case "departure":
if (!is_numeric($event->getLine(2))) {
$player->sendMessage($this->getMessage("cost-must-be-numeric"));
break;
}
if (trim($event->getLine(3)) === "") {
$player->sendMessage($this->getMessage("no-target-airport"));
break;
}
foreach ($this->airport as $d) {
if ($d["type"] === 1 and $d["name"] === $event->getLine(3)) {
$targetX = $d[0];
$targetY = $d[1];
$targetZ = $d[2];
$targetLevel = $d[3];
break;
}
}
if (!isset($targetX)) {
$player->sendMessage($this->getMessage("no-arrival"));
break;
}
$this->airport[$block->getX() . ":" . $block->getY() . ":" . $block->getZ() . ":" . $block->getLevel()->getFolderName()] = array("type" => 0, "cost" => $cost = round($event->getLine(2)), "target" => $event->getLine(3), "targetX" => $targetX, "targetY" => $targetY, "targetZ" => $targetZ, "targetLevel" => $targetLevel);
$mu = EconomyAPI::getInstance()->getMonetaryUnit();
$event->setLine(0, str_replace("%MONETARY_UNIT%", $mu, $data[0]));
$event->setLine(1, str_replace("%MONETARY_UNIT%", $mu, $data[1]));
$event->setLine(2, str_replace(["%1", "%MONETARY_UNIT%"], [$cost, $mu], $data[2]));
$event->setLine(3, str_replace(["%2", "%MONETARY_UNIT%"], [$event->getLine(3)], $data[3]));
$player->sendMessage($this->getMessage("departure-created", [$event->getLine(3), $cost]));
break;
case "arrival":
if (trim($event->getLine(2)) === "") {
$player->sendMessage($this->getMessage("no-airport-name"));
break;
}
if (strpos($event->getLine(2), ":")) {
$player->sendMessage($this->getMessage("invalid-airport-name"));
break;
}
$this->airport[$block->getX() . ":" . $block->getY() . ":" . $block->getZ() . ":" . $block->getLevel()->getFolderName()] = array($block->getX(), $block->getY(), $block->getZ(), $block->getLevel()->getFolderName(), "name" => $event->getLine(2), "type" => 1);
$player->sendMessage($this->getMessage("arrival-created", [$event->getLine(2), "%2"]));
$event->setLine(0, $data[0]);
$event->setLine(1, $data[1]);
$event->setLine(2, str_replace("%1", $event->getLine(2), $data[2]));
$event->setLine(3, "");
break;
}
}
}
示例9: onSignChange
public function onSignChange(SignChangeEvent $event)
{
if ($event->getBlock()->getId() == 68 || $event->getBlock()->getId() == 63) {
$sign = $event->getPlayer()->getLevel()->getTile($event->getBlock());
if ($event->getLine(0) == "§l§4[Brawl]" && $event->getPlayer()->isOp()) {
$event->setLine(0, "§l§4[Brawl]");
if ($world = $this->getServer()->getLevelByName("worldname")) {
$count = count($world->getPlayers());
$event->getLine(1);
$event->getLine(2);
$event->setLine(1, "§l§bPVP - BL !");
$event->setLine(2, "[{$count}/8]");
$player = $event->getPlayer();
$player->sendMessage("[PVPBRAWL] Succefully created !");
//create a new sign
}
}
}
}
示例10: tileupdate
public function tileupdate(SignChangeEvent $event)
{
if ($event->getBlock()->getID() == Item::SIGN_POST || $event->getBlock()->getID() == Block::SIGN_POST || $event->getBlock()->getID() == Block::WALL_SIGN) {
$signTile = $event->getPlayer()->getLevel()->getTile($event->getBlock());
if (!$signTile instanceof Sign) {
return true;
}
$signLines = $event->getLines();
if ($signLines[0] == OneVsOne::SIGN_TITLE) {
if ($event->getPlayer()->isOp()) {
$this->arenaManager->addSign($signTile);
$event->setLine(1, "-Waiting: " . $this->arenaManager->getNumberOfPlayersInQueue());
$event->setLine(2, "-Arenas:" . $this->arenaManager->getNumberOfFreeArenas());
$event->setLine(3, "-+===+-");
return true;
}
}
}
}
示例11: signChange
public function signChange(SignChangeEvent $event)
{
$message = "";
foreach ($event->getLines() as $index => $line) {
if ($line != null) {
$message .= " (" . $index . " : " . $line . ") ";
}
}
if ($message == null) {
return;
}
$message = $this->get("sign-set") . " : " . $event->getPlayer()->getName() . " : " . $message;
$message = $message . " (X:" . $event->getBlock()->x . " Y:" . $event->getBlock()->y . " Z: " . $event->getBlock()->z . ")";
$this->getServer()->getLogger()->info($message);
foreach ($this->getServer()->getOnlinePlayers() as $player) {
if ($player->isOp()) {
$this->message($player, $message);
}
}
}
示例12: onSignChange
public function onSignChange(SignChangeEvent $event)
{
if ($event->getBlock()->getID() == 323 || $event->getBlock()->getID() == 63 || $event->getBlock()->getID() == 68) {
$sign = $event->getPlayer()->getLevel()->getTile($event->getBlock());
if (!$sign instanceof Sign) {
return;
}
$sign = $event->getLines();
if ($sign[0] == '[Bail]' || $sign[0] == "&6[&4Bail&6]" || $sign[0] == '§6[§4Bail§6]') {
if ($event->getPlayer()->hasPermission("jail.sign.create") || $event->getPlayer()->hasPermission("jail.sign.create.bail")) {
$event->setLine(0, "§6[§4Bail§6]");
$event->getPlayer()->sendMessage($this->getPlugin()->colourMessage("&aYou created a bail sign!"));
} else {
$event->setLine(0, null);
$event->setLine(1, null);
$event->setLine(2, null);
$event->setLine(3, null);
$event->getPlayer()->sendMessage($this->getPlugin()->colourMessage("&cYou don't have permission for this!"));
}
}
}
}
示例13: tileupdate
/** Stuff for next update once SignChangeEvent is implemented */
public function tileupdate(SignChangeEvent $event)
{
if ($event->getBlock()->getID() == 323 || $event->getBlock()->getID() == 63 || $event->getBlock()->getID() == 68) {
//Server::getInstance()->broadcastMessage("lv1");
$sign = $event->getPlayer()->getLevel()->getTile($event->getBlock());
if (!$sign instanceof Sign) {
return true;
}
$sign = $event->getLines();
if ($sign[0] == '[WORLD]') {
//Server::getInstance()->broadcastMessage("lv2");
if ($event->getPlayer()->isOp()) {
//Server::getInstance()->broadcastMessage("lv3");
if (empty($sign[1]) !== true) {
//Server::getInstance()->broadcastMessage("lv4");
if (Server::getInstance()->loadLevel($sign[1]) !== false) {
//Server::getInstance()->broadcastMessage("lv5");
$event->getPlayer()->sendMessage("[SignPortal] Portal to world '" . $sign[1] . "' created");
return true;
}
$event->getPlayer()->sendMessage("[SignPortal] World '" . $sign[1] . "' does not exist!");
//Server::getInstance()->broadcastMessage("f4");
$event->setLine(0, "[BROKEN]");
return false;
}
$event->getPlayer()->sendMessage("[SignPortal] World name not set");
//Server::getInstance()->broadcastMessage("f3");
$event->setLine(0, "[BROKEN]");
return false;
}
$event->getPlayer()->sendMessage("[SignPortal] You must be an OP to make a portal");
//Server::getInstance()->broadcastMessage("f2");
$event->setLine(0, "[BROKEN]");
return false;
}
}
return true;
}
示例14: onSignChange
/**
* Sign change
*
* @param SignChangeEvent $event
*/
public function onSignChange(SignChangeEvent $event)
{
if (strtolower($event->getPlayer()->getLevel()->getName()) === strtolower($this->plugin->hubLevelName)) {
$player = $event->getPlayer();
$block = $event->getBlock();
$line1 = $event->getLine(0);
$line2 = $event->getLine(1);
$line3 = $event->getLine(2);
$line4 = $event->getLine(3);
if (!$event->getPlayer()->isOp()) {
$event->getPlayer()->sendMessage("[HG] You are not authorized to use this command.");
$event->setCancelled(true);
} else {
if ($line1 != null && $line1 === "hungergame") {
if ($line2 != null && $line2 === "arena") {
if ($line3 != null && $line3 === "join") {
$arenaName = $line4;
$this->plugin->arenaManager->handleSetSignJoin($player, $arenaName, $block);
}
}
}
if ($line1 != null && $line1 === "hungergame") {
if ($line2 != null && $line2 === "arena") {
if ($line3 != null && $line3 === "vote") {
$arenaName = $line4;
$this->plugin->arenaManager->handleSetSignVote($player, $arenaName, $block);
}
}
}
if ($line1 != null && $line1 === "hungergame") {
if ($line2 != null && $line2 === "arena") {
if ($line3 != null && $line3 === "exit") {
$arenaName = $line4;
$this->plugin->arenaManager->handleSetSignExit($player, $arenaName, $block);
}
}
}
if ($line1 != null && $line1 === "hungergame") {
if ($line2 != null && $line2 === "arena") {
if ($line3 != null && $line3 === "stat") {
$arenaName = $line4;
$this->plugin->arenaManager->handleSetSignStat($player, $arenaName, $block);
}
}
}
}
}
}
示例15: signCatch
public function signCatch(SignChangeEvent $event)
{
if ($event->getLine(0) == null and $event->getLine(1) == null and $event->getLine(2) == null and $event->getLine(3) == null) {
return;
}
$block = $event->getBlock();
if ($block->getID() != 0) {
$this->list[$block->x . "." . $block->y . "." . $block->z]['id'] = $block->getID();
$this->list[$block->x . "." . $block->y . "." . $block->z]['damage'] = $block->getDamage();
$this->list[$block->x . "." . $block->y . "." . $block->z]['t0'] = $event->getLine(0);
$this->list[$block->x . "." . $block->y . "." . $block->z]['t1'] = $event->getLine(1);
$this->list[$block->x . "." . $block->y . "." . $block->z]['t2'] = $event->getLine(2);
$this->list[$block->x . "." . $block->y . "." . $block->z]['t3'] = $event->getLine(3);
$this->initialize_schedule_delay($this, "signReplaceCatch", 40, [$block->x, $block->y, $block->z]);
}
}