hasPermission() public method

public hasPermission ( Permission | string $name ) : boolean
$name pocketmine\permission\Permission | string
return boolean
コード例 #1
5
 public function onRun(PlayerEnt $entity, Player $player, array $args)
 {
     if (!isset($args[1])) {
         return false;
     }
     $bank = isset($args[2]) and strtolower($args[2]) === "-bank";
     if ($bank and !$player->hasPermission("xecon.cmd.pay.bank")) {
         return "You don't have permission to pay bank money to other players.";
     } elseif (!$bank and !$player->hasPermission("xecon.cmd.pay.cash")) {
         return "You don't have permission to pay cash to other players.";
     }
     $toEnt = $this->getPlugin()->getPlayerEnt($args[0]);
     if (!$toEnt instanceof PlayerEnt) {
         return "Player {$args['0']} is not registered in the database!";
     }
     $to = $toEnt->getAccount($name = $bank ? PlayerEnt::ACCOUNT_BANK : PlayerEnt::ACCOUNT_CASH);
     $from = $entity->getAccount($name);
     $amount = floatval($args[1]);
     if ($amount <= 0) {
         return "Amount must be larger than zero!";
     }
     if (!$from->canPay($amount)) {
         return "You cannot pay \${$amount} from your {$from} account.";
     }
     if (!$to->canReceive($amount)) {
         return "{$args['0']}'s {$to} account cannot receive \${$amount}.";
     }
     $from->pay($to, $amount, implode(" ", array_slice($args, 2 + ($bank ? 1 : 0))));
     return "Transaction completed: \${$amount} has been paid to {$args['1']}'s {$to} account from your {$from} account.";
 }
コード例 #2
1
ファイル: Main.php プロジェクト: DWWf/pocketmine-plugins
 public function canPlaceBreakBlock(Player $c, $world)
 {
     $pname = strtolower($c->getName());
     if (isset($this->wcfg[$world]["auth"]) && count($this->wcfg[$world]["auth"])) {
         // Check if user is in auth list...
         if (isset($this->wcfg[$world]["auth"][$pname])) {
             return true;
         }
         return false;
     }
     if ($c->hasPermission("wp.cmd.protect.auth")) {
         return true;
     }
     return false;
 }
コード例 #3
1
 public function hasPermission($permission)
 {
     return $this->player->hasPermission($permission);
 }
コード例 #4
0
 /**
  * @param int $currentTick
  */
 public function onRun($currentTick)
 {
     $this->getPlugin()->getServer()->getLogger()->debug(TextFormat::YELLOW . "Running EssentialsPE's AFKKickTask");
     if ($this->getPlugin()->isAFK($this->player) && !$this->player->hasPermission("essentials.afk.kickexempt") && time() - $this->getPlugin()->getLastPlayerMovement($this->player) >= $this->getPlugin()->getConfig()->getNested("afk.auto-set")) {
         $this->player->kick("You have been kicked for idling more than " . (($time = floor($this->getPlugin()->getConfig()->getNested("afk.auto-kick"))) / 60 >= 1 ? $time / 60 . " minutes" : $time . " seconds"), false);
     }
 }
コード例 #5
0
 public function checkPermission(Space $space, Player $player)
 {
     if ($space instanceof CuboidSpace) {
         return $player->hasPermission("wea.test.cuboid");
     }
     if ($space instanceof CylinderSpace) {
         return $player->hasPermission("wea.test.cylinder");
     }
     if ($space instanceof SphereSpace) {
         return $player->hasPermission("wea.test.sphere");
     }
     return $player->hasPermission("wea.test.*");
 }
コード例 #6
0
 public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getLoaderId()])) {
         $this->hasSpawned[$player->getLoaderId()] = $player;
         $pk = new AddPlayerPacket();
         $pk->uuid = $this->getUniqueId();
         $pk->username = $this->getName();
         $pk->eid = $this->getId();
         $pk->x = $this->x;
         $pk->y = $this->y;
         $pk->z = $this->z;
         $pk->speedX = 0;
         $pk->speedY = 0;
         $pk->speedZ = 0;
         $pk->yaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $item = $this->getInventory()->getItemInHand();
         $pk->item = $item;
         if ($player->hasPermission("slapper.seeownskin")) {
             $pk->skin = $player->getSkinData();
             $pk->slim = $player->isSkinSlim();
         } else {
             $pk->skin = $this->skin;
             $pk->slim = $this->isSlim;
         }
         $pk->metadata = [2 => [4, $this->getDataProperty(2)], 3 => [0, $this->getDataProperty(3)], 15 => [0, 1]];
         $player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
         $this->inventory->sendArmorContents($player);
     }
 }
