Class ValueContainer<T extends Number>
java.lang.Object
me.remigio07.chatplugin.api.common.util.ValueContainer<T>
- Type Parameters:
T- Value type
Util class used to contain a value that can be either
a fixed number or a placeholder's variable value.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbytebyteValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) Translatesvalue()orplaceholder()into a string containing a byte value.doubledoubleValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) Translatesvalue()orplaceholder()into a string containing a double value.floatfloatValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) Translatesvalue()orplaceholder()into a string containing a float value.intintValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) Translatesvalue()orplaceholder()into a string containing an integer value.longlongValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) Translatesvalue()orplaceholder()into a string containing a long value.Gets this container's placeholder.shortshortValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) Translatesvalue()orplaceholder()into a string containing a short value.value()Gets this container's fixed value.
-
Constructor Details
-
Method Details
-
placeholder
Gets this container's placeholder.Will return
nullif a fixed value was specified at construction.- Returns:
- Container's placeholder
-
value
Gets this container's fixed value.Will return
nullif a placeholder was specified at construction.- Returns:
- Container's fixed value
-
byteValue
public byte byteValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) throws NumberFormatException Translatesvalue()orplaceholder()into a string containing a byte value.- Parameters:
placeholderTypes- Placeholder types containingplaceholder()player- Player whose placeholders need to be translated- Returns:
- Translated value or placeholder
- Throws:
NumberFormatException- If the placeholder is invalid
-
shortValue
public short shortValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) throws NumberFormatException Translatesvalue()orplaceholder()into a string containing a short value.- Parameters:
placeholderTypes- Placeholder types containingplaceholder()player- Player whose placeholders need to be translated- Returns:
- Translated value or placeholder
- Throws:
NumberFormatException- If the placeholder is invalid
-
intValue
public int intValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) throws NumberFormatException Translatesvalue()orplaceholder()into a string containing an integer value.- Parameters:
placeholderTypes- Placeholder types containingplaceholder()player- Player whose placeholders need to be translated- Returns:
- Translated value or placeholder
- Throws:
NumberFormatException- If the placeholder is invalid
-
longValue
public long longValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) throws NumberFormatException Translatesvalue()orplaceholder()into a string containing a long value.- Parameters:
placeholderTypes- Placeholder types containingplaceholder()player- Player whose placeholders need to be translated- Returns:
- Translated value or placeholder
- Throws:
NumberFormatException- If the placeholder is invalid
-
floatValue
public float floatValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) throws NumberFormatException Translatesvalue()orplaceholder()into a string containing a float value.- Parameters:
placeholderTypes- Placeholder types containingplaceholder()player- Player whose placeholders need to be translated- Returns:
- Translated value or placeholder
- Throws:
NumberFormatException- If the placeholder is invalid
-
doubleValue
public double doubleValue(List<PlaceholderType> placeholderTypes, ChatPluginServerPlayer player) throws NumberFormatException Translatesvalue()orplaceholder()into a string containing a double value.- Parameters:
placeholderTypes- Placeholder types containingplaceholder()player- Player whose placeholders need to be translated- Returns:
- Translated value or placeholder
- Throws:
NumberFormatException- If the placeholder is invalid
-