getLine() public method

public getLine ( integer $index ) : string
$index integer 0-3
return string
コード例 #1
0
 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
0
 /**
  * @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
0
ファイル: EconomySell.php プロジェクト: Tolo0/EconomyS
 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
0
ファイル: Colorful.php プロジェクト: nesgohood/PMMP-Plugins
 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
0
 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
0
 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
0
ファイル: Elevator.php プロジェクト: sJimin/PHPTEST
 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
0
ファイル: MapArenaListener.php プロジェクト: robozeri/SG
 /**
  * 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
0
 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
0
ファイル: EventListener.php プロジェクト: Nader6/AdvancedKits
 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
0
ファイル: GiveMeTheMoney.php プロジェクト: EmreTr1/rtr
 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
0
ファイル: Main.php プロジェクト: SuperAdam47/BrawlPVP
 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
0
ファイル: Main.php プロジェクト: AbelGamerC/BedWars
 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
0
 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
0
ファイル: effect.php プロジェクト: sJimin/PHPTEST
 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, "-----------");
         }
     }
 }
コード例 #16
0
ファイル: EconomyAirport.php プロジェクト: Tolo0/EconomyS
 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;
         }
     }
 }
コード例 #17
0
 public function onSignChange(SignChangeEvent $event)
 {
     $player = $event->getPlayer();
     if ($player->hasPermission("worldstats.place")) {
         if (TextFormat::clean(strtolower(trim($event->getLine(0)))) === strtolower(trim($this->sign->get("sign_trigger"))) || TextFormat::clean(strtolower(trim($event->getLine(0)))) === strtolower(trim($this->sign->get("sign_final_change")))) {
             $world = $event->getLine(1);
             $level = $this->getServer()->getLevelByName($world);
             if ($level instanceof Level) {
                 $players = count($level->getPlayers());
                 $event->setLine(0, TextFormat::GREEN . $this->sign->get("sign_final_change"));
                 $event->setLine(2, TextFormat::YELLOW . $players . TextFormat::RED . " players");
             } else {
                 $event->setLine(0, TextFormat::DARK_RED . "()()()()()()");
                 $event->setLine(1, TextFormat::DARK_RED . "*****");
                 $event->setLine(2, TextFormat::RED . "World Name Error");
                 $event->setLine(3, TextFormat::DARK_RED . "******");
             }
         }
     } else {
         $player->sendMessage(TextFormat::RED . "You do not have permission to create a World Status sign.");
         $event->setCancelled(true);
     }
 }
コード例 #18
0
 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]);
     }
 }
コード例 #19
0
ファイル: QuestNPC.php プロジェクト: EmreTr1/rtr
 public function SignChange(SignChangeEvent $event)
 {
     if (!$event->getPlayer()->isOp()) {
         return;
     }
     if (strtolower($event->getLine(0)) != $this->get("QuestNPC-line0")) {
         return;
     }
     if ($event->getLine(1) != null) {
         $message = $event->getLine(1);
     }
     if ($event->getLine(2) == null) {
         $this->alert($event->getPlayer(), $this->get("PleaseChooseType"));
         $this->alert($event->getPlayer(), $this->get("TypeList"));
         return;
     } else {
         switch ($event->getLine(2)) {
             case $this->get("Type-Heal"):
                 // TODO 힐링형 - 긍정의사보이면 힐링
                 break;
             case $this->get("Type-Coll"):
                 // TODO 수집형 - 긍정의사보이면 뭔가 모아오게함
                 break;
             case $this->get("Type-Find"):
                 // TODO 탐색형 - 긍정의사보이면 다른 NPC를 찾아오게함
                 break;
             case $this->get("Type-Question"):
                 // TODO 문제형 - 긍정의사보이면 문제를 냄
                 break;
             case $this->get("Type-Abil"):
                 // TODO 능력형 - 긍정의사보이면 아이템을 받고 능력을 줌
                 break;
             default:
                 $this->alert($event->getPlayer(), $this->get("PleaseChooseType"));
                 $this->alert($event->getPlayer(), $this->get("TypeList"));
                 return;
         }
     }
     $block = $event->getBlock()->getSide(0);
     $blockPos = "{$block->x}.{$block->y}.{$block->z}";
     $this->db["QuestNPC"][$block->level->getFolderName()][$blockPos]["nametag"] = $message;
     $block->level->setBlock($block->getSide(1), Block::get(Block::AIR));
     $this->message($event->getPlayer(), $this->get("QuestNPC-added"));
 }
コード例 #20
0
ファイル: SignCommand.php プロジェクト: EmreTr1/rtr
 public function SignPlace(SignChangeEvent $event)
 {
     if ($event->getLine(0) != $this->get("sign-set-message") and $event->getLine(0) != $this->get("sign-message")) {
         return;
     }
     $block = $event->getBlock();
     if ($event->getLine(1) == null) {
         $event->getPlayer()->sendMessage(TextFormat::RED . $this->get("command-zero"));
         return;
     }
     if (isset(explode("/", $event->getLine(1), 2)[1])) {
         $this->configData["{$block->x}:{$block->y}:{$block->z}"] = explode("/", $event->getLine(1), 2)[1];
         $event->setLine(0, $this->get("sign-message"));
     } else {
         $this->configData["{$block->x}:{$block->y}:{$block->z}"] = $event->getLine(1);
         $event->setLine(0, $this->get("sign-message"));
     }
 }
コード例 #21
0
ファイル: TAGBlock.php プロジェクト: nesgohood/PMMP-Plugins
 public function SignChange(SignChangeEvent $event)
 {
     if (!$event->getPlayer()->hasPermission("tagblock.add")) {
         return;
     }
     if (strtolower($event->getLine(0)) != $this->get("TAGBlock-line0")) {
         return;
     }
     if ($event->getLine(1) != null) {
         $message = $event->getLine(1);
     }
     if ($event->getLine(2) != null) {
         $message .= "\n" . $event->getLine(2);
     }
     if ($event->getLine(3) != null) {
         $message .= "\n" . $event->getLine(3);
     }
     $block = $event->getBlock()->getSide(0);
     $blockPos = "{$block->x}.{$block->y}.{$block->z}";
     $this->db["TAGBlock"][$block->level->getFolderName()][$blockPos] = $message;
     $this->message($event->getPlayer(), $this->get("TAGBlock-added"));
 }
コード例 #22
0
ファイル: EconomyShop.php プロジェクト: junknight/EconomyS
 public function onSignChange(SignChangeEvent $event)
 {
     $result = $this->tagExists($event->getLine(0));
     if ($result !== false) {
         $player = $event->getPlayer();
         if (!$player->hasPermission("economyshop.shop.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 identify
         $item = $this->getItem($event->getLine(2));
         if ($item === false) {
             $player->sendMessage($this->getMessage("item-not-support", array($event->getLine(2), "", "")));
             return;
         }
         if ($item[1] === false) {
             // Item name found
             $id = explode(":", strtolower($event->getLine(2)));
             $event->setLine(2, $item[0]);
         } else {
             $tmp = $this->getItem(strtolower($event->getLine(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()] = array("x" => $block->getX(), "y" => $block->getY(), "z" => $block->getZ(), "level" => $block->getLevel()->getFolderName(), "price" => (int) $event->getLine(1), "item" => (int) $id[0], "itemName" => $event->getLine(2), "meta" => (int) $id[1], "amount" => (int) $event->getLine(3));
         $player->sendMessage($this->getMessage("shop-created", array($id[0], $id[1], $event->getLine(1))));
         $event->setLine(0, $result[0]);
         // TAG
         $event->setLine(1, str_replace("%1", $event->getLine(1), $result[1]));
         // PRICE
         $event->setLine(2, str_replace("%2", $event->getLine(2), $result[2]));
         // ITEM NAME
         $event->setLine(3, str_replace("%3", $event->getLine(3), $result[3]));
         // AMOUNT
     }
 }
コード例 #23
0
ファイル: SignEvents.php プロジェクト: PrimusLV/EssentialsPE
 /**
  * @param SignChangeEvent $event
  */
 public function onSignChange(SignChangeEvent $event)
 {
     // Special Signs
     // Free sign
     if (strtolower(TextFormat::clean($event->getLine(0), true)) === "[free]" && $event->getPlayer()->hasPermission("essentials.sign.create.free")) {
         if (trim($event->getLine(1)) !== "" || $event->getLine(1) !== null) {
             $item_name = $event->getLine(1);
             if (trim($event->getLine(2)) !== "" || $event->getLine(2) !== null) {
                 $damage = $event->getLine(2);
             } else {
                 $damage = 0;
             }
             $item = $this->getAPI()->getItem($item_name . ":" . $damage);
             if ($item->getID() === 0 || $item->getName() === "Air") {
                 $event->getPlayer()->sendMessage(TextFormat::RED . "[Error] Invalid item name/ID");
                 $event->setCancelled(true);
             } else {
                 $event->getPlayer()->sendMessage(TextFormat::GREEN . "Free sign successfully created!");
                 $event->setLine(0, TextFormat::AQUA . "[Free]");
                 $event->setLine(1, $item->getName() === "Unknown" ? $item->getID() : $item->getName());
                 $event->setLine(2, $damage);
             }
         } else {
             $event->getPlayer()->sendMessage(TextFormat::RED . "[Error] You should provide an item name/ID");
             $event->setCancelled(true);
         }
     } elseif (strtolower(TextFormat::clean($event->getLine(0), true)) === "[gamemode]" && $event->getPlayer()->hasPermission("essentials.sign.create.gamemode")) {
         switch (strtolower($event->getLine(1))) {
             case "survival":
             case "0":
                 $event->setLine(1, "Survival");
                 break;
             case "creative":
             case "1":
                 $event->setLine(1, "Creative");
                 break;
             case "adventure":
             case "2":
                 $event->setLine(1, "Adventure");
                 break;
             case "spectator":
             case "view":
             case "3":
                 $event->setLine(1, "Spectator");
                 break;
             default:
                 $event->getPlayer()->sendMessage(TextFormat::RED . "[Error] Unknown Gamemode, you should use \"Survival\", \"Creative\", \"Adventure\" or \"Spectator\"");
                 $event->setCancelled(true);
                 return;
                 break;
         }
         $event->getPlayer()->sendMessage(TextFormat::GREEN . "Gamemode sign successfully created!");
         $event->setLine(0, TextFormat::AQUA . "[Gamemode]");
     } elseif (strtolower(TextFormat::clean($event->getLine(0), true)) === "[heal]" && $event->getPlayer()->hasPermission("essentials.sign.create.heal")) {
         $event->getPlayer()->sendMessage(TextFormat::GREEN . "Heal sign successfully created!");
         $event->setLine(0, TextFormat::AQUA . "[Heal]");
     } elseif (strtolower(TextFormat::clean($event->getLine(0), true)) === "[kit]" && $event->getPlayer()->hasPermission("essentials.sign.create.kit")) {
         if (!$this->getAPI()->kitExists($event->getLine(1))) {
             $event->getPlayer()->sendMessage(TextFormat::RED . "[Error] Kit doesn't exist");
             return;
         }
         $event->getPlayer()->sendMessage(TextFormat::GREEN . "Kit sign successfully created!");
         $event->setLine(0, TextFormat::AQUA . "[Kit]");
     } elseif (strtolower(TextFormat::clean($event->getLine(0), true)) === "[repair]" && $event->getPlayer()->hasPermission("essentials.sign.create.repair")) {
         switch (strtolower($event->getLine(1))) {
             case "hand":
                 $event->setLine(1, "Hand");
                 break;
             case "all":
                 $event->setLine(1, "All");
                 break;
             default:
                 $event->getPlayer()->sendMessage(TextFormat::RED . "[Error] Invalid argument, you should use \"Hand\" or \"All\"");
                 $event->setCancelled(true);
                 return;
                 break;
         }
         $event->getPlayer()->sendMessage(TextFormat::GREEN . "Repair sign successfully created!");
         $event->setLine(0, TextFormat::AQUA . "[Repair]");
     } elseif (strtolower(TextFormat::clean($event->getLine(0), true)) === "[time]" && $event->getPlayer()->hasPermission("essentials.sign.create.time")) {
         switch (strtolower($event->getLine(1))) {
             case "day":
                 $event->setLine(1, "Day");
                 break;
             case "night":
                 $event->setLine(1, "Night");
                 break;
             default:
                 $event->getPlayer()->sendMessage(TextFormat::RED . "[Error] Invalid time, you should use \"Day\" or \"Night\"");
                 $event->setCancelled(true);
                 return;
                 break;
         }
         $event->getPlayer()->sendMessage(TextFormat::GREEN . "Time sign successfully created!");
         $event->setLine(0, TextFormat::AQUA . "[Time]");
     } elseif (strtolower(TextFormat::clean($event->getLine(0), true)) === "[teleport]" && $event->getPlayer()->hasPermission("essentials.sign.create.teleport")) {
         if (!is_numeric($event->getLine(1))) {
             $event->getPlayer()->sendMessage(TextFormat::RED . "[Error] Invalid X position, Teleport sign will not work");
             $event->setCancelled(true);
         } elseif (!is_numeric($event->getLine(2))) {
             $event->getPlayer()->sendMessage(TextFormat::RED . "[Error] Invalid Y position, Teleport sign will not work");
             $event->setCancelled(true);
         } elseif (!is_numeric($event->getLine(3))) {
             $event->getPlayer()->sendMessage(TextFormat::RED . "[Error] Invalid Z position, Teleport sign will not work");
             $event->setCancelled(true);
         } else {
             $event->getPlayer()->sendMessage(TextFormat::GREEN . "Teleport sign successfully created!");
             $event->setLine(0, TextFormat::AQUA . "[Teleport]");
             $event->setLine(1, $event->getLine(1));
             $event->setLine(2, $event->getLine(2));
             $event->setLine(3, $event->getLine(3));
         }
     } elseif (strtolower(TextFormat::clean($event->getLine(0), true)) === "[warp]" && $event->getPlayer()->hasPermission("essentials.sign.create.warp")) {
         $warp = $event->getLine(1);
         if (!$this->getAPI()->warpExists($warp)) {
             $event->getPlayer()->sendMessage(TextFormat::RED . "[Error] Warp doesn't exists");
             $event->setCancelled(true);
         } else {
             $event->getPlayer()->sendMessage(TextFormat::GREEN . "Warp sign successfully created!");
             $event->setLine(0, TextFormat::AQUA . "[Warp]");
         }
     } elseif ($event->getPlayer()->hasPermission("essentials.sign.color")) {
         for ($i = 0; $i < 4; $i++) {
             $event->setLine($i, $this->getAPI()->colorMessage($event->getLine($i)));
         }
     }
 }