コード例 #7
0
ファイル: SlapperHuman.php プロジェクト: PMPlugins/Slapper
 public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getLoaderId()])) {
         $this->hasSpawned[$player->getLoaderId()] = $player;
         $uuid = $this->getUniqueId();
         $entityId = $this->getId();
         $pk = new AddPlayerPacket();
         $pk->uuid = $uuid;
         $pk->username = "";
         $pk->eid = $entityId;
         $pk->x = $this->x;
         $pk->y = $this->y;
         $pk->z = $this->z;
         $pk->yaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $pk->item = $this->getInventory()->getItemInHand();
         $pk->metadata = [2 => [4, str_ireplace("{name}", $player->getName(), str_ireplace("{display_name}", $player->getDisplayName(), $player->hasPermission("slapper.seeId") ? $this->getDataProperty(2) . "\n" . \pocketmine\utils\TextFormat::GREEN . "Entity ID: " . $entityId : $this->getDataProperty(2)))], 3 => [0, $this->getDataProperty(3)], 15 => [0, 1]];
         $player->dataPacket($pk);
         $this->inventory->sendArmorContents($player);
         $add = new PlayerListPacket();
         $add->type = 0;
         $add->entries[] = [$uuid, $entityId, isset($this->namedtag->MenuName) ? $this->namedtag["MenuName"] : "", $this->skinName, $this->skin];
         $player->dataPacket($add);
         if ($this->namedtag["MenuName"] === "") {
             $remove = new PlayerListPacket();
             $remove->type = 1;
             $remove->entries[] = [$uuid];
             $player->dataPacket($remove);
         }
     }
 }
コード例 #8
0
 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()));
         }
     }
 }
コード例 #9
0
ファイル: BaseSession.php プロジェクト: PrimusLV/EssentialsPE
 /**
  * @param BaseAPI $api
  * @param Player $player
  * @param Config $config
  * @param array $values
  */
 public function __construct(BaseAPI $api, Player $player, Config $config, array $values)
 {
     $this->api = $api;
     $this->player = $player;
     $this->config = $config;
     self::$defaults["lastMovement"] = !$player->hasPermission("essentals.afk.preventauto") ? time() : null;
     foreach ($values as $k => $v) {
         $this->{$k} = $v;
     }
     $this->loadHomes();
 }
コード例 #10
0
 private function checkPerm(Player $pl, $perm)
 {
     if ($pl->hasPermission($perm)) {
         return;
     }
     $n = strtolower($pl->getName());
     $this->helper->getLogger()->warnning(mc::_("Fixing %1% for %2%", $perm, $n));
     if (!isset($this->perms[$n])) {
         $this->perms[$n] = $pl->addAttachment($this->helper);
     }
     $this->perms[$n]->setPermission($perm, true);
     $pl->recalculatePermissions();
 }
コード例 #11
0
 public function spawnTo(Player $player)
 {
     $pk = new AddEntityPacket();
     $pk->eid = $this->getId();
     $pk->type = 40;
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->yaw = $this->yaw;
     $pk->pitch = $this->pitch;
     $pk->metadata = [2 => [4, str_ireplace("{name}", $player->getName(), str_ireplace("{display_name}", $player->getDisplayName(), $player->hasPermission("slapper.seeId") ? $this->getDataProperty(2) . "\n" . \pocketmine\utils\TextFormat::GREEN . "Entity ID: " . $this->getId() : $this->getDataProperty(2)))], 3 => [0, $this->getDataProperty(3)], 15 => [0, 1]];
     $player->dataPacket($pk);
     parent::spawnTo($player);
 }
