Record Class ProfileEntry

java.lang.Object
java.lang.Record
ch.andre601.advancedserverlist.api.profiles.ProfileEntry
Record Components:
motd - The MOTD to use.
players - The Players (lines) to show on the Player count hover.
playerCountText - The text to display instead of the default player count.
favicon - The favicon to use.
hidePlayersEnabled - Whether player count should be hidden.
extraPlayersEnabled - Whether the extra Players Option should be enabled.
maxPlayersEnabled - Whether the max Players Option should be enabled.
onlinePlayersEnabled - Whether the online Players Option should be enabled.
extraPlayersCount - The number to add to the online Players for the extra Players.
maxPlayersCount - The number to set for the max Players count.
onlinePlayersCount - The number to set for the Online Players count.

public record ProfileEntry(List<String> motd, List<String> players, String playerCountText, String favicon, NullBool hidePlayersEnabled, NullBool extraPlayersEnabled, NullBool maxPlayersEnabled, NullBool onlinePlayersEnabled, String extraPlayersCount, String maxPlayersCount, String onlinePlayersCount) extends Record

This record represents the content found in a Server List Profile YAML file.
The content may come from either the profiles list option, the options in the YAML file itself, or a combination of both.

This class is ummutable. Use builder() to get a Builder Instance of this record.

  • Constructor Details

    • ProfileEntry

      public ProfileEntry(List<String> motd, List<String> players, String playerCountText, String favicon, NullBool hidePlayersEnabled, NullBool extraPlayersEnabled, NullBool maxPlayersEnabled, NullBool onlinePlayersEnabled, String extraPlayersCount, String maxPlayersCount, String onlinePlayersCount)
      Creates a new Instance of a ProfileEntry with the provided values.
      It's generally recommended to use the Builder Class instead for a more user-friendly way of setting values.
      Parameters:
      motd - The MOTD to use.
      players - The Players (lines) to show on the Player count hover.
      playerCountText - The text to display instead of the default player count.
      favicon - The favicon to use.
      hidePlayersEnabled - Whether player count should be hidden.
      extraPlayersEnabled - Whether the extra Players Option should be enabled.
      maxPlayersEnabled - Whether the max Players Option should be enabled.
      onlinePlayersEnabled - Whether the online Players Option should be enabled.
      extraPlayersCount - The number to add to the online Players for the extra Players.
      maxPlayersCount - The number to set for the max Players count.
      onlinePlayersCount - The number to set for the Online Players count.
      See Also:
  • Method Details

    • empty

      public static ProfileEntry empty()

      Creates an "empty" PlayerEntry with the following values:

      This is equal to just doing new ProfileEntry.Builder().build().

      Returns:
      New ProfileEntry Instance with empty/null values set.
    • copy

      public ProfileEntry copy()

      Creates a copy of this ProfileEntry Instance.

      This is a convenience method that avoids using builder() first followed by ProfileEntry.Builder.build():

      ProfileEntry entry = ProfileEntry.empty(); // Obtain ProfileEntry
      
      // Both methods do the same.
      ProfileEntry newEntry1 = entry.builder().build();
      ProfileEntry newEntry2 = entry.copy();
      

      If you want to modify the ProfileEntry should builder() be preferred.

      Returns:
      A copy of this ProfilyEntry Instance.
      See Also:
    • builder

      public ProfileEntry.Builder builder()
      Creates a Builder instance with the values from this ProfileEntry set.
      Use this method if you would like to modify the ProfileEntry.
      Returns:
      A new Builder instance with the values of this ProfileEntry set.
    • motd

      public List<String> motd()
      Gets the currently set MOTD of this ProfileEntry.
      Returns:
      The current MOTD used by this ProfileEntry.
    • players

      public List<String> players()
      Gets the currently set list of players of this ProfileEntry.
      Returns:
      The current list of players used by this ProfileEntry.
    • playerCountText

      public String playerCountText()
      Gets the currently set player count text of this ProfileEntry.
      Returns:
      The current player count text used by this ProfileEntry.
    • favicon

      public String favicon()

      Gets the currently set favicon of this ProfileEntry.
      Note that the favicon usually is and supports one of the following options:

      • URL to a valid PNG file
      • File name (With .png extension) matching a file saved in the favicons folder of AdvancedServerList
      • ${player uuid} to display the avatar of the player.
      Returns:
      The current favicon used by this ProfileEntry.
    • hidePlayersEnabled

      public NullBool hidePlayersEnabled()
      Whether the player count should be hidden or not.
      To get the actual boolean value, use getOrDefault(boolean) of the returned NullBool.
      Returns:
      Whether the player count should be hidden or not.
    • extraPlayersEnabled

      public NullBool extraPlayersEnabled()
      Whether the extra players feature should be used or not.
      To get the actual boolean value, use getOrDefault(boolean) of the returned NullBool.
      Returns:
      Whether the extra players feature should be used or not.
    • maxPlayersEnabled

      public NullBool maxPlayersEnabled()
      Whether the max players feature should be used or not.
      To get the actual boolean value, use getOrDefault(boolean) of the returned NullBool.
      Returns:
      Whether the max players feature should be used or not.
    • onlinePlayersEnabled

      public NullBool onlinePlayersEnabled()
      Whether the online players feature should be used or not.
      To get the actual boolean value, use getOrDefault(boolean) of the returned NullBool.
      Returns:
      Whether the online players feature should be used or not.
    • extraPlayersCount

      public String extraPlayersCount()
      Gets the currently set number of extra players of this ProfileEntry.
      Returns:
      The current number of extra players used by this ProfileEntry.
    • maxPlayersCount

      public String maxPlayersCount()
      Gets the currently set number of max players of this ProfileEntry.
      Returns:
      The current number of max players used by this ProfileEntry.
    • onlinePlayersCount

      public String onlinePlayersCount()
      Gets the currently set number of online players of this ProfileEntry.
      Returns:
      The current number of online players used by this ProfileEntry.
    • isInvalid

      public boolean isInvalid()

      Whether this ProfileEntry is invalid or not.

      The ProfileEntry is considered invalid if all the following is true:

      As long as one of the above is not true is this ProfileEntry considered valid.

      Returns:
      Whether this ProfileEntry is invalid.
    • 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.