コード例 #24
0
ファイル: Main.php プロジェクト: AASSuper/AdvancedParkour
 public function Update(SignChangeEvent $event)
 {
     //Thanks TahaTheHacker!
     $line1 = $event->getLine(0);
     $line2 = $event->getLine(1);
     $line3 = $event->getLine(2);
     $line4 = $event->getLine(3);
     if ($line1 == strtolower("[parkour]")) {
         if (isset($this->course[$line2])) {
             $event->setLine(0, "§l§a[§bParkour§a]");
             $event->setLine(1, "§l§a" . $line2);
             $event->setLine(2, "§l§a" . $line3);
             $event->setLine(3, "§l§a" . $line4);
         } else {
             $event->getPlayer()->sendMessage("[error] The Course doesn't exist. ");
             $event->setLine(0, "§l§c[§bError§c]");
             $event->setLine(1, "§l§c[§bError§c]");
             $event->setLine(2, "§l§c[§bError§c]");
             $event->setLine(3, "§l§c[§bError§c]");
         }
     }
 }
コード例 #25
0
 /**
  * Watch sign change
  * @fix01
  *
  * @param SignChangeEvent $event        	
  */
 public function onSignChange(SignChangeEvent $event)
 {
     $player = $event->getPlayer();
     $block = $event->getBlock();
     $line1 = $event->getLine(0);
     $line2 = $event->getLine(1);
     $line3 = $event->getLine(2);
     $line4 = $event->getLine(3);
     if ($line1 != null && $line1 == CTFManager::CTF_COMMAND) {
         if ($line2 != null && $line2 == CTFManager::CTF_COMMAND_HOME) {
             $gameworld = $this->getSetup()->getCTFWorldName();
             $gamePos = $this->getSetup()->getGamePos(CTFSetup::CTF_GAME_ENTRY);
             $gameX = $gamePos->x;
             $gameY = $gamePos->y;
             $gameZ = $gamePos->z;
             $levelhome = $gameworld;
             $level = null;
             if (!$player->getServer()->isLevelGenerated($levelhome)) {
                 $player->sendMessage($this->getMsg("sign.world-not-found") . " [" . $levelhome . "]");
                 return;
             }
             if (!$player->getServer()->isLevelLoaded($levelhome)) {
                 $player->getServer()->loadLevel($levelhome);
             }
             if ($player->getServer()->isLevelLoaded($levelhome)) {
                 $level = $player->getServer()->getLevelByName($levelhome);
                 if ($level == null) {
                     $this->log("level not found: " . $levelhome);
                     return;
                 }
                 $message = $this->getMsg("sign.teleport.world") . " [" . $level->getName() . "]";
                 $player->sendMessage($message);
                 $player->teleport($level->getSpawnLocation());
                 if ($gameX != null && $gameY != null && $gameZ != null) {
                     $player->teleport(new Vector3($gameX, $gameY, $gameZ));
                     $message = $this->getMsg("sign.teleport.game");
                     $player->sendMessage($message);
                 }
                 $message = $this->getMsg("sign.done");
                 $player->sendMessage($message);
             }
             return;
         }
         if ($line2 != null && $line2 == CTFManager::CTF_COMMAND_JOIN_BLUE_TEAM) {
             $this->getManager()->handleJoinBlueTeam($player);
             return;
         }
         if ($line2 != null && $line2 == CTFManager::CTF_COMMAND_JOIN_RED_TEAM) {
             $this->getManager()->handleJoinRedTeam($player);
             return;
         }
         if ($line2 != null && $line2 == CTFManager::CTF_COMMAND_LEAVE) {
             $this->getManager()->handleLeaveTheGame($player);
             return;
         }
     }
 }
