set() публичный Метод

public set ( string $k, mixed $v = true )
$k string key to be set
$v mixed value to set key
Пример #1
2
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $sub)
 {
     @mkdir($this->getServer()->getDataPath() . "/plugins/! DeBePlugins/");
     $korean = new Config($this->getServer()->getDataPath() . "/plugins/! DeBePlugins/" . "! Korean.yml", Config::YAML, ["Korean" => false]);
     if ($korean->get("Korean")) {
         $korean->set("Korean", false);
         $m = "설정";
     } else {
         $korean->set("Korean", true);
         $m = "해제";
     }
     $sender->sendMessage("[Korean] 한국말 {$m}");
     $korean->save();
     return true;
 }
Пример #2
1
 /**
  * @param Player $player
  * @param bool $value
  */
 public function setExempt(Player $player, $value = true)
 {
     if ($value) {
         $this->exempts->set(strtolower($player->getName()));
         $this->exempts->save();
     } else {
         $this->exempts->remove(strtolower($player->getName()));
         $this->exempts->save();
     }
 }
Пример #3
1
 public function onLoad()
 {
     $this->saveDefaultConfig();
     $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML);
     $version = $this->getDescription()->getVersion();
     if ($this->config->get("version") != $version) {
         $this->config->set("version", $version);
         $this->fixOldConfig();
     }
     $this->purePerms = $this->getServer()->getPluginManager()->getPlugin("PurePerms");
 }
Пример #4
1
 public function registerPlayer(IPlayer $player, $hash)
 {
     $name = trim(strtolower($player->getName()));
     @mkdir($this->plugin->getDataFolder() . "players/" . $name[0] . "/");
     $data = new Config($this->plugin->getDataFolder() . "players/" . $name[0] . "/{$name}.yml", Config::YAML);
     $data->set("registerdate", time());
     $data->set("logindate", time());
     $data->set("lastip", null);
     $data->set("hash", $hash);
     $data->save();
     return $data->getAll();
 }
Пример #5
0
 public function checkConfig()
 {
     if ($this->version > ConfigUpdater::CONFIG_VERSION) {
         $this->tapToDo->getLogger()->warning("The config loaded is not supported. It may not function correctly. ");
     }
     while ($this->version < ConfigUpdater::CONFIG_VERSION) {
         switch ($this->version) {
             case 0:
                 $this->tapToDo->getLogger()->info("Updating config from version 0 to 1...");
                 $blocks = $this->config->getAll();
                 foreach ($blocks as $id => $block) {
                     foreach ($block["commands"] as $i => $command) {
                         if (strpos($command, "%safe") === false && strpos($command, "%op") === false) {
                             $command .= "%pow";
                         }
                         $block["commands"][$i] = str_replace("%safe", "", $command);
                     }
                     $blocks[$id] = $block;
                 }
                 unlink($this->tapToDo->getDataFolder() . "blocks.yml");
                 $this->tapToDo->saveResource("blocks.yml");
                 $this->config = new Config($this->tapToDo->getDataFolder() . "blocks.yml", Config::YAML);
                 $this->config->set("version", 1);
                 $this->config->set("blocks", $blocks);
                 $this->config->save();
                 $this->version = 1;
                 break;
         }
     }
     return $this->config;
 }
Пример #6
0
 public function add($name, $warp)
 {
     $past = $this->config->get($name, null);
     $this->config->set($name, $warp);
     $this->config->save();
     return $past;
 }
 public function touchIP($ip)
 {
     if (!$this->ipList->exists($ip)) {
         $this->ipList->set($ip);
         return false;
     }
     return true;
 }
