Class DifficultyDependentNode<T>
java.lang.Object
dev.satyrn.papermc.api.configuration.v1.ConfigurationNode<Void>
dev.satyrn.papermc.api.configuration.v1.ContainerNode
dev.satyrn.papermc.api.configuration.v2.DifficultyDependentNode<T>
- Type Parameters:
T
- The value type, shared between each sub-node.
Represents a node which has a value dependent on difficulty.
- Since:
- 1.9.1
- Author:
- Isabel Maskrey
-
Constructor Summary
ModifierConstructorDescriptionprotected
DifficultyDependentNode
(@NotNull ConfigurationNode<?> parent, @NotNull String name) Initializes a new difficulty-dependent configuration node. -
Method Summary
Modifier and TypeMethodDescription@NotNull @Unmodifiable List<@NotNull ConfigurationNode<?>>
Gets an unmodifiable list of children for this node.protected @Nullable ConfigurationNode<T>
Gets the node instance for the easy difficulty value.protected @Nullable ConfigurationNode<T>
Gets the node instance for the hard difficulty value.protected @Nullable ConfigurationNode<T>
Gets the node instance for the normal difficulty value.protected @Nullable ConfigurationNode<T>
Gets the node instance for the peaceful difficulty value.final @NotNull String
Gets the name of the value node, which will be used if this node contains children and a value.void
save()
Writes the value of the node and its children to the config file.final void
Sets the value of the node for a specific difficulty.value
(@NotNull org.bukkit.Difficulty difficulty) Gets a value specific to the given difficulty value.Methods inherited from class dev.satyrn.papermc.api.configuration.v1.ContainerNode
defaultValue, setConfigValue, toString, value
Methods inherited from class dev.satyrn.papermc.api.configuration.v1.ConfigurationNode
addChild, equals, getBasePath, getBasePath, getComments, getComments, getConfig, getInlineComments, getInlineComments, getLogger, getName, getPath, getPath, getPlugin, getPriority, getSLF4JLogger, getValuePath, getValuePath, hasChildren, hasName, isSubNode, setComments, setComments, setInlineComments, setInlineComments, setValue, toString
-
Constructor Details
-
DifficultyDependentNode
protected DifficultyDependentNode(@NotNull @NotNull ConfigurationNode<?> parent, @NotNull @NotNull String name) Initializes a new difficulty-dependent configuration node.- Parameters:
parent
- The parent node.name
- The node name.- Since:
- 1.9.1
-
-
Method Details
-
getPeacefulNode
Gets the node instance for the peaceful difficulty value.- Returns:
- The peaceful node.
- Since:
- 1.9.1
-
getEasyNode
Gets the node instance for the easy difficulty value.- Returns:
- The easy node.
- Since:
- 1.9.1
-
getNormalNode
Gets the node instance for the normal difficulty value.- Returns:
- The normal node.
- Since:
- 1.9.1
-
getHardNode
Gets the node instance for the hard difficulty value.- Returns:
- The hard node.
- Since:
- 1.10.0
-
getValueNodeName
Gets the name of the value node, which will be used if this node contains children and a value.Defaults to "value" for most node types.
- Overrides:
getValueNodeName
in classConfigurationNode<Void>
- Returns:
- The name of the value node.
- Since:
- 1.10.0
-
value
Gets a value specific to the given difficulty value.- Parameters:
difficulty
- The difficulty of the current world.- Returns:
- The value of the node for that difficulty.
- Since:
- 1.10.0
-
setValue
Sets the value of the node for a specific difficulty.- Parameters:
difficulty
- The difficulty level.value
- The value of the node at the difficulty level.- Since:
- 1.10.0
-
save
public void save()Writes the value of the node and its children to the config file.- Overrides:
save
in classContainerNode
- Since:
- 1.10.0
-
getChildren
Gets an unmodifiable list of children for this node.- Overrides:
getChildren
in classConfigurationNode<Void>
- Returns:
- An unmodifiable list of the item's children.
- Since:
- 1.10.0
-