本文整理汇总了PHP中pocketmine\utils\Config::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getAll方法的具体用法?PHP Config::getAll怎么用?PHP Config::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\utils\Config
的用法示例。
在下文中一共展示了Config::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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;
}
示例3: onEnable
public function onEnable()
{
@mkdir($this->getDataFolder());
$this->initMessage();
$this->config_File = new Config($this->getDataFolder() . "set-up.yml", Config::YAML, ["enable-snowing" => 1, "enable-sunlight" => 0]);
$this->config = $this->config_File->getAll();
$this->pk = new AddEntityPacket();
$this->pk->type = 81;
$this->pk->metadata = [Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 0], Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE, 0], Entity::DATA_AIR => [Entity::DATA_TYPE_SHORT, 10]];
$this->getServer()->getScheduler()->scheduleRepeatingTask(new SnowHalationTask($this), 4);
new OutEventListener($this);
$this->getServer()->getPluginManager()->registerEvents($this, $this);
}
示例4: getAllZone
public function getAllZone()
{
$data = $this->zonesConfig->getAll(false);
$zones = [];
foreach ($data as $id => $value) {
$level = $this->_plugin->getServer()->getLevelByName($value[2]);
if ($level == null) {
continue;
}
$pos1 = new Position($value[3][0], $value[3][1], $value[3][2], $level);
$pos2 = new Position($value[3][3], $value[3][4], $value[3][5], $level);
$zones[$value[0]] = new Zone($this->_plugin, $value[0], $value[1], $pos1, $pos2, $value[4]);
}
return $zones;
}
示例5: cfgSave
/**
* Save a config section to the plugins' config.yml
*
* @param str $key - section to save
* @param mixed $settings - settings to save
*/
public function cfgSave($key, $settings)
{
$cfg = new Config($this->getDataFolder() . "config.yml", Config::YAML);
$dat = $cfg->getAll();
$dat[$key] = $settings;
$cfg->setAll($dat);
$cfg->save();
}
示例6: reloadSign
public function reloadSign(Arena $arena)
{
foreach ($this->signs->getAll() as $var => $c) {
if ($c["arena"] === $arena->getName()) {
$this->spawnSign($this->posFromString($var), $c);
break;
}
}
}
示例7: tagExists
public function tagExists($tag)
{
foreach ($this->shopSign->getAll() as $key => $val) {
if ($tag == $key) {
return $val;
}
}
return false;
}
示例8: parseMines
public function parseMines()
{
foreach ($this->mineData->getAll() as $n => $m) {
if ($m[6] !== false) {
$this->mines[$n] = new Mine($this, new Vector3(min($m[0], $m[1]), min($m[2], $m[3]), min($m[4], $m[5])), new Vector3(max($m[0], $m[1]), max($m[2], $m[3]), max($m[4], $m[5])), $this->getServer()->getLevelByName($m[7]), $m[6]);
} else {
$this->mines[$n] = new Mine($this, new Vector3(min($m[0], $m[1]), min($m[2], $m[3]), min($m[4], $m[5])), new Vector3(max($m[0], $m[1]), max($m[2], $m[3]), max($m[4], $m[5])), $this->getServer()->getLevelByName($m[7]));
}
}
}
示例9: onEnable
public function onEnable()
{
// Initializing config files
$this->saveResource("config.yml");
$yml = new Config($this->getDataFolder() . "config.yml", Config::YAML);
$this->yml = $yml->getAll();
$this->getLogger()->debug("Config files have been saved!");
$this->getServer()->getPluginManager()->registerEvents($this, $this);
$this->getServer()->getLogger()->info(Color::BOLD . Color::GOLD . "M" . Color::AQUA . "TeamPvP " . Color::GREEN . "Enabled" . Color::RED . "!");
}
示例10: getWord
public function getWord($word)
{
if (file_exists($this->getDataFolder() . "denied-words/" . strtolower($word . ".yml"))) {
$data = new Config($this->getDataFolder() . "denied-words/" . strtolower($word . ".yml"), Config::YAML);
return $data->getAll();
} else {
return false;
//Word not found
}
}
示例11: 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);
}
示例12: onEnable
public function onEnable()
{
$this->getServer()->getPluginManager()->registerEvents($this, $this);
if (!file_exists($this->getDataFolder())) {
@mkdir($this->getDataFolder(), 0755, true);
}
$c = new Config($this->getDataFolder() . "country.yml", Config::YAML, array("en" => false, "us" => false, "fr" => false, "cn" => true, "in" => true, "sy" => true, "so" => true, "kr" => true));
$c->save();
$this->c = $c->getAll();
$this->reason = ["en" => "§aYou are not allowed to get in as of your living country", "us" => "§aYou are not allowed to get in as of your living country", "fr" => "§aYou are not allowed to get in as of your living country", "cn" => "§a你因为安全高风险国家的国家,一直踢。", "in" => "§aक्योंकि सुरक्षा के उच्च जोखिम वाले देशों के अपने देश, लात कर दिया गया है", "sy" => "§aكان بلدكم بسبب الدول عالية المخاطر الأمنية، ركلة.", "so" => "§aYour dalka sababtoo ah dalalka khatarta sare ammaanka, ayaa laad", "kr" => "§a당신의 나라는 보안 위험이 높은 국가이기 때문에, kick되었습니다."];
}
示例13: fixOldConfig
private function fixOldConfig()
{
$tempData = $this->config->getAll();
$version = $this->getDescription()->getVersion();
$tempData["version"] = $version;
if (!isset($tempData["default-factions-plugin"])) {
$tempData["default-factions-plugin"] = null;
}
if (isset($tempData["enable-multiworld-support"])) {
$tempData["enable-multiworld-chat"] = $tempData["enable-multiworld-support"];
unset($tempData["enable-multiworld-support"]);
}
if (isset($tempData["custom-no-fac-message"])) {
unset($tempData["custom-no-fac-message"]);
}
if (isset($tempData["groups"])) {
foreach ($tempData["groups"] as $groupName => $tempGroupData) {
if (isset($tempGroupData["default-chat"])) {
$tempGroupData["chat"] = $this->fixOldData($tempGroupData["default-chat"]);
unset($tempGroupData["default-chat"]);
} else {
$tempGroupData["chat"] = $this->fixOldData($tempGroupData["chat"]);
}
if (isset($tempGroupData["default-nametag"])) {
$tempGroupData["nametag"] = $this->fixOldData($tempGroupData["default-nametag"]);
unset($tempGroupData["default-nametag"]);
} else {
$tempGroupData["nametag"] = $this->fixOldData($tempGroupData["nametag"]);
}
if (isset($tempGroupData["worlds"])) {
foreach ($tempGroupData["worlds"] as $worldName => $worldData) {
if (isset($worldData["default-chat"])) {
$worldData["chat"] = $this->fixOldData($worldData["default-chat"]);
unset($worldData["default-chat"]);
} else {
$worldData["chat"] = $this->fixOldData($worldData["chat"]);
}
if (isset($worldData["default-nametag"])) {
$worldData["nametag"] = $this->fixOldData($worldData["default-nametag"]);
unset($worldData["default-nametag"]);
} else {
$worldData["nametag"] = $this->fixOldData($worldData["nametag"]);
}
$tempGroupData["worlds"][$worldName] = $worldData;
}
}
$tempData["groups"][$groupName] = $tempGroupData;
}
}
$this->config->setAll($tempData);
$this->config->save();
$this->config->reload();
$this->getLogger()->notice("Upgraded PureChat config.yml to the latest version");
}
示例14: updatePlayer
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);
}
}
示例15: preloadPortals
public function preloadPortals()
{
$path = $this->plugin->getDataFolder() . MapPortal::DIR_PORTAL_DATA;
if (!file_exists($path)) {
@mkdir($path, 0755, true);
}
$this->plugin->log("#loading portal " . $path);
$handler = opendir($path);
while (($filename = readdir($handler)) !== false) {
$this->plugin->getLogger()->info($filename);
if ($filename != "." && $filename != "..") {
$data = new Config($path . $filename, Config::YAML);
$data->getAll();
Server::getInstance()->loadLevel($data->get("levelName"));
$pLevel = Server::getInstance()->getLevelByName($data->get("levelName"));
$name = str_replace(".yml", "", $filename);
$name = $data->get("name");
$levelName = $data->get("levelName");
$portal = new MapPortal($this->plugin, $name);
$portal->levelName = $levelName;
$portal->displayName = $data->get("displayName");
$portal->type = $data->get("type");
if ($data->get("portalEnter1X") != null) {
$portal->portalEnterPos1 = new Position($data->get("portalEnter1X"), $data->get("portalEnter1Y"), $data->get("portalEnter1Z"), $pLevel);
}
if ($data->get("portalEnter2X") != null) {
$portal->portalEnterPos2 = new Position($data->get("portalEnter2X"), $data->get("portalEnter2Y"), $data->get("portalEnter2Z"), $pLevel);
}
if ($data->get("entranceX") != null) {
$portal->enterpos = new Position($data->get("entranceX"), $data->get("entranceY"), $data->get("entranceZ"));
}
if ($data->get("portalExit1X") != null) {
$portal->portalExitPos1 = new Position($data->get("portalExit1X"), $data->get("portalExit1Y"), $data->get("portalExit1Z"), $pLevel);
}
if ($data->get("portalExit2X") != null) {
$portal->portalExitPos2 = new Position($data->get("portalExit2X"), $data->get("portalExit2Y"), $data->get("portalExit2Z"), $pLevel);
}
if ($data->get("exitX") != null) {
$portal->exitpos = new Position($data->get("exitX"), $data->get("exitY"), $data->get("exitZ"));
}
if ($data->get("locationX") != null) {
$portal->location = new Position($data->get("locationX"), $data->get("locationY"), $data->get("locationZ"), $pLevel);
}
$portal->enterLevelName = $data->get("enterLevelName");
$portal->exitLevelName = $data->get("exitLevelName");
$portal->maps = $data->get("maps");
$this->portals[$name] = $portal;
}
}
closedir($handler);
}