PHP Class pocketmine\level\GameRules

Show file Open project: ClearSkyTeam/ClearSky Class Usage Examples

Public Methods

Method Description
__construct ( CompoundTag $rules = null )
addGameRule ( $key, $value )
areSameType ( $key, $otherValue )
getRule ( $name ) : boolean | integer | string Return the game rule as bool, int or string
getRules ( ) : CompoundTag Return the defined game rules.
getRulesArray ( ) Return the defined game rules as array
hasRule ( $name ) Return if the specified game rule is defined
readFromNBT ( CompoundTag $nbt ) Set defined game rules from NBT.
save ( Level $level )
setOrCreateGameRule ( $key, $ruleValue )
writeToNBT ( ) Return the defined game rules as NBT.

Private Methods

Method Description
toArray ( array &$data, Tag $tag )

Method Details

__construct() public method

public __construct ( CompoundTag $rules = null )
$rules pocketmine\nbt\tag\CompoundTag

addGameRule() public method

public addGameRule ( $key, $value )

areSameType() public method

public areSameType ( $key, $otherValue )

getRule() public method

Return the game rule as bool, int or string
public getRule ( $name ) : boolean | integer | string
return boolean | integer | string $rule

getRules() public method

Return the defined game rules.
public getRules ( ) : CompoundTag
return pocketmine\nbt\tag\CompoundTag

getRulesArray() public method

Return the defined game rules as array
public getRulesArray ( )

hasRule() public method

Return if the specified game rule is defined
public hasRule ( $name )

readFromNBT() public method

Set defined game rules from NBT.
public readFromNBT ( CompoundTag $nbt )
$nbt pocketmine\nbt\tag\CompoundTag

save() public method

public save ( Level $level )
$level Level

setOrCreateGameRule() public method

public setOrCreateGameRule ( $key, $ruleValue )

writeToNBT() public method

Return the defined game rules as NBT.
public writeToNBT ( )