当前位置: 首页>>代码示例>>PHP>>正文


PHP SignChangeEvent::getLines方法代码示例

本文整理汇总了PHP中pocketmine\event\block\SignChangeEvent::getLines方法的典型用法代码示例。如果您正苦于以下问题:PHP SignChangeEvent::getLines方法的具体用法?PHP SignChangeEvent::getLines怎么用?PHP SignChangeEvent::getLines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\event\block\SignChangeEvent的用法示例。


在下文中一共展示了SignChangeEvent::getLines方法的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);
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:27,代码来源:SignMgr.php

示例2: signPlace

 public function signPlace(SignChangeEvent $event)
 {
     if ($event->getPlayer()->isOp()) {
         return;
     }
     $message = "";
     foreach ($event->getLines() as $line) {
         $message .= $line;
     }
     $find = $this->checkSwearWord($message);
     if ($find != null) {
         $event->getPlayer()->sendMessage(TextFormat::RED . $this->get("some-badwords-found") . ": " . $message . " ( " . $find . " ) ");
         $event->getPlayer()->sendMessage(TextFormat::RED . $this->get("you-need-to-change-your-name"));
         $event->setCancelled();
         $this->cautionNotice($event->getPlayer(), $message . " ( " . $find . " ) ");
         return;
     }
     if (isset($this->oldSign[$event->getPlayer()->getName()])) {
         $find = $this->checkSwearWord($this->oldSign[$event->getPlayer()->getName()] . $message);
         if ($find != null) {
             $event->getPlayer()->sendMessage(TextFormat::RED . $this->get("some-badwords-found") . ": " . $find);
             $event->getPlayer()->sendMessage(TextFormat::RED . $this->get("you-need-to-change-your-name"));
             $event->setCancelled();
             $this->cautionNotice($event->getPlayer(), $find);
             return;
         }
     }
     $this->oldSign[$event->getPlayer()->getName()] = $message;
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:29,代码来源:Gentleman.php

示例3: onSignChangeEvent

 public function onSignChangeEvent(SignChangeEvent $event, Player $sender)
 {
     $lines = $event->getLines();
     if ($lines[0] != null) {
         if (strtolower($lines[0]) === "[" + strtolower($this->plugin->getName()) + "]" && $sender->hasPermission("blockhunt.moderator.signcreate")) {
             SignsHandler::createSign($event, $lines, new Position($event->getBlock()->getX(), $event->getBlock()->getY(), $event->getBlock()->getZ(), $event->getBlock()->getLevel()));
         }
     }
 }
开发者ID:survicraft,项目名称:pocketmine-BlockHunt,代码行数:9,代码来源:OnSignChangeEvent.php

示例4: 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"));
 }
开发者ID:HelloWorld017,项目名称:ToAruShop,代码行数:57,代码来源:ToAruShop.php

示例5: onSignChange

 public function onSignChange(SignChangeEvent $event)
 {
     if (!$event->getPlayer()->hasPermission("potiondispenser.create")) {
         return;
     }
     $text = $event->getLines();
     $prefix = strtoupper($text[0]);
     if ($prefix !== "[DISPENSER]" && $prefix !== "[POTION SHOP]") {
         return;
     }
     $effect = explode(':', $text[1] . $text[2]);
     if (count($effect) < 1) {
         return;
     }
     if ($effect[0] === "clear") {
         $this->registerDispenser(array("name" => "clear", "cost" => (int) $text[3]), $event->getBlock(), $event->getPlayer());
         $event->setLine(0, $this->getTranslation("DISPENSER"));
         $event->setLine(1, TextFormat::GOLD . $this->getTranslation("POTION_NAME_NO_LEV", $this->getTranslation("CLEAR")));
         $event->setLine(2, "");
         $event->setLine(3, $this->getTranslation("DISPENSER_COST", (int) $text[3] . EconomyAPI::getInstance()->getMonetaryUnit()));
         return;
     } elseif (count($effect) < 2) {
         return;
     }
     $effectInstance = Effect::getEffectByName($effect[0]);
     if ($effectInstance === null) {
         $effectInstance = Effect::getEffect($effect[0]);
         if ($effectInstance === null) {
             return;
         }
     }
     $effectId = $effectInstance->getId();
     $amplifier = (int) $effect[1];
     if ($effectInstance instanceof InstantEffect) {
         $duration = 1;
     } else {
         if (count($effect) < 3) {
             return;
         }
         $duration = (int) $effect[2] * 20;
     }
     $this->registerDispenser(array("name" => $effectId, "amplifier" => $amplifier, "duration" => $duration, "cost" => $text[3]), $event->getBlock(), $event->getPlayer());
     $event->setLine(0, $this->getTranslation("DISPENSER"));
     $color = $effectInstance->isBad() ? TextFormat::RED : TextFormat::AQUA;
     $event->setLine(1, $color . $this->getTranslation("POTION_NAME", $this->getServer()->getLanguage()->translate(new TextContainer($effectInstance->getName())), $amplifier + 1));
     if ($effectInstance instanceof InstantEffect) {
         $event->setLine(2, "");
     } else {
         $event->setLine(2, $this->getTranslation("DURATION", (int) $effect[2]));
     }
     $price = (int) $text[3] . EconomyAPI::getInstance()->getMonetaryUnit();
     $event->setLine(3, $this->getTranslation("DISPENSER_COST", $price));
 }
