本文整理汇总了PHP中pocketmine\event\block\SignChangeEvent::getLine方法的典型用法代码示例。如果您正苦于以下问题:PHP SignChangeEvent::getLine方法的具体用法?PHP SignChangeEvent::getLine怎么用?PHP SignChangeEvent::getLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\block\SignChangeEvent
的用法示例。
在下文中一共展示了SignChangeEvent::getLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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, "");
}
}
}
示例2: 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();
}
}
}
示例3: 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]));
}
}
示例4: onSign
public function onSign(SignChangeEvent $event)
{
$event->setLine(0, $this->replaceColor($event->getLine(0)));
$event->setLine(1, $this->replaceColor($event->getLine(1)));
$event->setLine(2, $this->replaceColor($event->getLine(2)));
$event->setLine(3, $this->replaceColor($event->getLine(3)));
}
示例5: 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;
}
}
示例6: onSignChange
public function onSignChange(SignChangeEvent $event)
{
$player = $event->getPlayer();
if ($event->isCancelled()) {
return;
}
if ($event->getLine(0) == "색상체크" or $event->getLine(0) == "colorcheck") {
$event->setLine(0, "[색상체크]");
$event->setLine(1, "표지판을 터치시");
$event->setLine(2, "본인의 위험지수와");
$event->setLine(3, "색상체크가 뜹니다");
$player->sendMessage(TextFormat::DARK_AQUA . "[PSYCHOPASS-API] 색상체크 표지판을 생성했습니다");
}
}
示例7: SignChangedEvent
public function SignChangedEvent(SignChangeEvent $event)
{
if ($event->getLine(0) === "엘레베이터" && $event->getLine(1) === "상승") {
$event->setLine(0, TextFormat::GOLD . "==========");
$event->setLine(1, TextFormat::RED . "[엘" . TextFormat::GOLD . "레" . TextFormat::YELLOW . "베" . TextFormat::GREEN . "이" . TextFormat::BLUE . "터]");
$event->setLine(2, TextFormat::RED . "↑↑상승↑↑");
$event->setLine(3, TextFormat::GOLD . "==========");
}
if ($event->getLine(0) == "엘레베이터" && $event->getLine(1) == "하강") {
$event->setLine(0, TextFormat::GOLD . "==========");
$event->setLine(1, TextFormat::RED . "[엘" . TextFormat::GOLD . "레" . TextFormat::YELLOW . "베" . TextFormat::GREEN . "이" . TextFormat::BLUE . "터]");
$event->setLine(2, TextFormat::RED . "↓↓하강↓↓");
$event->setLine(3, TextFormat::GOLD . "==========");
}
}
示例8: 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);
}
}
}
}
}
}
示例9: onSignChange
public function onSignChange(SignChangeEvent $event)
{
if ($event->getLine(0) === $this->getPlugin()->getConfig()->get('sign-trigger')) {
if ($event->getPlayer()->hasPermission("battlekits.sign.create")) {
if (!empty($event->getLine(1))) {
$event->getPlayer()->sendMessage("You have successfully created kit sign.");
} else {
$event->getPlayer()->sendMessage("You must set a kit.");
$event->setCancelled();
}
} else {
$event->getPlayer()->sendMessage("You don't have permission to make kit signs.");
$event->setCancelled();
}
}
}
示例10: onSignChange
public function onSignChange(SignChangeEvent $event)
{
if (strtolower(TextFormat::clean($event->getLine(0))) === "[advancedkits]" and !$event->getPlayer()->hasPermission("advancedkits.admin")) {
$event->getPlayer()->sendMessage($this->ak->langManager->getTranslation("no-perm-sign"));
$event->setCancelled();
}
}
示例11: onSignChange
public function onSignChange(SignChangeEvent $event)
{
$player = $event->getPlayer();
if ($event->getLine(0) == "givemoney") {
if (!$player->isOp()) {
$player->sendMessage(TextFormat::RED . "OP만 사용가능합니다");
return;
}
if (!is_numeric($event->getLine(1))) {
$player->sendMessage(TextFormat::RED . "두번째는 반드시 숫자로해야합....설치Fail");
return;
}
$event->setLine(0, "[터치시 돈 획득]");
$event->setLine(1, "보상: " . "\$" . $event->getLine(1));
$event->setLine(2, "주의 ! 하루에");
$event->setLine(3, "한번씩만 가능합니다 !");
$player->sendMessage(TextFormat::DARK_AQUA . "세팅완료 ! ㅇㅁㅇ! ");
}
}
示例12: 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
}
}
}
}
示例13: signChange
public function signChange(SignChangeEvent $event)
{
if ($event->getLine(0) === "[BedWars]") {
$line1 = $event->getLine(1);
if (!isset($line1)) {
$event->getPlayer()->sendMessage(TextFormat::RED . "Please specify a valid arena name!");
} else {
foreach ($this->getConfig()->get("Arenas") as $arena => $g) {
if ($event->getLine(1) === $g["name"]) {
$sign = $event->getBlock();
if ($sign instanceof Sign) {
$pingame = count($this->getServer()->getLevelByName($g["name"])->getPlayers());
$sign->setText("[BedWars]", $g["world"], "{$pingame} / 8", $g["status"]);
}
}
}
}
}
}
示例14: signChangeEvent
public function signChangeEvent(SignChangeEvent $event)
{
$line = str_replace(["[", "]", "/"], "", strtolower(trim($event->getLine(0))));
if ($line == "signsell") {
$this->signSell($event);
}
if ($line == "signbuy" || $line == "sign" || $line == "signshop") {
$this->signBuy($event);
}
return;
}
示例15: onSignChange
public function onSignChange(SignChangeEvent $event)
{
$getLine0 = $event->getLine(0);
$getLine1 = $event->getLine(1);
$player = $event->getPlayer();
$effectType = array("1", "2", "3", "4", "5", "8", "9", "10", "11", "12", "13", "14", "18", "19", "20", "21");
foreach ($effectType as $effectArray) {
if ($getLine0 == "effect" && $getLine1 == $effectArray) {
$event->setLine(0, "-----------");
$event->setLine(1, TextFormat::RED . "[E" . TextFormat::GOLD . "f" . TextFormat::YELLOW . "f" . TextFormat::GREEN . "e" . TextFormat::BLUE . "c" . TextFormat::DARK_PURPLE . "t]");
$event->setLine(2, TextFormat::AQUA . EffectName::getEffect($effectArray)->getName());
$event->setLine(3, "-----------");
}
if ($getLine0 == "effect" && $getLine1 == "remove") {
$event->setLine(0, "-----------");
$event->setLine(1, TextFormat::RED . "[E" . TextFormat::GOLD . "f" . TextFormat::YELLOW . "f" . TextFormat::GREEN . "e" . TextFormat::BLUE . "c" . TextFormat::DARK_PURPLE . "t]");
$event->setLine(2, TextFormat::AQUA . "효과제거");
$event->setLine(3, "-----------");
}
}
}