Class MetaserverEntry

  • All Implemented Interfaces:
    java.lang.Comparable<MetaserverEntry>

    public class MetaserverEntry
    extends java.lang.Object
    implements java.lang.Comparable<MetaserverEntry>
    Represents a response line from the metaserver.
    • Constructor Summary

      Constructors 
      Constructor Description
      MetaserverEntry​(int updateSeconds, @NotNull java.lang.String hostname, int players, @NotNull java.lang.String version, @NotNull java.lang.String comment, long bytesIn, long bytesOut, int uptimeSeconds, @NotNull java.lang.String archBase, @NotNull java.lang.String mapBase, @NotNull java.lang.String codeBase)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(@NotNull MetaserverEntry o)  
      boolean equals​(@Nullable java.lang.Object obj)  
      @NotNull java.lang.String format​(@NotNull java.lang.String format)
      Returns a formatted string using the given format.
      @NotNull java.lang.String getArchBase()
      Returns the server's arch base.
      long getBytesIn()
      Returns the number of bytes received.
      long getBytesOut()
      Returns the number of bytes sent.
      @NotNull java.lang.String getCodeBase()
      Returns the server's code base.
      @NotNull java.lang.String getComment()
      Returns the server comment.
      @NotNull java.lang.String getHostname()
      Returns the hostname.
      @NotNull java.lang.String getMapBase()
      Returns the server's map base.
      int getPlayers()
      Returns the number of players.
      int getUpdateSeconds()
      Returns the time since last update in seconds.
      int getUptimeSeconds()
      Returns the server's uptime in seconds.
      @NotNull java.lang.String getVersion()
      Returns the server version.
      int hashCode()  
      @NotNull java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MetaserverEntry

        public MetaserverEntry​(int updateSeconds,
                               @NotNull
                               @NotNull java.lang.String hostname,
                               int players,
                               @NotNull
                               @NotNull java.lang.String version,
                               @NotNull
                               @NotNull java.lang.String comment,
                               long bytesIn,
                               long bytesOut,
                               int uptimeSeconds,
                               @NotNull
                               @NotNull java.lang.String archBase,
                               @NotNull
                               @NotNull java.lang.String mapBase,
                               @NotNull
                               @NotNull java.lang.String codeBase)
        Creates a new instance.
        Parameters:
        updateSeconds - time since last update in seconds
        hostname - the hostname
        players - the number of players
        version - the server version
        comment - the server comment
        bytesIn - the number of bytes received
        bytesOut - the number of bytes sent
        uptimeSeconds - the server's uptime in seconds
        archBase - the server's arch base
        mapBase - the server's map base
        codeBase - the server's code base
    • Method Detail

      • getUpdateSeconds

        public int getUpdateSeconds()
        Returns the time since last update in seconds.
        Returns:
        the time in seconds
      • getHostname

        @NotNull
        public @NotNull java.lang.String getHostname()
        Returns the hostname.
        Returns:
        the hostname
      • getPlayers

        public int getPlayers()
        Returns the number of players.
        Returns:
        the number of players
      • getVersion

        @NotNull
        public @NotNull java.lang.String getVersion()
        Returns the server version.
        Returns:
        the server version
      • getComment

        @NotNull
        public @NotNull java.lang.String getComment()
        Returns the server comment.
        Returns:
        the server comment
      • getBytesIn

        public long getBytesIn()
        Returns the number of bytes received.
        Returns:
        the number of bytes received
      • getBytesOut

        public long getBytesOut()
        Returns the number of bytes sent.
        Returns:
        the number of bytes sent
      • getUptimeSeconds

        public int getUptimeSeconds()
        Returns the server's uptime in seconds.
        Returns:
        the server's uptime in seconds
      • getArchBase

        @NotNull
        public @NotNull java.lang.String getArchBase()
        Returns the server's arch base.
        Returns:
        the server's arch base
      • getMapBase

        @NotNull
        public @NotNull java.lang.String getMapBase()
        Returns the server's map base.
        Returns:
        the server's map base
      • getCodeBase

        @NotNull
        public @NotNull java.lang.String getCodeBase()
        Returns the server's code base.
        Returns:
        the server's code base
      • toString

        @NotNull
        public @NotNull java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(@NotNull
                             @NotNull MetaserverEntry o)
        Specified by:
        compareTo in interface java.lang.Comparable<MetaserverEntry>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(@Nullable
                              @Nullable java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • format

        @NotNull
        public @NotNull java.lang.String format​(@NotNull
                                                @NotNull java.lang.String format)
        Returns a formatted string using the given format.

        Supported format strings:

        • %% - a literal % character
        • %A - arch base
        • %C - server comment
        • %D - server comment converted to plain text
        • %E - code base
        • %H - hostname
        • %I - bytes in
        • %M - map base
        • %O - bytes out
        • %P - number of players
        • %T - uptime in seconds
        • %U - time since last update in seconds
        • %V - server version
        Parameters:
        format - the format
        Returns:
        the formatted string