Class UserAgentBuilder

java.lang.Object
de.jeff_media.updatechecker.UserAgentBuilder

public class UserAgentBuilder extends Object
Creates a User-Agent string. Always starts with "JEFF-Media-GbR-SpigotUpdateChecker/[version]" followed by all added parameters.
  • Constructor Details

    • UserAgentBuilder

      public UserAgentBuilder()
  • Method Details

    • getDefaultUserAgent

      public static UserAgentBuilder getDefaultUserAgent()
      Returns the default User-Agent, consisting of Plugin name and version, Server version and Bukkit version
      Returns:
      UserAgentBuilder instance
    • addBukkitVersion

      public UserAgentBuilder addBukkitVersion()
      Adds the Bukkit version. For example "BukkitVersion/1.16.5-R0.1-SNAPSHOT"
      Returns:
      UserAgentBuilder instance
    • addKeyValue

      public UserAgentBuilder addKeyValue(String key, String value)
      Adds a custom Key/Value string. For example "foo/bar"
      Parameters:
      key - Key
      value - Value
      Returns:
      UserAgentBuilder instance
    • addPlaintext

      public UserAgentBuilder addPlaintext(String text)
      Adds a custom string. For example "foo"
      Parameters:
      text - Custom string
      Returns:
      UserAgentBuilder instance
    • addPluginNameAndVersion

      public UserAgentBuilder addPluginNameAndVersion()
      Adds the plugin and version. For example "AngelChest/3.11.0"
      Returns:
      UserAgentBuilder instance
    • addServerVersion

      public UserAgentBuilder addServerVersion()
      Adds the Server version. For example "ServerVersion/git-Paper-584 (MC: 1.16.5)"
      Returns:
      UserAgentBuilder instance
    • addSpigotUserId

      public UserAgentBuilder addSpigotUserId()
      Returns the Spigot User ID of the user who downloaded the plugin. Only works for paid plugins from SpigotMC.org. For example "SpigotUID/175238"
      Returns:
      UserAgentBuilder instance
    • addUsingPaidVersion

      public UserAgentBuilder addUsingPaidVersion()
      Returns whether this copy of the .jar is a paid plugin downloaded from SpigotMC.org. For example "Paid/true"
      Returns:
      UserAgentBuilder instance