Пример #8
0
 public function checkUpdate()
 {
     $this->getPlugin()->getServer()->getPluginManager()->callEvent($event = new UpdateCheckingEvent($this->getPlugin(), $this->channel));
     if ($event->isCancelled()) {
         return false;
     }
     if ($this->channel == "beta") {
         $address = "https://api.github.com/repos/cybercube-hk/jail/releases";
     } else {
         $this->plugin->getLogger()->alert("[UPDATER] INVALID CHANNEL!");
         return false;
     }
     $i = json_decode(Utils::getURL($address), true);
     if ($this->channel == "beta") {
         $i = $i[0];
         $this->newversion = substr($i["name"], 6);
         $this->dlurl = $i["assets"][0]["browser_download_url"];
     }
     $plugin = $this->getPlugin();
     if ($plugin::VERSION_STRING !== $this->newversion) {
         $path = $this->plugin->getDataFolder() . "newest-version-download-link.txt";
         echo "\n";
         $this->plugin->getLogger()->info("Your version is too old or too new!  The latest " . $this->channel . " version is: (version: " . $this->newversion . ")");
         $this->plugin->getLogger()->info("Download url for the latest version: §e" . $this->dlurl . "");
         $this->plugin->getLogger()->info("The link is being saved into: §bnewest-version-download-link.txt\n");
         $txt = new Config($path, Config::ENUM);
         $txt->set("Version " . $this->newversion . " -> " . $this->dlurl, true);
         $txt->save();
         return true;
     }
     echo "\n";
     $this->plugin->getLogger()->info("No updates found!  Your Jail version is up-to-date!\n");
     return true;
 }
Пример #9
0
 public function onJoin(PlayerJoinEvent $event)
 {
     $name = $event->getPlayer()->getDisplayName();
     $ip = $event->getPlayer()->getAddress();
     if (is_file($this->getDataFolder() . "players/lastip/" . $name[0] . "/" . $name . ".yml")) {
         unlink($this->getDataFolder() . "players/lastip/" . $name[0] . "/" . $name . ".yml");
         $name = $event->getPlayer()->getDisplayName();
         $ip = $event->getPlayer()->getAddress();
         @mkdir($this->getDataFolder() . "players/lastip/" . $name[0] . "", 0777, true);
         $lastip = new Config($this->getDataFolder() . "players/lastip/" . $name[0] . "/" . $name . ".yml", CONFIG::YAML, array("lastip" => "" . $ip . ""));
         $lastip->save();
         @mkdir($this->getDataFolder() . "players/ip/" . $ip[0] . "", 0777, true);
         $ipfile = new Config($this->getDataFolder() . "players/ip/" . $ip[0] . "/" . $ip . ".txt", CONFIG::ENUM);
         $ipfile->set($name);
         $ipfile->save();
     } else {
         $name = $event->getPlayer()->getDisplayName();
         $ip = $event->getPlayer()->getAddress();
         @mkdir($this->getDataFolder() . "players/lastip/" . $name[0] . "", 0777, true);
         $lastip = new Config($this->getDataFolder() . "players/lastip/" . $name[0] . "/" . $name . ".yml", CONFIG::YAML, array("lastip" => "" . $ip . ""));
         $lastip->save();
         @mkdir($this->getDataFolder() . "players/ip/" . $ip[0] . "", 0777, true);
         $ipfile = new Config($this->getDataFolder() . "players/ip/" . $ip[0] . "/" . $ip . ".txt", CONFIG::ENUM);
         $ipfile->set($name);
         $ipfile->save();
     }
 }
 public function setPlayer(IPlayer $player, $rank)
 {
     $fileName = $this->plugin->getDataFolder() . "players/" . strtolower($player->getName()) . ".yml";
     $config = new Config($fileName, Config::YAML, ["name" => $player->getName(), "rank" => $rank]);
     $config->set("rank", $rank);
     $config->save(true);
 }
Пример #11
0
 private function changeMyPassword($sender, $args)
 {
     if ($this->plugin->passChange) {
         if (in_array($args[1])) {
             $pass = $args[1];
             $pass = md5($pass);
             $this->plugin->chatprotection[$sender->getId()] = $pass;
             if ($this->plugin->provider === "yml") {
                 $myuser = new Config($this->plugin->getDataFolder() . "players/" . strtolower($event->getPlayer()->getName() . ".yml"), Config::YAML);
                 $myuser->set("password", $pass);
                 $myuser->set("version", $this->pluin->version);
                 $Myuser->save();
             } elseif ($this->plugin->provider === "mysql") {
             }
         }
     }
 }
