public final class GameRuleManager extends Object implements DynamicallyTypedMap<String>
| Constructor and Description |
|---|
GameRuleManager()
Creates an instance with the vanilla game rules.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getBoolean(@NonNls String rule)
Gets the game rule value as a boolean.
|
int |
getInt(@NonNls String key)
Retrieves an entry as an
int. |
int |
getInt(@NonNls String rule,
int def)
Gets the game rule value as an integer.
|
String[] |
getKeys()
Gets all of the game rules defined.
|
String |
getString(String rule)
Gets the game rule value as a string.
|
boolean |
isGameRule(@NonNls String rule)
Gets whether or not the supplied rule is defined.
|
boolean |
setValue(@NonNls String rule,
Object value)
Sets the value of a game rule.
|
public GameRuleManager()
public String[] getKeys()
public boolean setValue(@NonNls
@NonNls String rule,
Object value)
Sets the value of a game rule.
The actual object value is never stored, only the string value.
The helper methods provided in this class may be used to retrieve the value, such as
getBoolean(String).
rule - the rule to set, cannot be nullvalue - the value to set, cannot be null or be represented as nullpublic boolean isGameRule(@NonNls
@NonNls String rule)
rule - the rule to lookuppublic String getString(String rule)
getString in interface DynamicallyTypedMap<String>rule - the rule to look uppublic boolean getBoolean(@NonNls
@NonNls String rule)
getBoolean in interface DynamicallyTypedMap<String>rule - the rule to look uppublic int getInt(@NonNls
@NonNls String key)
DynamicallyTypedMapint.getInt in interface DynamicallyTypedMap<String>key - the key to look uppublic int getInt(@NonNls
@NonNls String rule,
int def)
rule - the rule to look updef - the default valueCopyright © 2021. All rights reserved.