コード例 #12
0
ファイル: SetShop.php プロジェクト: HelloWorld017/ToAruShop
 public function canBuy(Player $buyer)
 {
     if (!$buyer->hasPermission("arushop.buy.set")) {
         return "NO_PERMISSION";
     }
     if (EconomyAPI::getInstance()->myMoney($buyer) < $this->cost) {
         return "INSUFFICIENT_MONEY";
     }
     if (($rpg = ToAruPG::getInstance()->getRPGPlayerByName($buyer->getName())) === null) {
         return "INVALID_PLAYER";
     }
     if (!$rpg->canChangeJob(JobManager::getJob($this->jobId))) {
         return "JOB_COULD_NOT_ACQUIRE";
     }
     return true;
 }
コード例 #13
0
ファイル: Arena.php プロジェクト: Mike1150/SurvivalGames
 public function joinToArena(Player $p)
 {
     if ($this->game >= 1) {
         $p->sendMessage($this->msg->getMsg("already_running"));
     }
     if ($this->isArenaFull() && !$p->isOp() && !$p->hasPermission("sg.full")) {
         $p->sendMessage($this->msg->getMsg("game_full"));
         return;
     }
     $this->plugin->getServer()->getPluginManager()->callEvent($e = new PlayerJoinArenaEvent($p, $this));
     if ($e->isCancelled()) {
         return;
     }
     $this->players[strtolower($p->getName())]["ins"] = $p;
     $this->saveInv($p);
     $p->teleport($this->getNextJoinPos());
     $this->messageArenaPlayers(str_replace(["%PLAYER", "%COUNT", "%MAXCOUNT"], [$p->getName(), count($this->getPlayers()), $this->getMaxPlayers()], $this->msg->getMsg("game_connect")));
 }
コード例 #14
0
 public function grantKit($name, Player $player)
 {
     $kit = $this->getPlugin()->getKitStore()->getKit($name);
     if ($kit !== false) {
         if ($player->hasPermission("battlekits.use.{$name}")) {
             if ($kit->isActiveIn($player->getLevel())) {
                 if ($this->getPlugin()->getKitHistoryStore()->canUse($player)) {
                     if (!$kit->isFree()) {
                         if ($this->getPlugin()->isLinkedToEconomy()) {
                             if ($this->getPlugin()->getEconomy()->take($kit->getCost(), $player)) {
                                 $kit->applyTo($player);
                                 $this->getPlugin()->getKitHistoryStore()->kitUsed($player);
                                 return true;
                             } else {
                                 $player->sendMessage("{$name} can't be purchased.");
                                 return false;
                             }
                         } else {
                             $player->sendMessage("{$name} can't be purchased at this time.");
                             return false;
                         }
                     } else {
                         $kit->applyTo($player);
                         $this->getPlugin()->getKitHistoryStore()->kitUsed($player);
                         return true;
                     }
                 } else {
                     $player->sendMessage("You can only use one kit per life.");
                     return false;
                 }
             } else {
                 $player->sendMessage("{$name} is not available in this world.");
                 return false;
             }
         } else {
             $player->sendMessage("You don't have permission to use {$name}.");
             return false;
         }
     } else {
         $player->sendMessage("{$name} doesn't exist.");
         return false;
     }
 }
コード例 #15
0
ファイル: SkillShop.php プロジェクト: HelloWorld017/ToAruShop
 public function canBuy(Player $buyer)
 {
     if (!$buyer->hasPermission("arushop.buy.skill")) {
         return "NO_PERMISSION";
     }
     if (EconomyAPI::getInstance()->myMoney($buyer) < $this->cost) {
         return "INSUFFICIENT_MONEY";
     }
     if (!ToAruPG::getInstance()->isValidPlayer($buyer)) {
         return "INVALID_PLAYER";
     }
     $rpgPlayer = ToAruPG::getInstance()->getRPGPlayerByName($buyer);
     if (!SkillManager::getSkill($this->skillId)->canBeAcquired($rpgPlayer)) {
         return "CANNOT_BE_ACQUIRED";
     }
     if ($rpgPlayer->hasSkill($this->skillId)) {
         return TextFormat::RED . ToAruPG::getTranslation("ALREADY_HAS_SKILL", ToAruPG::getTranslation(SkillManager::getSkill($this->skillId)->getName()));
     }
     return true;
 }