Пример #12
0
 /**
  * @param Block $block
  */
 public function saveBlock(Block $block)
 {
     $this->blocks[$block->getPosition()->getX() . ":" . $block->getPosition()->getY() . ":" . $block->getPosition()->getZ() . ":" . $block->getPosition()->getLevel()->getName()] = $block;
     $blocks = $this->config->get("blocks");
     $blocks[$block->id] = $block->toArray();
     $this->config->set("blocks", $blocks);
     $this->config->save();
 }
 /**
  * Add a new 1vs1 sign
  */
 public function addSign(Sign $signTile)
 {
     $signs = $this->config->signs;
     $signs[count($this->signTiles)] = [$signTile->getX(), $signTile->getY(), $signTile->getZ(), $signTile->getLevel()->getName()];
     $this->config->set("signs", $signs);
     $this->config->save();
     array_push($this->signTiles, $signTile);
 }
Пример #14
0
 public function saveConfig()
 {
     $this->mineData->setAll([]);
     foreach ($this->mines as $n => $mine) {
         $this->mineData->set($n, [$mine->getA()->getX(), $mine->getB()->getX(), $mine->getA()->getY(), $mine->getB()->getY(), $mine->getA()->getZ(), $mine->getB()->getZ(), count($mine->getData()) > 0 ? $mine->getData() : false, $mine->getLevel()->getName()]);
     }
     $this->mineData->save();
 }
 public function updatePerms()
 {
     foreach ($this->getServer()->getPluginManager()->getPermissions() as $perm) {
         if (!$this->permsConfig->exists($perm->getName(), true)) {
             $this->permsConfig->set(strtolower($perm->getName()), $this->getDefaultIndex($perm->getDefault()));
         }
     }
     $all = $this->permsConfig->getAll();
     asort($all, SORT_FLAG_CASE | SORT_NATURAL);
     $this->permsConfig->setAll($all);
 }
Пример #16
0
 public function addShop($x, $y = 0, $z = 0, $level = null, $data = [])
 {
     if ($x instanceof Position) {
         $data = $y;
         $y = $x->getFloorY();
         $z = $x->getFloorZ();
         $level = $x->getLevel();
         $x = $x->getFloorX();
     }
     if ($level instanceof Level) {
         $level = $level->getFolderName();
     }
     if ($this->config->exists($x . ":" . $y . ":" . $z . ":" . $level)) {
         return false;
     }
     $this->config->set($x . ":" . $y . ":" . $z . ":" . $level, $data);
     if ($this->save) {
         $this->save();
     }
     return true;
 }
 public function updatePlayer(IPlayer $player, $type)
 {
     $name = strtolower($player->getName());
     if ($this->playerExists($player)) {
         @mkdir($this->plugin->getDataFolder() . "players/" . $name . ".yml");
         $data = new Config($this->plugin->getDataFolder() . "players/" . $name . ".yml");
         $data->set($type, $data->getAll()[$type] + 1);
         return $data->save();
     } else {
         $this->addPlayer($player);
     }
 }
Пример #18
0
 private function leaveJob($username, $job)
 {
     $slots = $this->users->get($username);
     if ($slots['slot1'] === $job) {
         $this->users->set($username, array('slot1' => null, 'slot2' => $slots['slot2']));
         $this->users->save();
         $this->getServer()->getPlayer($username)->sendMessage("Remove {$job} from your job slot1");
     } elseif ($slots['slot2'] === $job) {
         $this->users->set($username, array('slot1' => $slots['slot1'], 'slot2' => null));
         $this->users->save();
         $this->getServer()->getPlayer($username)->sendMessage("Remove {$job} from your job slot2");
     } else {
         $this->getServer()->getPlayer($username)->sendMessage("You are not part of {$job}");
     }
 }
