本文整理汇总了PHP中pocketmine\event\block\SignChangeEvent::getPlayer方法的典型用法代码示例。如果您正苦于以下问题:PHP SignChangeEvent::getPlayer方法的具体用法?PHP SignChangeEvent::getPlayer怎么用?PHP SignChangeEvent::getPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\block\SignChangeEvent
的用法示例。
在下文中一共展示了SignChangeEvent::getPlayer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: 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);
}
示例3: 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"));
}
示例4: 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;
}
}
示例5: 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;
}
示例6: 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);
}
}
}
}
}
}
示例7: 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();
}
}
}
示例8: 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, "");
}
}
}
示例9: 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"));
}
}
示例10: 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]));
}
}
示例11: 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();
}
}
}
示例12: 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;
}
}
}
示例13: 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);
}
示例14: 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;
}
}
}
}
示例15: 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
}
}
}
}