コード例 #26
0
ファイル: SimpleArea.php プロジェクト: nesgohood/PMMP-Plugins
 public function onSign(SignChangeEvent $event)
 {
     if ($event->getPlayer()->isOp()) {
         return;
     }
     if ($event->getLine(0) == $this->signTemplate["signTemplate"][0]) {
         if (isset(explode($this->signTemplate["signTemplate"][1], $event->getLine(1))[1])) {
             if ($event->getLine(2) == $this->signTemplate["signTemplate"][2]) {
                 if ($event->getLine(2) == $this->signTemplate["signTemplate"][2]) {
                     $event->setCancelled();
                 }
             }
         }
     }
 }
コード例 #27
0
 public function onSignChange(SignChangeEvent $event)
 {
     if (!$event->getPlayer()->isOp()) {
         return;
     }
     if ($event->getLine(0) == "check") {
         $text = TextFormat::DARK_AQUA;
         $text .= "X:" . $event->getBlock()->getX();
         $text .= ", Y" . $event->getBlock()->getY();
         $text .= ", Z:" . $event->getBlock()->getZ();
         $text .= ", ID: " . $event->getBlock()->getId();
         $text .= ", DMG :" . $event->getBlock()->getDamage();
         $this->getLogger()->info($text);
         $event->getPlayer()->sendMessage($text);
     }
 }