Пример #19
0
 /**
  * Refreshes all resettable chests
  */
 public function refreshChests()
 {
     foreach ($this->chests as $chest) {
         if ($chest instanceof Chest) {
             //pocketmine\tile\Chest
             if (!$this->config->chestitems) {
                 $this->config->set('chestitems', []);
                 $this->config->save();
             } else {
                 $items = $this->config->chestitems;
                 $inventory = $chest->getInventory();
                 $inventory->clearAll();
                 for ($i = 0; $i < 10; $i++) {
                     $inventory->setItem(rand(1, 27), Item::get($items[rand(0, count($items) - 1)]));
                 }
             }
         }
     }
     Server::getInstance()->broadcastTip(TextFormat::DARK_BLUE . "[HungerGames]" . TextFormat::WHITE . " Chests have been refilled", $this->getPlayers());
 }
 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     //Getting Victim
     $victim = $event->getEntity();
     if ($victim instanceof Player) {
         $vdata = new Config($this->getDataFolder() . "data/" . strtolower($victim->getName()) . ".yml", Config::YAML);
         //Check victim data
         if ($vdata->exists("kills") && $vdata->exists("deaths")) {
             $vdata->set("deaths", $vdata->get("deaths") + 1);
             $vdata->save();
         } else {
             $vdata->setAll(array("kills" => 0, "deaths" => 1));
             //Add first death
             $vdata->save();
         }
         $cause = $event->getEntity()->getLastDamageCause()->getCause();
         if ($cause == 1) {
             //Killer is an entity
             //Get Killer Entity
             $killer = $event->getEntity()->getLastDamageCause()->getDamager();
             //Get if the killer is a player
             if ($killer instanceof Player) {
                 //Get killer data
                 $kdata = new Config($this->getDataFolder() . "data/" . strtolower($killer->getName()) . ".yml", Config::YAML);
                 //Check killer data
                 if ($kdata->exists("kills") && $kdata->exists("deaths")) {
                     $kdata->set("kills", $kdata->get("kills") + 1);
                     $kdata->save();
                 } else {
                     $kdata->setAll(array("kills" => 1, "deaths" => 0));
                     //Add first kill
                     $kdata->save();
                 }
             }
         }
     }
 }
