Record Class Server

java.lang.Object
java.lang.Record
dev.twilite.game.wrapper.Server
Record Components:
id - world id
activity - world activity text
host - world host name
location - server location
flags - decoded world property flags
population - current population, or -1 when unavailable

public record Server(int id, String activity, String host, Server.Location location, Set<Server.Flag> flags, int population) extends Record
Snapshot of an Old School RuneScape server from the public world list.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Public world-list property flags.
    static enum 
    Public world-list location ids.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Server(int id, String activity, String host, Server.Location location, Set<Server.Flag> flags, int population)
    Creates an instance of a Server record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the activity record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the flags record component.
    flags(int rawFlags)
    Decodes raw public world-list flags.
    final int
    Returns a hash code value for this object.
    Returns the value of the host record component.
    int
    id()
    Returns the value of the id record component.
    boolean
    Returns whether this server has a property flag.
    Returns the value of the location record component.
    boolean
    Returns whether this is a members-only server.
    int
    Packs this server's decoded flags back into the raw bitmask expected by the client.
    int
    Returns the value of the population record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Server

      public Server(int id, String activity, String host, Server.Location location, Set<Server.Flag> flags, int population)
      Creates an instance of a Server record class.
      Parameters:
      id - the value for the id record component
      activity - the value for the activity record component
      host - the value for the host record component
      location - the value for the location record component
      flags - the value for the flags record component
      population - the value for the population record component
  • Method Details

    • flags

      public static Set<Server.Flag> flags(int rawFlags)
      Decodes raw public world-list flags.
    • packedFlags

      public int packedFlags()
      Packs this server's decoded flags back into the raw bitmask expected by the client.
    • is

      public boolean is(Server.Flag flag)
      Returns whether this server has a property flag.
    • members

      public boolean members()
      Returns whether this is a members-only server.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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

      public int id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • activity

      public String activity()
      Returns the value of the activity record component.
      Returns:
      the value of the activity record component
    • host

      public String host()
      Returns the value of the host record component.
      Returns:
      the value of the host record component
    • location

      public Server.Location location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component
    • flags

      public Set<Server.Flag> flags()
      Returns the value of the flags record component.
      Returns:
      the value of the flags record component
    • population

      public int population()
      Returns the value of the population record component.
      Returns:
      the value of the population record component