コード例 #28
0
ファイル: Acpvp.php プロジェクト: haniokasai/Recycle-Bin
 public function onSignChange(SignChangeEvent $sc)
 {
     if (!$sc->getPlayer()->isOP() && $sc->getLine(0) == "[BUY]") {
         $sc->setCancelled();
         $sc->getPlayer()->sendMessage("あなたはopではありません。");
     }
 }
 /**
  * @param SignChangeEvent $event
  */
 public function onSignChange(SignChangeEvent $event)
 {
     $player = $event->getPlayer();
     if (strtolower(trim($event->getLine(0))) == "status" || strtolower(trim($event->getLine(0))) == "[狀態]") {
         if ($player->hasPermission("signstatus")) {
             $tps = $this->getServer()->getTicksPerSecond();
             $p = count($this->getServer()->getOnlinePlayers());
             $level = $event->getBlock()->getLevel()->getName();
             $full = $this->getServer()->getMaxPlayers();
             $event->setLine(0, F::GREEN . "[狀態]");
             $event->setLine(1, F::YELLOW . "TPS: [" . $tps . "]");
             $event->setLine(2, F::AQUA . "在線: " . F::GREEN . $p . F::WHITE . "/" . F::RED . $full . "");
             $event->setLine(3, F::GOLD . "******");
             $this->sign->setNested("sign.x", $event->getBlock()->getX());
             $this->sign->setNested("sign.y", $event->getBlock()->getY());
             $this->sign->setNested("sign.z", $event->getBlock()->getZ());
             $this->sign->setNested("sign.enabled", true);
             $this->sign->setNested("sign.level", $level);
             $this->sign->save();
             $this->sign->reload();
             $event->getPlayer()->sendMessage($this->prefix . $this->translation->get("sign_created"));
         } else {
             $player->sendMessage($this->prefix . $this->translation->get("sign_no_perms"));
             $event->setCancelled();
         }
     }
 }
コード例 #30
0
ファイル: Lotto.php プロジェクト: nesgohood/PMMP-Plugins
 public function onSignChange(SignChangeEvent $event)
 {
     if (strToLower($event->getLine(0)) !== strToLower(self::tag)) {
         return;
     }
     if ($event->getPlayer()->isOp() === false) {
         $event->getPlayer()->sendMessage(TextFormat::DARK_RED . self::tag . " You don't have permission to create a shop!");
         $event->setCancelled(true);
         return;
     }
     $key = $this->getAxisKey($event->getBlock(), self::axisToken);
     if (isset($this->shops[$key])) {
         $event->getPlayer()->sendMessage(TextFormat::DARK_RED . self::tag . " Cannot create shop - Here are already shop exists!");
         $event->setCancelled(true);
         return;
     }
     $event->setLine(0, self::tag);
     $event->setLine(1, "");
     $event->setLine(2, "");
     $event->setLine(3, "");
     $this->shops[$key] = $event->getPlayer()->getName();
     $event->getPlayer()->sendMessage(TextFormat::DARK_AQUA . self::tag . " Shop created!");
 }