Пример #21
0
 public function save($path)
 {
     $path = $path . self::DIR_LEVEL_DATA;
     if (!file_exists($path)) {
         @mkdir($path, 0755, true);
     }
     $name = $this->name;
     $data = new Config($path . "{$name}.yml", Config::YAML);
     if (empty($this->levelName)) {
         $this->plugin->getLogger()->error("[GameLevel] missing name - level Name is NULL -" . $this->name);
         return false;
     }
     if (empty($this->name)) {
         $this->plugin->getLogger()->error("[GameLevel] missing name -  Name is NULL -" . $this->name);
         return false;
     }
     $data->set("id", time());
     $data->set("name", $this->name);
     $data->set("type", $this->type == null ? self::TYPE_MAP_PORTAL : $this->type);
     if (empty($this->displayName)) {
         $this->displayName = $this->name;
     }
     $data->set("displayName", $this->displayName);
     $data->set("levelName", $this->levelName);
     $data->set("waitCountDown", $this->waitCountDown);
     $data->set("minPlayers", $this->minPlayers);
     $data->set("maxPlayers", $this->maxPlayers);
     $data->set("type", $this->type);
     $data->set("joinDownCounter", $this->joinDownCounter);
     $data->set("particles", $this->particles);
     $data->set("winnerCoins", $this->winnerCoins);
     // locations
     if ($this->location != null) {
         $data->set("locationX", $this->location->x);
         $data->set("locationY", $this->location->y);
         $data->set("locationZ", $this->location->z);
     }
     if ($this->gatePos1 != null) {
         $data->set("gatePos1X", $this->gatePos1->x);
         $data->set("gatePos1Y", $this->gatePos1->y);
         $data->set("gatePos1Z", $this->gatePos1->z);
     }
     if ($this->gatePos2 != null) {
         $data->set("gatePos2X", $this->gatePos2->x);
         $data->set("gatePos2Y", $this->gatePos2->y);
         $data->set("gatePos2Z", $this->gatePos2->z);
     }
     if ($this->signJoin != null && $this->signJoin != false) {
         $data->set("signJoinX", round($this->signJoin->x));
         $data->set("signJoinY", round($this->signJoin->y));
         $data->set("signJoinZ", round($this->signJoin->z));
     }
     if ($this->signJoin2 != null && $this->signJoin2 != false) {
         $data->set("signJoin2X", round($this->signJoin2->x));
         $data->set("signJoin2Y", round($this->signJoin2->y));
         $data->set("signJoin2Z", round($this->signJoin2->z));
     }
     if ($this->signStats != null && $this->signStats != false) {
         $data->set("signStatsX", round($this->signStats->x));
         $data->set("signStatsY", round($this->signStats->y));
         $data->set("signStatsZ", round($this->signStats->z));
     }
     if ($this->signExit != null && $this->signExit != false) {
         $data->set("signExitX", round($this->signExit->x));
         $data->set("signExitY", round($this->signExit->y));
         $data->set("signExitZ", round($this->signExit->z));
     }
     if (!empty($this->enterLevelName)) {
         $data->set("enterLevelName", $this->enterLevelName);
         if ($this->enterpos != null) {
             $data->set("entranceX", $this->enterpos->x);
             $data->set("entranceY", $this->enterpos->y);
             $data->set("entranceZ", $this->enterpos->z);
         }
     }
     if (!empty($this->exitLevelName)) {
         $data->set("exitLevelName", $this->exitLevelName);
         if ($this->exitpos != null) {
             $data->set("exitX", $this->exitpos->x);
             $data->set("exitY", $this->exitpos->y);
             $data->set("exitZ", $this->exitpos->z);
         }
     }
     if (!empty($this->mapselectLevelName)) {
         $data->set("mapselectLevelName", $this->mapselectLevelName);
         if ($this->mapselectpos != null) {
             $data->set("mapselectX", $this->mapselectpos->x);
             $data->set("mapselectY", $this->mapselectpos->y);
             $data->set("mapselectZ", $this->mapselectpos->z);
         }
     }
     if ($this->portalEnterPos1 != null) {
         $data->set("portalEnter1X", $this->portalEnterPos1->x);
         $data->set("portalEnter1Y", $this->portalEnterPos1->y);
         $data->set("portalEnter1Z", $this->portalEnterPos1->z);
     }
     if ($this->portalEnterPos2 != null) {
         $data->set("portalEnter2X", $this->portalEnterPos2->x);
         $data->set("portalEnter2Y", $this->portalEnterPos2->y);
         $data->set("portalEnter2Z", $this->portalEnterPos2->z);
     }
     $data->set("mapSelectionWaitTime", $this->mapSelectionWaitTime);
     $data->set("maps", $this->maps);
     $data->save();
     return true;
 }