コード例 #16
0
 /**
  * Return a colored message replacing every
  * color code (&a = §a)
  *
  * @param string $message
  * @param Player|null $player
  * @return bool|string
  */
 public function colorMessage($message, Player $player = null)
 {
     $message = preg_replace_callback("/(\\\\&|\\&)[0-9a-fk-or]/", function (array $matches) {
         return str_replace("\\§", "&", str_replace("&", "§", $matches[0]));
     }, $message);
     if (strpos($message, "§") !== false && $player instanceof Player && !$player->hasPermission("essentials.colorchat")) {
         $player->sendMessage(TextFormat::RED . "You can't chat using colors!");
         return false;
     }
     return $message;
 }
コード例 #17
0
ファイル: ChopTree.php プロジェクト: nesgohood/PMMP-Plugins
 /**
  * @param Player $player
  * @param Block $stump
  * @param Item $item
  * @param string $type
  * @return bool Succeed
  */
 public function chopTree(Player $player, Block $stump, Item $item, $type)
 {
     if (!$player->hasPermission("ChopTree.{$type}")) {
         return false;
     }
     $config = $this->getConfig()->get($type);
     if ($config === null or $config["enabled"] === false) {
         return false;
     }
     $itemId = $item->getId();
     if (!in_array($itemId, $config["tools"])) {
         return false;
     }
     $treetop = $this->getTreetop($stump);
     if ($treetop < 0) {
         return false;
     }
     $cost = is_numeric($config["cost"]) ? intval($config["cost"]) : 0;
     if ($config["costPerBlock"]) {
         $cost *= $treetop - $stump->getY();
     }
     $this->getServer()->getPluginManager()->callEvent($event = new ChopTreeEvent($this, $player, $stump, $item, $type, $cost));
     if ($event->isCancelled()) {
         return false;
     }
     $paymentResult = EconomyAPI::getInstance()->reduceMoney($player, $cost, false, "ChopTree");
     if ($paymentResult !== EconomyAPI::RET_SUCCESS) {
         return false;
     }
     $level = $stump->getLevel();
     for ($y = 0; $y < $treetop; $y++) {
         $block = $level->getBlock($stump->add(0, $y, 0));
         $block->onBreak($item);
         foreach ($block->getDrops($item) as $drop) {
             $level->dropItem($stump->add(0.4, 0.4, 0.4), Item::get($drop[0], $drop[1], $drop[2]));
         }
     }
     if ($config["plantSaplingAfter"]) {
         $level->setBlock($stump, $this->getSapling($level->getBlock($stump->add(0, $treetop, 0))), true, true);
     }
     return true;
 }
コード例 #18
0
 public function checkPermission(Player $player)
 {
     return $player->hasPermission("wea.pos");
 }
コード例 #19
0
ファイル: JoinMgr.php プロジェクト: DWWf/pocketmine-plugins
 public function alwaysSpawn(Player $pl)
 {
     $spawn = $this->spawn;
     if ($spawn == "perms") {
         foreach (["always", "world", "home", "default"] as $spawn) {
             if ($pl->hasPermission("gb.join.spawn." . $spawn)) {
                 break;
             }
         }
     }
     $this->owner->getServer()->getScheduler()->scheduleDelayedTask(new PluginCallbackTask($this->owner, [$this, "delayedSpawn"], [$pl->getName(), $spawn]), 5);
 }
コード例 #20
0
ファイル: MyPlot.php プロジェクト: Adam1609/MyPlot
 /**
  * Get the maximum number of plots a player can claim
  *
  * @param Player $player
  * @return int
  */
 public function getMaxPlotsOfPlayer(Player $player)
 {
     if ($player->hasPermission("myplot.claimplots.unlimited")) {
         return PHP_INT_MAX;
     }
     /** @var Permission[] $perms */
     $perms = array_filter($this->getServer()->getPluginManager()->getPermissions(), function ($name) {
         return substr($name, 0, 18) === "myplot.claimplots.";
     }, ARRAY_FILTER_USE_KEY);
     if (count($perms) == 0) {
         return 0;
     }
     krsort($perms);
     $maxPlots = PHP_INT_MAX;
     foreach ($perms as $perm) {
         if ($player->hasPermission($perm->getName())) {
             $maxPlots = substr($perm->getName(), 18);
             break;
         }
     }
     return is_numeric($maxPlots) ? (int) $maxPlots : PHP_INT_MAX;
 }