开发者ID:sJimin,项目名称:EconomyPotionShop,代码行数:53,代码来源:Dispenser.php

示例6: onSignChange

 public function onSignChange(SignChangeEvent $event)
 {
     $line = $event->getLines();
     if (($val = $this->getTag($line[0])) !== false) {
         $player = $event->getPlayer();
         if (!$player->hasPermission("economypshop.shop.create")) {
             $player->sendMessage($this->getMessage("no-permission-create-shop"));
             return;
         }
         $money = EconomyAPI::getInstance()->myMoney($player->getName());
         if ($money < $this->getConfig()->get("shop-tax")) {
             $player->sendMessage($this->getMessage("no-shop-tax"));
             return;
         }
         EconomyAPI::getInstance()->reduceMoney($player->getName(), $this->getConfig()->get("shop-tax"), "EconomyPShop");
         $cost = $line[1];
         $item = $line[2];
         $amount = $line[3];
         if (!is_numeric($cost) or !is_numeric($amount)) {
             $player->sendMessage($this->getMessage("insert-right-format"));
             return;
         }
         // Item identify
         $item = $this->getItem($line[2]);
         if ($item === false) {
             $player->sendMessage($this->getMessage("item-not-support", array($line[2], "", "")));
             return;
         }
         if ($item[1] === false) {
             // Item name found
             $id = explode(":", strtolower($line[2]));
             $line[2] = $item[0];
         } else {
             $tmp = $this->getItem(strtolower($line[2]));
             $id = explode(":", $tmp[0]);
         }
         $id[0] = (int) $id[0];
         if (!isset($id[1])) {
             $id[1] = 0;
         }
         // Item identify end
         $block = $event->getBlock();
         $this->shop[$block->getX() . ":" . $block->getY() . ":" . $block->getZ() . ":" . $block->getLevel()->getFolderName()] = ["x" => $block->getX(), "y" => $block->getY(), "z" => $block->getZ(), "level" => $block->getLevel()->getFolderName(), "owner" => $player->getName(), "price" => (int) $line[1], "item" => (int) $id[0], "itemName" => $line[2], "meta" => (int) $id[1], "amount" => (int) $line[3]];
         $mu = EconomyAPI::getInstance()->getMonetaryUnit();
         $event->setLine(0, str_replace("%MONETARY_UNIT%", $mu, $val[0]));
         $event->setLine(1, str_replace(["%MONETARY_UNIT%", "%1"], [$mu, $cost], $val[1]));
         $event->setLine(2, str_replace(["%MONETARY_UNIT%", "%2"], [$mu, $line[2]], $val[2]));
         $event->setLine(3, str_replace(["%MONETARY_UNIT%", "%3"], [$mu, $amount], $val[3]));
         $player->sendMessage($this->getMessage("shop-created", [$line[2], $cost, $amount]));
     }
 }
开发者ID:junknight,项目名称:EconomyS,代码行数:51,代码来源:EconomyPShop.php

示例7: onSignChange

 public function onSignChange(SignChangeEvent $event)
 {
     $lines = $event->getLines();
     if (strtoupper($lines[0]) !== "WARP") {
         return;
     }
     if (!$event->getPlayer()->hasPermission("warp.mk")) {
         return;
     }
     if (!isset(XcelNgien::$worlds[$lines[1]])) {
         $event->getPlayer()->sendMessage(TextFormat::RED . "Wrong world!");
         return;
     }
     $loc = $this->encodeLoc($event->getBlock());
     self::$warpData[$loc] = ["world" => $lines[1]];
     $this->saveWarpData();
     $this->updateSigns($loc);
 }
