Record Class CapabilityStatus

java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.platform.CapabilityStatus
Record Components:
id - the capability id, such as ZentrixCapabilities.GLIDER_DEPLOYMENT
state - whether it can be used, and if not, why
reason - a human-readable explanation when it is not available; null otherwise
provider - who reports it: "Zentrix" for built-in capabilities, otherwise the name of the plugin that registered it

public record CapabilityStatus(@NotNull String id, @NotNull CapabilityState state, @Nullable String reason, @NotNull String provider) extends Record
One capability as it stands on this server.
Since:
1.8.0
  • Field Details

    • ZENTRIX

      public static final String ZENTRIX
      The provider name of every capability Zentrix reports itself.
      See Also:
  • Constructor Details

    • CapabilityStatus

      public CapabilityStatus(@NotNull @NotNull String id, @NotNull @NotNull CapabilityState state, @Nullable @Nullable String reason, @NotNull @NotNull String provider)
      Creates an instance of a CapabilityStatus record class.
      Parameters:
      id - the value for the id record component
      state - the value for the state record component
      reason - the value for the reason record component
      provider - the value for the provider record component
  • Method Details

    • available

      @NotNull public static @NotNull CapabilityStatus available(@NotNull @NotNull String id, @NotNull @NotNull String provider)
      A usable capability.
    • unavailable

      @NotNull public static @NotNull CapabilityStatus unavailable(@NotNull @NotNull String id, @NotNull @NotNull CapabilityState state, @Nullable @Nullable String reason, @NotNull @NotNull String provider)
      A capability that cannot be used, and why.
    • unknown

      @NotNull public static @NotNull CapabilityStatus unknown(@NotNull @NotNull String id)
      An id this server does not know.
    • isAvailable

      public boolean isAvailable()
      Whether the capability can be used now.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      @NotNull public @NotNull String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • state

      @NotNull public @NotNull CapabilityState state()
      Returns the value of the state record component.
      Returns:
      the value of the state record component
    • reason

      @Nullable public @Nullable String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component
    • provider

      @NotNull public @NotNull String provider()
      Returns the value of the provider record component.
      Returns:
      the value of the provider record component