Class Argument

java.lang.Object
ua.mcchickenstudio.opencreative.coding.arguments.Argument

public class Argument extends Object

Argument

This class represents an argument, a field that has id, name (path) and value. It's used to get values, like text, numbers, locations etc.
See Also:
  • Field Details

    • planet

      @NotNull protected final @NotNull Planet planet
    • path

      @NotNull protected final @NotNull String path
    • type

      @NotNull protected final @NotNull ValueType type
    • value

      @NotNull protected final @NotNull Object value
  • Constructor Details

    • Argument

      public Argument(@NotNull @NotNull Planet planet, @NotNull @NotNull ValueType type, @NotNull @NotNull String path, @NotNull @NotNull Object value)
      Creates instance of argument.
      Parameters:
      planet - associated planet.
      type - type of value.
      path - name of argument.
      value - value.
  • Method Details

    • parseEntity

      @NotNull public static @NotNull String parseEntity(String text, ActionsHandler handler, Action action)
      Replaces placeholders in text with values.
      Parameters:
      text - text to parse.
      handler - handler to get some values.
      action - action to get some values.
      Returns:
      parsed text.
    • getPath

      @NotNull public @NotNull String getPath()
      Returns a name of argument.
      Returns:
      name of argument.
    • getType

      @NotNull public @NotNull ValueType getType()
      Returns type of value.
      Returns:
      type of value.
    • getValue

      @NotNull public @NotNull Object getValue(@NotNull @NotNull Action action)
      Returns value of argument.

      If value is a link to variable or event value with null value, it will return link instead of null. That prevents from null pointer problems.

      Parameters:
      action - action, that will be used, to parse text placeholders.
      Returns:
      value of argument.
    • isList

      public boolean isList()
      Checks whether variable is a list.
      Returns:
      true - is list, false - not a list.
    • toString

      @NotNull public @NotNull String toString()
      Overrides:
      toString in class Object