Class CorporationInvite

java.lang.Object
us.teaminceptus.novaconomy.api.corporation.CorporationInvite
All Implemented Interfaces:
ConfigurationSerializable

public final class CorporationInvite extends Object implements ConfigurationSerializable
Utility class for a Corporation Invite
  • Constructor Details

    • CorporationInvite

      public CorporationInvite(@NotNull @NotNull Corporation from, @NotNull @NotNull Business to)
      Constructs a CorporationInvite with a Date of System.currentTimeMillis().
      Parameters:
      from - Corporation that sent the invite
      to - Business that was invited
    • CorporationInvite

      public CorporationInvite(@NotNull @NotNull Corporation from, @NotNull @NotNull Business to, @NotNull @NotNull Date invited)
      Constructs a CorporationInvite.
      Parameters:
      from - Corporation that sent the invite
      to - Business that was invited
      invited - Date of when the invite was sent
  • Method Details

    • getFrom

      @NotNull public @NotNull Corporation getFrom()
      Fetches the Corporation that sent the invite.
      Returns:
      Corporation that the invite is from
    • getTo

      @NotNull public @NotNull Business getTo()
      Fetches the Business that was invited.
      Returns:
      Business that was invited
    • getInvitedTimestamp

      @NotNull public @NotNull Date getInvitedTimestamp()
      Fetches the timestamp of when the invite was sent.
      Returns:
      Date of when the invite was sent
    • accept

      public void accept() throws IllegalStateException
      Accepts this invite, adding the Business to the Corporation.
      Throws:
      IllegalStateException - if the Business already has a parent corporation or is no longer invited
    • decline

      public void decline() throws IllegalStateException
      Declines this invite, removing the Business from the Corporation's invite list.
      Throws:
      IllegalStateException - if the Business is no longer invited
    • toString

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • deserialize

      @NotNull public static @NotNull CorporationInvite deserialize(@NotNull @NotNull Map<String,Object> serial) throws IllegalArgumentException
      Deserializes a CorporationInvite from a Map.
      Parameters:
      serial - Serialized CorporationInvite
      Returns:
      Deserialized CorporationInvite
      Throws:
      IllegalArgumentException - if the serial map is null
    • serialize

      @NotNull public @NotNull Map<String,Object> serialize()
      Specified by:
      serialize in interface ConfigurationSerializable