本文整理汇总了PHP中pocketmine\utils\Config::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::set方法的具体用法?PHP Config::set怎么用?PHP Config::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\utils\Config
的用法示例。
在下文中一共展示了Config::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setExempt
/**
* @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();
}
}
示例2: onLoad
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");
}
示例3: registerPlayer
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();
}
示例4: onCommand
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;
}
示例5: checkConfig
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: add
public function add($name, $warp)
{
$past = $this->config->get($name, null);
$this->config->set($name, $warp);
$this->config->save();
return $past;
}
示例7: touchIP
public function touchIP($ip)
{
if (!$this->ipList->exists($ip)) {
$this->ipList->set($ip);
return false;
}
return true;
}
示例8: checkUpdate
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: onJoin
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();
}
}
示例10: setPlayer
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: changeMyPassword
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: saveBlock
/**
* @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();
}
示例13: addSign
/**
* 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: saveConfig
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();
}
示例15: updatePerms
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);
}