本文整理汇总了PHP中pocketmine\event\block\SignChangeEvent类的典型用法代码示例。如果您正苦于以下问题:PHP SignChangeEvent类的具体用法?PHP SignChangeEvent怎么用?PHP SignChangeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SignChangeEvent类的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: 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"));
}
}
示例3: 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();
}
}
}
示例4: signchange
public function signchange(SignChangeEvent $event)
{
$event->setLine(0, "sJimin's");
$event->setLine(1, "First");
$event->setLine(2, "Plugin");
$event->setLine(3, "work!");
}
示例5: 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()));
}
}
}
示例6: 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)));
}
示例7: 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;
}
}
}
示例8: 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;
}
示例9: 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));
}
示例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 = 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]));
}
}
示例11: 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]));
}
}
示例12: signCatch
public function signCatch(SignChangeEvent $event)
{
if ($event->getLine(0) == null and $event->getLine(1) == null and $event->getLine(2) == null and $event->getLine(3) == null) {
return;
}
$block = $event->getBlock();
if ($block->getID() != 0) {
$this->list[$block->x . "." . $block->y . "." . $block->z]['id'] = $block->getID();
$this->list[$block->x . "." . $block->y . "." . $block->z]['damage'] = $block->getDamage();
$this->list[$block->x . "." . $block->y . "." . $block->z]['t0'] = $event->getLine(0);
$this->list[$block->x . "." . $block->y . "." . $block->z]['t1'] = $event->getLine(1);
$this->list[$block->x . "." . $block->y . "." . $block->z]['t2'] = $event->getLine(2);
$this->list[$block->x . "." . $block->y . "." . $block->z]['t3'] = $event->getLine(3);
$this->initialize_schedule_delay($this, "signReplaceCatch", 40, [$block->x, $block->y, $block->z]);
}
}
示例13: 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);
}
示例14: 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] 색상체크 표지판을 생성했습니다");
}
}
示例15: 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);
}