Class TextCodingValue
java.lang.Object
ua.mcchickenstudio.opencreative.indev.values.CodingValue<String>
ua.mcchickenstudio.opencreative.indev.values.TextCodingValue
- All Implemented Interfaces:
ChatEditableValue, InteractableValue
public class TextCodingValue
extends CodingValue<String>
implements ChatEditableValue, InteractableValue
TextCodingValue
This class represents a coding value, that stores text (string).-
Nested Class Summary
Nested classes/interfaces inherited from class CodingValue
CodingValue.Saver -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Stringdeserialize(@NotNull Object value, @NotNull CodingValue.Saver type) Parses object and creates value from it.voidonPlayerChat(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item, @NotNull String message) Used for doing actions, when player sends chat message with item in hand.booleanonPlayerInteract(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item, @NotNull org.bukkit.event.player.PlayerInteractEvent event) Used for doing actions, when player clicks with item in hand.@NotNull Objectserialize(@NotNull String value, @NotNull CodingValue.Saver type) Saves value as string or map object to save it in file.
-
Constructor Details
-
TextCodingValue
public TextCodingValue()
-
-
Method Details
-
onPlayerChat
public void onPlayerChat(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull String message) Description copied from interface:ChatEditableValueUsed for doing actions, when player sends chat message with item in hand.- Specified by:
onPlayerChatin interfaceChatEditableValue- Parameters:
player- player, that sent message with coding value in hand.item- item of value.
-
deserialize
@Nullable public @Nullable String deserialize(@NotNull @NotNull Object value, @NotNull @NotNull CodingValue.Saver type) Description copied from class:CodingValueParses object and creates value from it.- Specified by:
deserializein classCodingValue<String>- Parameters:
value- value to parse.type- type of saver (yaml or json).- Returns:
- value, or null - if failed to deserialize.
-
serialize
@NotNull public @NotNull Object serialize(@NotNull @NotNull String value, @NotNull @NotNull CodingValue.Saver type) Description copied from class:CodingValueSaves value as string or map object to save it in file.- Specified by:
serializein classCodingValue<String>- Parameters:
value- value to save.type- type of saver (yaml or json).- Returns:
- value, converted to YAML object.
-
onPlayerInteract
public boolean onPlayerInteract(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull org.bukkit.event.player.PlayerInteractEvent event) Description copied from interface:InteractableValueUsed for doing actions, when player clicks with item in hand.Returns whether action was done successfully.
- Specified by:
onPlayerInteractin interfaceInteractableValue- Parameters:
player- player, that interacted with coding value.item- item of value.event- event of interaction.- Returns:
- true - if action was done, false - interaction was ignored.
-