コード例 #21
0
ファイル: Arena.php プロジェクト: ChiefArtz/SurvivalGames
 public function joinToArena(Player $p)
 {
     if ($this->game >= 1) {
         $p->sendMessage($this->msg->getMsg("already_running"));
     }
     $ev = new PlayerJoinArenaEvent($p, $this, "");
     if ($this->isArenaFull() && !$p->hasPermission("sg.arena.join.full")) {
         $ev->setMessage($this->msg->getMsg("game_full"));
         $ev->setCancelled();
     } else {
         if (!$p->hasPermission("sg.arena.join")) {
             $ev->setMessage(Messages::getMsg("no_permission_join", ["%NAME", $this->name]));
             $ev->setCancelled();
         } else {
             $ev->setMessage(Messages::getMsg("join_to_arena", ["%NAME" => $this->name]));
         }
     }
     $this->plugin->getServer()->getPluginManager()->callEvent($ev);
     if ($ev->isCancelled()) {
         return;
     }
     $this->messageArenaPlayers(str_replace(["%PLAYER", "%COUNT", "%MAXCOUNT"], [$p->getName(), count($this->getPlayers()), $this->getMaxPlayers()], $this->msg->getMsg("game_connect")));
     $this->players[strtolower($p->getName())]["ins"] = $p;
     $this->saveInventory($p);
     $p->teleport($this->getNextJoinPos($p));
 }
コード例 #22
0
ファイル: Arena.php プロジェクト: Creeperface01/ColorMatch
 public function joinToArena(Player $p)
 {
     if ($p->hasPermission("cm.acces") || $p->isOp()) {
         if ($this->setup === true) {
             $p->sendMessage($this->plugin->getPrefix() . $this->plugin->getMsg('arena_in_setup'));
             return;
         }
         if (count($this->lobbyp) >= $this->getMaxPlayers()) {
             $p->sendMessage($this->plugin->getPrefix() . $this->plugin->getMsg('game_full'));
             return;
         }
         if ($this->game === 1) {
             $p->sendMessage($this->plugin->getPrefix() . $this->plugin->getMsg('ingame'));
             return;
         }
         if (!$this->plugin->getServer()->isLevelGenerated($this->data['arena']['arena_world'])) {
             $this->plugin->getServer()->generateLevel($this->data['arena']['arena_world']);
         }
         if (!$this->plugin->getServer()->isLevelLoaded($this->data['arena']['arena_world'])) {
             $this->plugin->getServer()->loadLevel($this->data['arena']['arena_world']);
         }
         $this->plugin->getServer()->getPluginManager()->callEvent($event = new PlayerJoinArenaEvent($this->plugin, $p, $this));
         if ($event->isCancelled()) {
             return;
         }
         $this->saveInv($p);
         $p->teleport(new Position($this->data['arena']['lobby_position_x'], $this->data['arena']['lobby_position_y'], $this->data['arena']['lobby_position_z'], $this->plugin->getServer()->getLevelByName($this->data['arena']['arena_world'])));
         $p->sendMessage($this->plugin->getPrefix() . $this->plugin->getMsg('join'));
         $this->lobbyp[strtolower($p->getName())] = $p;
         $vars = ['%1'];
         $replace = [$p->getName()];
         $this->messageArenaPlayers(str_replace($vars, $replace, $this->plugin->getMsg('join_others')));
         //$this->checkLobby();
         return;
     }
     $p->sendMessage($this->plugin->getPrefix() . $this->plugin->getMsg('has_not_permission'));
 }