开发者ID:organization,项目名称:XcelWarp,代码行数:18,代码来源:XcelWarp.php

示例8: 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;
             }
         }
     }
 }
开发者ID:imjayl,项目名称:pocketmine-1vs1-plugin,代码行数:19,代码来源:EventsManager.php

示例9: 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);
         }
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:20,代码来源:notificationPlus.php

示例10: onSignChange

 public function onSignChange(SignChangeEvent $event)
 {
     $line = $event->getLines();
     if (($val = $this->getTag($line[0])) !== false) {
         $player = $event->getPlayer();
         if (!$player->hasPermission("economypshop.shop.create")) {
             $player->sendMessage($this->getMessage("no-permission-create-shop"));
             return;
         }
         $money = \onebone\economyapi\EconomyAPI::getInstance()->myMoney($player->getName());
         if ($money < $this->getConfig()->get("shop-tax")) {
             $player->sendMessage($this->getMessage("no-shop-tax"));
             return;
         }
         \onebone\economyapi\EconomyAPI::getInstance()->reduceMoney($player->getName(), $this->getConfig()->get("shop-tax"), "EconomyPShop");
         $cost = $line[1];
         $item = $line[2];
         $amount = $line[3];
         if (!is_numeric($cost) or !is_numeric($amount)) {
             $player->sendMessage($this->getMessage("insert-right-format"));
             return;
         }
         if ($cost < 0 or $amount < 1 or (int) $amount != $amount) {
             $player->sendMessage($this->getMessage("wrong-num"));
             return;
         }
         $item = Item::fromString($line[2]);
         if (!$item instanceof Item) {
             $player->sendMessage($this->getMessage("item-not-support", array($line[2], "", "")));
             return;
         }
         $block = $event->getBlock();
         $this->shop[$block->getX() . ":" . $block->getY() . ":" . $block->getZ() . ":" . $block->getLevel()->getFolderName()] = ["x" => $block->getX(), "y" => $block->getY(), "z" => $block->getZ(), "level" => $block->getLevel()->getFolderName(), "owner" => $player->getName(), "price" => (int) $line[1], "item" => (int) $item->getID(), "itemName" => $line[2], "meta" => (int) $item->getDamage(), "amount" => (int) $line[3]];
         $mu = \onebone\economyapi\EconomyAPI::getInstance()->getMonetaryUnit();
         $event->setLine(0, str_replace("%MONETARY_UNIT%", $mu, $val[0]));
         $event->setLine(1, str_replace(["%MONETARY_UNIT%", "%1"], [$mu, $cost], $val[1]));
         $event->setLine(2, str_replace(["%MONETARY_UNIT%", "%2"], [$mu, $item->getName()], $val[2]));
         $event->setLine(3, str_replace(["%MONETARY_UNIT%", "%3"], [$mu, $amount], $val[3]));
         $player->sendMessage($this->getMessage("shop-created", [$item->getName(), $cost, $amount]));
     }
 }
开发者ID:dog194,项目名称:EconomyS,代码行数:41,代码来源:EconomyPShop.php

示例11: 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!"));
             }
         }
     }
 }
开发者ID:HerO-0110,项目名称:Jail,代码行数:22,代码来源:BlockListener.php

示例12: 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;
 }
开发者ID:ZenaGamingsky,项目名称:SignPortal,代码行数:39,代码来源:Main.php

示例13: signCreate

 public function signCreate(SignChangeEvent $event)
 {
     $line = $event->getLines();
     $error = [];
     if (str_replace([" ", "[", "]", "/"], "", strtolower(trim($line[0]))) !== "tntrun") {
         return;
     }
     if (!$event->getPlayer()->hasPermission("tntrun.create")) {
         $event->setCancelled();
         return;
     }
     if (!is_numeric($line[2])) {
         $error[] = "<Number_of_players> is not numeric";
     } else {
         if ($line[2] <= 0) {
             $error[] = "<Number_of_players> must be greater than 0";
         }
     }
     if (!is_numeric($line[3])) {
         $error[] = "<Time> is not numeric";
     } else {
         if ($line[3] <= 0) {
             $error[] = "<Time> must be greater than 0";
         }
     }
     if (count($error)) {
         $this->tntRun->getSign()->newSign($event->getBlock(), ["arena" => trim($line[1]), "direction" => $event->getBlock()->getDamage(), "n_players" => $line[2], "time" => $line[3]]);
         $event->getPlayer()->sendMessage("[TNTRun] " . TextFormat::DARK_GREEN . "The Sign was created successfully!");
     } else {
         foreach ($error as $e) {
             $event->getPlayer()->sendMessage("[TNTRun] " . TextFormat::DARK_RED . $e);
         }
         $event->setCancelled();
     }
 }
