Package ch.njol.skript.lang.parser
Class DefaultValueData
java.lang.Object
ch.njol.skript.lang.parser.ParserInstance.Data
ch.njol.skript.lang.parser.DefaultValueData
A Parser Data that stores custom default values that should be given preference over event-values and other
traditional default values.
These do not apply to arithmetic or other dynamic default values, they're only supplied during parsing.
These do not apply to arithmetic or other dynamic default values, they're only supplied during parsing.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> void
addDefaultValue
(Class<T> type, DefaultExpression<T> value) Sets the default value for type to value.<T> @Nullable DefaultExpression
<T> getDefaultValue
(Class<T> type) Gets the default value for the given type.void
removeDefaultValue
(Class<?> type) Removes a default value from the data.Methods inherited from class ch.njol.skript.lang.parser.ParserInstance.Data
getParser, onCurrentEventsChange, onCurrentScriptChange
-
Constructor Details
-
DefaultValueData
-
-
Method Details
-
addDefaultValue
Sets the default value for type to value.
Any custom default values should be removed after they go out of scope. It will not be done automatically.- Type Parameters:
T
- The class of this value.- Parameters:
type
- The class which this value applies to.value
- The value to use.- See Also:
-
getDefaultValue
Gets the default value for the given type.- Type Parameters:
T
- The class of this value.- Parameters:
type
- The class which this value applies to.- Returns:
- The default value for type, or null if none is set.
-
removeDefaultValue
Removes a default value from the data.
Default values are handled using stacks, so be sure to remove only what you have added. Nothing more, nothing less.- Parameters:
type
- Which class to remove the default value of.
-