コード例 #23
0
ファイル: YamlDatabase.php プロジェクト: Tolo0/EconomyS
 public function canTouch($x, $z, $level, Player $player)
 {
     foreach ($this->land as $land) {
         if ($level === $land["level"] and $land["startX"] <= $x and $land["endX"] >= $x and $land["startZ"] <= $z and $land["endZ"] >= $z) {
             if ($player->getName() === $land["owner"] or isset($land["invitee"][$player->getName()]) or $player->hasPermission("economyland.land.modify.others")) {
                 // If owner is correct
                 return true;
             } else {
                 // If owner is not correct
                 return $land;
             }
         }
     }
     //	return !in_array($level, $this->config["white-land"]) or $player->hasPermission("economyland.land.modify.whiteland");
     return -1;
     // If no land found
 }
コード例 #24
0
ファイル: PureChat.php プロジェクト: mad-hon/PureChat
 /**
  * @param $string
  * @param Player $player
  * @param $message
  * @param null $levelName
  * @return mixed
  */
 public function applyPCTags($string, Player $player, $message, $levelName)
 {
     // TODO
     $string = str_replace(array("{display_name}", "{DISPLAY_NAME}"), $player->getDisplayName(), $string);
     if ($message === null) {
         $message = "";
     }
     if ($player->hasPermission("pchat.coloredMessages")) {
         $string = str_replace(array("{msg}", "{MESSAGE}"), $this->applyColors($message), $string);
     } else {
         $string = str_replace(array("{msg}", "{MESSAGE}"), $this->stripColors($message), $string);
     }
     if ($this->factionsAPI !== null) {
         $string = str_replace(array("{fac_name}", "{FACTION_NAME}"), $this->factionsAPI->getPlayerFaction($player), $string);
         $string = str_replace(array("{fac_rank}", "{FACTION_RANK}"), $this->factionsAPI->getPlayerRank($player), $string);
     } else {
         $string = str_replace(array("{fac_name}", "{FACTION_NAME}"), '', $string);
         $string = str_replace(array("{fac_rank}", "{FACTION_RANK}"), '', $string);
     }
     $string = str_replace(array("{world}", "{WORLD}"), $levelName === null ? "" : $levelName, $string);
     $string = str_replace(array("{prefix}", "{PREFIX}"), $this->getPrefix($player, $levelName), $string);
     $string = str_replace(array("{suffix}", "{SUFFIX}"), $this->getSuffix($player, $levelName), $string);
     return $string;
 }
コード例 #25
0
 private function buyItem(Player $player, $shop)
 {
     if (!$player instanceof Player) {
         return false;
     }
     if (!$player->hasPermission("economyshop.shop.buy")) {
         $player->sendMessage($this->getMessage("no-permission-buy"));
         return false;
     }
     $money = EconomyAPI::getInstance()->myMoney($player);
     if ($money < $shop[8]) {
         $player->sendMessage($this->getMessage("no-money", [$shop[8], $shop[6]]));
     } else {
         $item = Item::get($shop[4], $shop[5], $shop[7]);
         if ($player->getInventory()->canAddItem($item)) {
             $ev = new ShopTransactionEvent($player, new Position($shop[0], $shop[1], $shop[2], $this->getServer()->getLevelByName($shop[3])), $item, $shop[8]);
             $this->getServer()->getPluginManager()->callEvent($ev);
             if ($ev->isCancelled()) {
                 $player->sendMessage($this->getMessage("failed-buy"));
                 return true;
             }
             $player->getInventory()->addItem($item);
             $player->sendMessage($this->getMessage("bought-item", [$shop[6], $shop[7], $shop[8]]));
             EconomyAPI::getInstance()->reduceMoney($player, $shop[8]);
         } else {
             $player->sendMessage($this->getMessage("full-inventory"));
         }
     }
     return true;
 }
コード例 #26
0
ファイル: SQLiteDatabase.php プロジェクト: Tolo0/EconomyS
 public function canTouch($x, $z, $level, Player $player)
 {
     if (!is_bool($land = $this->land->query("SELECT owner,invitee FROM land WHERE level = '{$level}' AND endX >= {$x} AND endZ >= {$z} AND startX <= {$x} AND startZ <= {$z}")->fetchArray(SQLITE3_ASSOC))) {
         if ($player->getName() === $land["owner"] or stripos($player->getName() . self::INVITEE_SEPERATOR, $land["invitee"]) or $player->hasPermission("economyland.land.modify.others")) {
             return true;
         } else {
             return $land;
         }
     }
     //return !in_array($level, $this->config["white-land"]) or $player->hasPermission("economyland.land.modify.whiteland");
     return true;
 }