Пример #22
0
 public function onCommand(CommandSender $sender, Command $command, $label, array $params)
 {
     switch (array_shift($params)) {
         case "join":
             if (!$sender instanceof Player) {
                 $sender->sendMessage("Please run this command in-game.");
             }
             if ($this->player->exists($sender->getName())) {
                 $sender->sendMessage("You already have joined job.");
             } else {
                 $job = array_shift($params);
                 if (trim($job) === "") {
                     $sender->sendMessage("Usage: /job join <name>");
                     break;
                 }
                 if ($this->jobs->exists($job)) {
                     $this->player->set($sender->getName(), $job);
                     $sender->sendMessage("You have joined to the job \"{$job}\"");
                 } else {
                     $sender->sendMessage("There's no job named \"{$job}\"");
                 }
             }
             break;
         case "retire":
             if (!$sender instanceof Player) {
                 $sender->sendMessage("Please run this command in-game.");
             }
             if ($this->player->exists($sender->getName())) {
                 $job = $this->player->get($sender->getName());
                 $this->player->remove($sender->getName());
                 $sender->sendMessage("You have retired from the job \"{$job}\"");
             } else {
                 $sender->sendMessage("You don't have job that you've joined");
             }
             break;
         case "list":
             $max = 0;
             foreach ($this->jobs->getAll() as $d) {
                 $max += count($d);
             }
             $max = ceil($max / 5);
             $page = array_shift($params);
             $page = max(1, $page);
             $page = min($max, $page);
             $page = (int) $page;
             $current = 1;
             $n = 1;
             $output = "Showing job list page {$page} of {$max} : \n";
             foreach ($this->jobs->getAll() as $name => $job) {
                 $info = "";
                 foreach ($job as $id => $money) {
                     $cur = (int) ceil($n / 5);
                     if ($cur === $page) {
                         $info .= $name . " : " . $id . " | " . EconomyAPI::getInstance()->getMonetaryUnit() . "" . $money . "\n";
                     } elseif ($cur > $page) {
                         break;
                     }
                     ++$n;
                 }
                 $output .= $info;
             }
             $sender->sendMessage($output);
             break;
         case "me":
             if (!$sender instanceof Player) {
                 $sender->sendMessage("Please run this command in-game.");
             }
             if ($this->player->exists($sender->getName())) {
                 $sender->sendMessage("Your job : " . $this->player->get($sender->getName()));
             } else {
                 $sender->sendMessage("You don't have any jobs you've joined.");
             }
             break;
         default:
             $sender->sendMessage($command->getUsage());
     }
     return true;
 }
Пример #23
0
 /**
  * @param Player $player
  */
 public function saveNameTag(Player $player)
 {
     $this->nametags->set(strtolower($player->getName()), $player->getNameTag());
     $this->nametags->save();
 }
Пример #24
0
 public function lockChest($level, $x, $y, $z, $player)
 {
     @mkdir($this->data . Main::_DIRECTORY . strtolower($level . "/"));
     if (file_exists($this->data . Main::_DIRECTORY . strtolower($level . "/") . strtolower($x . Main::_FILE . $y . Main::_FILE . $z . ".yml"))) {
         return false;
         //Error: Chest already registered
     } else {
         $chest = new Config($this->data . Main::_DIRECTORY . strtolower($level . "/") . strtolower($x . Main::_FILE . $y . Main::_FILE . $z . ".yml"), Config::YAML);
         $chest->set("player", $player);
         $chest->save();
         return true;
         //Success!
     }
 }
Пример #25
0
 /**
  * Change player password
  * 
  * @param Player $player
  * @param string $new_password
  * 
  * @return int|boolean true on SUCCESS or false if the player is not registered, otherwise the current error
  */
 public function changePlayerPassword(Player $player, $new_password)
 {
     $cfg = $this->getConfig()->getAll();
     if ($this->isPlayerRegistered($player->getName())) {
         if (strlen($new_password) < $cfg["minPasswordLength"]) {
             return ServerAuth::ERR_PASSWORD_TOO_SHORT;
         } elseif (strlen($new_password) > $cfg["maxPasswordLength"]) {
             return ServerAuth::ERR_PASSWORD_TOO_LONG;
         } else {
             $this->getServer()->getPluginManager()->callEvent($event = new Events\ServerAuthPasswordChangeEvent($player, $new_password));
             if ($event->isCancelled()) {
                 return ServerAuth::CANCELLED;
             }
             if ($this->getDataProvider()) {
                 //Check MySQL connection
                 if ($this->getDatabase() && $this->getDatabase()->ping()) {
                     $query = "UPDATE " . $this->getDatabaseConfig()["table_prefix"] . "serverauthdata SET password='******' WHERE user='******'";
                     if ($this->getDatabase()->query($query)) {
                         return ServerAuth::SUCCESS;
                     } else {
                         return ServerAuth::ERR_GENERIC;
                     }
                 } else {
                     return ServerAuth::ERR_GENERIC;
                 }
             } else {
                 $data = new Config($this->getDataFolder() . "users/" . strtolower($player->getName() . ".yml"), Config::YAML);
                 $data->set("password", hash($this->getPasswordHash(), $new_password));
                 $data->save();
                 return ServerAuth::SUCCESS;
             }
         }
     } else {
         return $this->isPlayerRegistered($player->getName());
     }
 }