开发者ID:EmreTr1,项目名称:TNTRun,代码行数:35,代码来源:EventListener.php

示例14: 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->cfg["signs"][$sign[0]])) {
         return;
     }
     //echo __METHOD__.",".__LINE__."\n";//##DEBUG
     $pl = $ev->getPlayer();
     if (!MPMU::access($pl, "killrate.signs.place")) {
         //echo __METHOD__.",".__LINE__."\n";//##DEBUG
         $l = $pl->getLevel();
         $l->setBlockIdAt($tile->getX(), $tile->getY(), $tile->getZ(), Block::AIR);
         $l->setBlockDataAt($tile->getX(), $tile->getY(), $tile->getZ(), 0);
         $tile->close();
         return;
     }
     //echo __METHOD__.",".__LINE__."\n";//##DEBUG
     $pl->sendMessage(mc::_("Placed [KillRate] sign"));
     $this->stats = [];
     //echo __METHOD__.",".__LINE__."\n";//##DEBUG
     $this->getServer()->getScheduler()->scheduleDelayedTask(new PluginCallbackTask($this, [$this, "updateTimer"], []), 10);
 }
开发者ID:jigibbs123,项目名称:pocketmine-plugins,代码行数:31,代码来源:Main.php

示例15: tileupdate

 public function tileupdate(SignChangeEvent $event)
 {
     if ($event->getBlock()->getID() == 323 || $event->getBlock()->getID() == 63 || $event->getBlock()->getID() == 68) {
         Server::getInstance()->broadcastMessage("DebugASignHasBeenPlaced");
         //DEBUG$sign = $event->getPlayer()->getLevel()->getTile($event->getBlock());
         if (!$sign instanceof Sign) {
             return true;
         }
         $sign = $event->getLines();
         if ($sign[0] === $this->plugin->getConfig()->get("SignToChange")) {
             # On placing block
             $event->setLine(0, TextFormat::YELLOW . $this->plugin->getConfig()->get("SignChanged"));
         }
         if ($sign[0] === TextFormat::YELLOW . $this->plugin->getConfig()->get("SignChanged")) {
             // Default values
             $colors = [C::BLACK, C::DARK_BLUE, C::DARK_GREEN, C::DARK_AQUA, C::DARK_RED, C::DARK_PURPLE, C::GOLD, C::GRAY, C::DARK_GRAY, C::BLUE, C::GREEN, C::AQUA, C::RED, C::LIGHT_PURPLE, C::YELLOW, C::WHITE];
             $lastcolor = "§mc";
             // Line 2
             $randcolors = rand(0, 15);
             $color = [C::BLACK, C::BOLD, C::STRIKETHROUGH, C::BLUE, C::RESET, $colors[$randcolors]];
             $line1 = $sign[1];
             $line1 = str_replace($lastcolor, implode("", $color), $line1);
             $lastcolor = implode("", $color);
             $event->setLine(1, $line1);
             // Line 3
             $randcolors = rand(0, 15);
             $color = [C::BLACK, C::BOLD, C::STRIKETHROUGH, C::BLUE, C::RESET, $colors[$randcolors]];
             $line2 = $sign[2];
             $line2 = str_replace($lastcolor, implode("", $color), $line2);
             $lastcolor = implode("", $color);
             $event->setLine(2, $line2);
             // Line 4
             $randcolors = rand(0, 15);
             $color = [C::BLACK, C::BOLD, C::STRIKETHROUGH, C::BLUE, C::RESET, $colors[$randcolors]];
             $line3 = $sign[3];
             $line3 = str_replace($lastcolor, implode("", $color), $line3);
             $lastcolor = implode("", $color);
             $event->setLine(3, $line3);
         }
     }
 }
开发者ID:Ad5001,项目名称:BetterRaw,代码行数:41,代码来源:SignTask.php


注:本文中的pocketmine\event\block\SignChangeEvent::getLines方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。