Package com.github.alex1304.jdash.client
Class GDClientBuilder
- java.lang.Object
-
- com.github.alex1304.jdash.client.GDClientBuilder
-
public final class GDClientBuilder extends Object
Builds a Geometry Dash client step by step.
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_CACHE_LIFETIME
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AnonymousGDClient
buildAnonymous()
Builds an anonymous Geometry Dash client.AuthenticatedGDClient
buildAuthenticated(String username, String password)
static GDClientBuilder
create()
GDClientBuilder
withCacheLifetime(long time)
Specifies how long a request should stay in cache.GDClientBuilder
withHost(String host)
Specifies a custom host for the client to send the requests to.
-
-
-
Field Detail
-
DEFAULT_CACHE_LIFETIME
public static final long DEFAULT_CACHE_LIFETIME
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static GDClientBuilder create()
-
withHost
public GDClientBuilder withHost(String host)
Specifies a custom host for the client to send the requests to. This allows the use ofAnonymousGDClient
for Geometry Dash private servers (GDPS).- Parameters:
host
- the host address (WITHOUT protocol and WITHOUT trailing slash!)- Returns:
- this (for method chaining purposes)
- Throws:
IllegalArgumentException
- if host starts with 'http://', ends with '/'NullPointerException
- if host isnull
-
withCacheLifetime
public GDClientBuilder withCacheLifetime(long time)
Specifies how long a request should stay in cache. Setting 0 as value disables the cache.- Parameters:
time
- the time to set for the cache lifetime- Returns:
- this (for method chaining purposes)
- Throws:
IllegalArgumentException
- if time is negative
-
buildAnonymous
public AnonymousGDClient buildAnonymous()
Builds an anonymous Geometry Dash client.- Returns:
AnonymousGDClient
-
buildAuthenticated
public AuthenticatedGDClient buildAuthenticated(String username, String password) throws GDLoginFailedException
- Throws:
GDLoginFailedException
-
-