コード例 #27
-1
 public function NydusCanal(Player $player, $warp = null)
 {
     if ($warp == null) {
         return false;
     }
     if (isset(explode("[", $warp)[1])) {
         $level = explode("[", $warp)[1];
         $level = explode("]", $level)[0];
         $level = $this->getServer()->getLevelByName($level);
         if (!$level instanceof Level) {
             $player->sendMessage(TextFormat::DARK_AQUA . $level . "맵 폴더를 찾을 수 없습니다 !, 워프불가");
             return false;
         }
         $pos = $level->getSafeSpawn();
         if ($pos == false) {
             $player->sendMessage(TextFormat::RED . "해당 맵의 기본스폰위치를 찾을 수없습니다, 워프불가");
             return false;
         }
         $player->teleport($pos);
         return true;
     }
     if (!isset($this->NydusCanal_List["warp"][$warp])) {
         $player->sendMessage(TextFormat::DARK_AQUA . "해당 워프가 삭제되어있습니다 !, 워프불가");
         return false;
     }
     $x = $this->NydusCanal_List["warp"][$warp]['x'];
     $y = $this->NydusCanal_List["warp"][$warp]['y'];
     $z = $this->NydusCanal_List["warp"][$warp]['z'];
     $yaw = $this->NydusCanal_List["warp"][$warp]['yaw'];
     $pitch = $this->NydusCanal_List["warp"][$warp]['pitch'];
     $level = $this->getServer()->getLevelByName($this->NydusCanal_List["warp"][$warp]['level']);
     if (!$level instanceof Level) {
         $player->sendMessage(TextFormat::DARK_AQUA . $this->NydusCanal_List["warp"][$warp]['level'] . "맵 폴더를 찾을 수 없습니다 !, 워프불가");
         return false;
     }
     if (!$player->hasPermission("nyduscanal.lockwarp")) {
         if (isset($this->NydusCanal_List["locked"][$warp])) {
             $player->sendMessage(TextFormat::DARK_AQUA . "해당 워프가 잠겨있습니다, 워프불가");
             return false;
         }
     }
     if (isset($this->NydusCanal_List["warp"][$warp]["cooltime"])) {
         if (!isset($this->customCooltime[$warp][$player->getName()])) {
             $this->customCooltime[$warp][$player->getName()] = date("Y-m-d H:i:s");
         } else {
             $before = $this->makeTimestamp($this->customCooltime[$warp][$player->getName()]);
             $after = $this->makeTimestamp(date("Y-m-d H:i:s"));
             $timeout = intval($after - $before);
             if ($timeout < (int) $this->NydusCanal_List["warp"][$warp]["cooltime"]) {
                 $player->sendMessage(TextFormat::RED . "워프 쿨타임이 아직 남았습니다!");
                 $player->sendMessage(TextFormat::RED . intval((int) $this->NydusCanal_List["warp"][$warp]["cooltime"] - $timeout) . "초 후에 이용가능합니다!");
                 return false;
             } else {
                 unset($this->customCooltime[$warp][$player->getName()]);
             }
         }
     }
     if (isset($this->timeout[$warp][$player->getName()])) {
         $player->sendMessage(TextFormat::DARK_AQUA . "[ 시간제한 ] 시간제한이 해제되었습니다.");
         $this->timeout[$warp]["cancel"][$player->getName()] = 1;
     }
     if (isset($this->NydusCanal_List["warp"][$warp]["timeout"])) {
         if (!isset($this->timeout[$warp][$player->getName()])) {
             $this->timeout[$warp][$player->getName()] = $player->add(2);
             $player->sendMessage(TextFormat::RED . "[ 주의 ] [ 시간제한 ] " . $this->NydusCanal_List["warp"][$warp]["timeout"] . "초 뒤에 이전 위치로 복귀됩니다!");
             $this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "warpTimeout"], [$player, $warp]), 20 * $this->NydusCanal_List["warp"][$warp]["timeout"]);
         }
     }
     if (isset($this->NydusCanal_List["warp"][$warp]["price"]) and $this->checkEconomyAPI()) {
         if (isset(explode("+", $this->NydusCanal_List["warp"][$warp]["price"])[1])) {
             $this->economyAPI->addMoney($player, explode("+", $this->NydusCanal_List["warp"][$warp]["price"])[1]);
         } else {
             $myMoney = $this->economyAPI->myMoney($player);
             if ($myMoney - $this->NydusCanal_List["warp"][$warp]["price"] < 0) {
                 $player->sendMessage(TextFormat::DARK_AQUA . "[ 서버 ] 이동비용이 부족합니다, 워프불가능");
                 return false;
             }
             $this->economyAPI->reduceMoney($player, $this->NydusCanal_List["warp"][$warp]["price"]);
         }
     }
     $player->teleport(new Position($x, $y, $z, $level), $yaw, $pitch);
     $player->addEntityMotion(0, 0, 0.6, 0);
     $player->sendMessage(TextFormat::LIGHT_PURPLE . "[ 서버 ] " . $warp . " (으)로 워프 되었습니다");
     $this->particle($player);
     if (isset($this->NydusCanal_List["warp"][$warp]["price"]) and $this->checkEconomyAPI()) {
         if (isset(explode("+", $this->NydusCanal_List["warp"][$warp]["price"])[1])) {
             $player->sendMessage(TextFormat::DARK_AQUA . "[ 서버 ] 보상금액 " . $this->NydusCanal_List["warp"][$warp]["price"] . "\$ 가 지급되었습니다.");
         } else {
             $player->sendMessage(TextFormat::DARK_AQUA . "[ 서버 ] 워프비용 " . $this->NydusCanal_List["warp"][$warp]["price"] . "\$ 가 지불되었습니다.");
         }
     }
 }
