Skip to content

Config ​

class · pocketmine\utils\Config · source

Config Class for simple config manipulation of multiple formats.

Constants ​

CNF ​

php
public const CNF = \pocketmine\utils\Config::PROPERTIES

DETECT ​

php
public const DETECT = -1

ENUM ​

php
public const ENUM = 5

ENUMERATION ​

php
public const ENUMERATION = \pocketmine\utils\Config::ENUM

JSON ​

php
public const JSON = 1

PROPERTIES ​

php
public const PROPERTIES = 0

SERIALIZED ​

php
public const SERIALIZED = 4

YAML ​

php
public const YAML = 2

Properties ​

$formats ​

php
public static array $formats

Methods ​

__construct() ​

php
public function __construct(string $file, int $type = \pocketmine\utils\Config::DETECT, array $default = [])

__get() ​

php
public function __get($k)

__isset() ​

php
public function __isset($k)

__set() ​

php
public function __set($k, $v) : void

__unset() ​

php
public function __unset($k)

disableJsonOption() ​

php
public function disableJsonOption(int $option) : \pocketmine\utils\Config

Disables the given option for the JSON encoding when saving

enableJsonOption() ​

php
public function enableJsonOption(int $option) : \pocketmine\utils\Config

Enables the given option in addition to the currently set JSON options

exists() ​

php
public function exists(string $k, bool $lowercase = false) : bool

fixYAMLIndexes() ​

php
public static function fixYAMLIndexes(string $str) : string

get() ​

php
public function get(string $k, mixed $default = false) : mixed

getAll() ​

php
public function getAll(bool $keys = false) : array

getJsonOptions() ​

php
public function getJsonOptions() : int

Returns the options for the JSON encoding when saving

getNested() ​

php
public function getNested(string $key, mixed $default = null) : mixed

getPath() ​

php
public function getPath() : string

Returns the path of the config.

hasChanged() ​

php
public function hasChanged() : bool

parseList() ​

php
public static function parseList(string $content) : array

parseProperties() ​

php
public static function parseProperties(string $content) : array

reload() ​

php
public function reload() : void

Removes all the changes in memory and loads the file again

remove() ​

php
public function remove(string $k) : void

removeNested() ​

php
public function removeNested(string $key) : void

save() ​

php
public function save() : void

Flushes the config to disk in the appropriate format.

set() ​

php
public function set(string $k, mixed $v = true) : void

setAll() ​

php
public function setAll(array $v) : void

setChanged() ​

php
public function setChanged(bool $changed = true) : void

setDefaults() ​

php
public function setDefaults(array $defaults) : void

setJsonOptions() ​

php
public function setJsonOptions(int $options) : \pocketmine\utils\Config

Sets the options for the JSON encoding when saving

setNested() ​

php
public function setNested(string $key, mixed $value) : void

writeList() ​

php
public static function writeList(array $entries) : string

writeProperties() ​

php
public static function writeProperties(array $config) : string

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.