Record Class WakeReason

java.lang.Object
java.lang.Record
fr.robie.machineengine.api.machine.WakeReason

public record WakeReason(@NotNull net.kyori.adventure.key.Key key) extends Record
Why a machine was woken (ARCHITECTURE.md ยง17.2). Addons signal their own reasons with external(Key); external reasons wake machines in any sleeping state except SchedulerState.DISABLED.
  • Field Details

    • RESOURCE_INSERTED

      public static final WakeReason RESOURCE_INSERTED
    • RESOURCE_EXTRACTED

      public static final WakeReason RESOURCE_EXTRACTED
    • INPUT_CHANGED

      public static final WakeReason INPUT_CHANGED
    • OUTPUT_AVAILABLE

      public static final WakeReason OUTPUT_AVAILABLE
    • NEIGHBOR_CHANGED

      public static final WakeReason NEIGHBOR_CHANGED
    • NETWORK_CHANGED

      public static final WakeReason NETWORK_CHANGED
    • UPGRADE_CHANGED

      public static final WakeReason UPGRADE_CHANGED
    • RECIPES_RELOADED

      public static final WakeReason RECIPES_RELOADED
    • CONFIG_CHANGED

      public static final WakeReason CONFIG_CHANGED
    • TIMER

      public static final WakeReason TIMER
    • CHUNK_LOADED

      public static final WakeReason CHUNK_LOADED
    • ADMIN

      public static final WakeReason ADMIN
      An admin changed the machine or woke it up with a command.
  • Constructor Details

    • WakeReason

      public WakeReason(@NotNull @NotNull net.kyori.adventure.key.Key key)
      Creates an instance of a WakeReason record class.
      Parameters:
      key - the value for the key record component
  • Method Details

    • external

      @NotNull public static @NotNull WakeReason external(@NotNull @NotNull net.kyori.adventure.key.Key key)
      An addon-defined reason, e.g. magicplugin:moon_phase.
    • isExternal

      public boolean isExternal()
    • toString

      @NotNull public @NotNull 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.
    • key

      @NotNull public @NotNull net.kyori.adventure.key.Key key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component