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).
  • 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: ChatEditableValue
      Used for doing actions, when player sends chat message with item in hand.
      Specified by:
      onPlayerChat in interface ChatEditableValue
      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: CodingValue
      Parses object and creates value from it.
      Specified by:
      deserialize in class CodingValue<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: CodingValue
      Saves value as string or map object to save it in file.
      Specified by:
      serialize in class CodingValue<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: InteractableValue
      Used for doing actions, when player clicks with item in hand.

      Returns whether action was done successfully.

      Specified by:
      onPlayerInteract in interface InteractableValue
      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.