Пример #26
0
 /** 
  * @param string $player 
  */
 public function addBackup($player)
 {
     $this->backups->set(strtolower($player));
     $this->backups->save();
 }
Пример #27
0
 /**
  * @param string $name
  */
 public function addWhitelist($name)
 {
     $this->whitelist->set(strtolower($name), true);
     $this->whitelist->save(true);
 }
Пример #28
0
 public function proccessPassword($password, $type, $player)
 {
     if ($this->simplePassword === true && $this->plugin->status === "enabled") {
         if ($password === 123456789 || $password === 987654321 || $password === "asdfg" || $password === "password") {
             $player->sendMessage("[xAuth] That password is too simple!");
             $player->sendMessage("[xAuth] Make it harder by adding letters and numbers!");
             return;
         }
     }
     $myuser = new Config($this->myuser . "users/" . strtolower($player->getName() . ".yml"), Config::YAML);
     if ($type === 0 && $this->plugin->status === "enabled") {
         if (strlen($password) > 5) {
             $player->sendMessage("[xAuth] Your password was too short!");
             return;
         }
         if (strlen($password) < 15) {
             $player->sendMessage("[xAuth] Your password was too long!");
             return;
         }
         $myuser->set("password", md5($password));
         $myuser->save();
     } else {
         if ($this->plugin->status === "enabled") {
             return md5($password);
         }
     }
 }
Пример #29
0
 private function networkFunctions()
 {
     $config = new Config(\pocketmine\DATA . "server.properties", Config::PROPERTIES);
     echo "[!] " . $this->lang->query_warning1 . "\n";
     echo "[!] " . $this->lang->query_warning2 . "\n";
     echo "[?] " . $this->lang->query_disable . " (y/N): ";
     if (strtolower($this->getInput("n")) === "y") {
         $config->set("enable-query", false);
     } else {
         $config->set("enable-query", true);
     }
     echo "[*] " . $this->lang->rcon_info . "\n";
     echo "[?] " . $this->lang->rcon_enable . " (y/N): ";
     if (strtolower($this->getInput("n")) === "y") {
         $config->set("enable-rcon", true);
         $password = substr(base64_encode(@Utils::getRandomBytes(20, false)), 3, 10);
         $config->set("rcon.password", $password);
         echo "[*] " . $this->lang->rcon_password . ": " . $password . "\n";
     } else {
         $config->set("enable-rcon", false);
     }
     /*echo "[*] " . $this->lang->usage_info . "\n";
     		echo "[?] " . $this->lang->usage_disable . " (y/N): ";
     		if(strtolower($this->getInput("n")) === "y"){
     			$config->set("send-usage", false);
     		}else{
     			$config->set("send-usage", true);
     		}*/
     $config->save();
     echo "[*] " . $this->lang->ip_get . "\n";
     $externalIP = Utils::getIP();
     $internalIP = gethostbyname(trim(`hostname`));
     echo "[!] " . $this->lang->get("ip_warning", ["{{EXTERNAL_IP}}", "{{INTERNAL_IP}}"], [$externalIP, $internalIP]) . "\n";
     echo "[!] " . $this->lang->ip_confirm;
     $this->getInput();
 }
Пример #30
-1
 public function unsetPermission(Player $player, Zone $zone)
 {
     $zoneName = $zone->getName();
     $data = $this->permConfig->get($player->getName() . ".permissions", []);
     if (count($data) == 0 || !array_key_exists($zoneName, $data)) {
         return false;
     }
     unset($data[$zoneName]);
     $this->permConfig->set($player->getName() . ".permissions", $data);
     return true;
 }