コード例 #28
-1
ファイル: Match.php プロジェクト: legoboy0215/DynamicHub
 public final function hasSpectatePermission(Player $player) : bool
 {
     foreach ($this->getSpectatePermissions() as $perm) {
         if (!$player->hasPermission($perm)) {
             return false;
         }
     }
     return true;
 }
コード例 #29
-1
ファイル: Loader.php プロジェクト: mwvent/WattzEssentialsPE
 /**
  * Sets the balance of a player
  *
  * @param Player $player
  * @param $balance
  */
 public function setPlayerBalance(Player $player, $balance)
 {
     if ((int) $balance > (int) $this->getMaxBalance()) {
         $balance = (int) $this->getMaxBalance();
     } elseif ((int) $balance < (int) $this->getMinBalance()) {
         $balance = (int) $this->getMinBalance();
     } elseif ((int) $balance < 0 && !$player->hasPermission("essentials.eco.load")) {
         $balance = 0;
     }
     $this->economy->setNested("player-balances." . $player->getName(), (int) $balance);
     $this->economy->save();
 }
コード例 #30
-2
ファイル: EconomySell.php プロジェクト: JUN0105/EconomyS
 private function sellItem(Player $player, $sell)
 {
     if (!$player instanceof Player) {
         return false;
     }
     if (!$player->hasPermission("economysell.sell.sell")) {
         $player->sendMessage($this->getMessage("no-permission-sell"));
         return false;
     }
     $item = Item::get($sell[4], $sell[5], $sell[7]);
     if ($player->getInventory()->contains($item)) {
         $ev = new SellTransactionEvent($player, new Position($sell[0], $sell[1], $sell[2], $this->getServer()->getLevelByName($sell[3])), $item, $sell[8]);
         $this->getServer()->getPluginManager()->callEvent($ev);
         if ($ev->isCancelled()) {
             $player->sendMessage($this->getMessage("failed-sell"));
             return true;
         }
         $player->getInventory()->removeItem($item);
         $player->sendMessage($this->getMessage("sold-item", [$sell[6], $sell[7], $sell[8]]));
         EconomyAPI::getInstance()->reduceMoney($player, $sell[8]);
     } else {
         $player->sendMessage($this->getMessage("no-item", [$sell[6]]));
     }
     return true;
 }