Package ch.andre601.fluxpoint4j
Class Fluxpoint4J
- java.lang.Object
-
- ch.andre601.fluxpoint4j.Fluxpoint4J
-
public class Fluxpoint4J extends java.lang.Object
Main class to interact with the Fluxpoint API.It currently supports the following features:
- Creating custom Images:
- Creating Welcome Images:
- Getting MC Server information:
-
-
Constructor Summary
Constructors Constructor Description Fluxpoint4J()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description @Nullable GenericAPIResponse
getCustomImage(@NotNull CustomImage image)
Generates a custom image using the providedCustomImage instance
.GenericAPIResponse
getMCServerInfo(@NotNull java.lang.String host)
Deprecated.Use thenew Builder
instead.GenericAPIResponse
getMCServerInfo(@NotNull java.lang.String host, int port)
Deprecated.Use thenew Builder
instead.MCRequestBuilder
getNewMCRequestBuilder()
Creates and returns a new instance of theMCRequestBuilder
to use, which allows you to set various things in the request such as domain, port and if icon should be included.@Nullable GenericAPIResponse
getWelcomeImage(@NotNull WelcomeImage image)
Generates a Welcome image using the providedWelcomeImage instance
.java.util.concurrent.CompletableFuture<GenericAPIResponse>
queueCustomImage(@NotNull CustomImage image)
CallsgetCustomImage(CustomImage)
and wraps it into aCompletableFuture<GenericAPIResponse>
for you to use.java.util.concurrent.CompletableFuture<GenericAPIResponse>
queueMCServerInfo(@NotNull java.lang.String host)
Deprecated.Use thenew Builder
instead.java.util.concurrent.CompletableFuture<GenericAPIResponse>
queueMCServerInfo(@NotNull java.lang.String host, int port)
Deprecated.Use thenew Builder
instead.java.util.concurrent.CompletableFuture<GenericAPIResponse>
queueWelcomeImage(@NotNull WelcomeImage image)
CallsgetWelcomeImage(WelcomeImage)
and wraps it into aCompletableFuture<GeneratedImage>
for you to use.void
setToken(@NotNull java.lang.String token)
Sets the API token to use for the Fluxpoint API.
-
-
-
Method Detail
-
setToken
public void setToken(@NotNull @NotNull java.lang.String token)
Sets the API token to use for the Fluxpoint API.- Parameters:
token
- The API token to use.
-
getCustomImage
@Nullable public @Nullable GenericAPIResponse getCustomImage(@NotNull @NotNull CustomImage image)
Generates a custom image using the providedCustomImage instance
.The returned
GenericAPIResponse
can be one of two instances:- Instance of
GeneratedImage
on a successful request. - Instance of
FailedAPIResponse
on a failed request
GenericAPIResponse response = getCustomImage(someCustomImage); if(response instanceof FailedAPIResponse){ // The request was not successful! System.out.println("Request failed!"); return; } // Request was successful. Response is a GeneratedImage instance! GeneratedImage image = (GeneratedImage)response;
- Parameters:
image
- TheCustomImage
to generate.- Returns:
GenericAPIResponse
that is either the GeneratedImage or FailedAPIResponse instance.
- Instance of
-
queueCustomImage
public java.util.concurrent.CompletableFuture<GenericAPIResponse> queueCustomImage(@NotNull @NotNull CustomImage image)
CallsgetCustomImage(CustomImage)
and wraps it into aCompletableFuture<GenericAPIResponse>
for you to use.The returned
GenericAPIResponse
can be one of two instances:- Instance of
GeneratedImage
on a successful request. - Instance of
FailedAPIResponse
on a failed request
GenericAPIResponse response = getCustomImage(someCustomImage); if(response instanceof FailedAPIResponse){ // The request was not successful! System.out.println("Request failed!"); return; } // Request was successful. Response is a GeneratedImage instance! GeneratedImage image = (GeneratedImage)response;
- Parameters:
image
- TheCustomImage
to generate.- Returns:
CompletableFuture
with aGenericAPIResponse
instance.- See Also:
getCustomImage
- Instance of
-
getWelcomeImage
@Nullable public @Nullable GenericAPIResponse getWelcomeImage(@NotNull @NotNull WelcomeImage image)
Generates a Welcome image using the providedWelcomeImage instance
.The returned
GenericAPIResponse
can be one of two instances:- Instance of
GeneratedImage
on a successful request. - Instance of
FailedAPIResponse
on a failed request
GenericAPIResponse response = getWelcomeImage(someWelcomeImage); if(response instanceof FailedAPIResponse){ // The request was not successful! System.out.println("Request failed!"); return; } // Request was successful. Response is a GeneratedImage instance! GeneratedImage image = (GeneratedImage)response;
- Parameters:
image
- TheWelcomeImage
to generate.- Returns:
GenericAPIResponse
that is either the GeneratedImage or a failed API response.
- Instance of
-
queueWelcomeImage
public java.util.concurrent.CompletableFuture<GenericAPIResponse> queueWelcomeImage(@NotNull @NotNull WelcomeImage image)
CallsgetWelcomeImage(WelcomeImage)
and wraps it into aCompletableFuture<GeneratedImage>
for you to use.The returned
GenericAPIResponse
can be one of two instances:- Instance of
GeneratedImage
on a successful request. - Instance of
FailedAPIResponse
on a failed request
GenericAPIResponse response = getWelcomeImage(someWelcomeImage); if(response instanceof FailedAPIResponse){ // The request was not successful! System.out.println("Request failed!"); return; } // Request was successful. Response is a GeneratedImage instance! GeneratedImage image = (GeneratedImage)response;
- Parameters:
image
- TheWelcomeImage
to generate.- Returns:
CompletableFuture
with aGenericAPIResponse
instance.- See Also:
getWelcomeImage
- Instance of
-
getNewMCRequestBuilder
public MCRequestBuilder getNewMCRequestBuilder()
Creates and returns a new instance of theMCRequestBuilder
to use, which allows you to set various things in the request such as domain, port and if icon should be included.- Returns:
- A new, usable instance of
MCRequestBuilder
.
-
getMCServerInfo
@Deprecated public GenericAPIResponse getMCServerInfo(@NotNull @NotNull java.lang.String host)
Deprecated.Use thenew Builder
instead.Performs a request to the Fluxpoint API to check a Server and receive possible information from it.
This particular method will ping the server with the default port 25565. If you want to set a own port, usegetMCServerInfo(String, int)
instead.The returned
GenericAPIResponse
can be one of two instances:- Instance of
MCServerPingResponse
on a successful request. - Instance of
FailedAPIResponse
on a failed request
GenericAPIResponse response = getMCServerInfo("mc.example.com"); if(response instanceof FailedAPIResponse){ // The request was not successful! System.out.println("Request failed!"); return; } // Request was successful. Response is a MCServerPingResponse instance! GeneratedImage image = (MCServerPingResponse)response;
- Parameters:
host
- The server to ping. This can be a domain or IP.- Returns:
GenericAPIResponse
that is either a MCServerPingResponse or FailedAPIResponse instance.- See Also:
getMCServerInfo
- Instance of
-
getMCServerInfo
@Deprecated public GenericAPIResponse getMCServerInfo(@NotNull @NotNull java.lang.String host, int port)
Deprecated.Use thenew Builder
instead.Performs a request to the Fluxpoint API to check a Server and receive possible information from it.The returned
GenericAPIResponse
can be one of two instances:- Instance of
MCServerPingResponse
on a successful request. - Instance of
FailedAPIResponse
on a failed request
GenericAPIResponse response = getMCServerInfo("mc.example.com"); if(response instanceof FailedAPIResponse){ // The request was not successful! System.out.println("Request failed!"); return; } // Request was successful. Response is a MCServerPingResponse instance! GeneratedImage image = (MCServerPingResponse)response;
- Parameters:
host
- The server to ping. This can be a domain or IP.port
- The port to ping the server on.- Returns:
GenericAPIResponse
that is either a MCServerPingResponse or FailedAPIResponse instance.
- Instance of
-
queueMCServerInfo
@Deprecated public java.util.concurrent.CompletableFuture<GenericAPIResponse> queueMCServerInfo(@NotNull @NotNull java.lang.String host)
Deprecated.Use thenew Builder
instead.CallsgetMCServerInfo(String)
and wraps it into aCompletableFuture<GeneratedImage>
for you to use.The returned
GenericAPIResponse
can be one of two instances:- Instance of
MCServerPingResponse
on a successful request. - Instance of
FailedAPIResponse
on a failed request
GenericAPIResponse response = getMCServerInfo("mc.example.com"); if(response instanceof FailedAPIResponse){ // The request was not successful! System.out.println("Request failed!"); return; } // Request was successful. Response is a MCServerPingResponse instance! GeneratedImage image = (MCServerPingResponse)response;
- Parameters:
host
- The server to ping. This can be a domain or IP.- Returns:
GenericAPIResponse
that is either a MCServerPingResponse or FailedAPIResponse instance.- See Also:
getMCServerInfo
- Instance of
-
queueMCServerInfo
@Deprecated public java.util.concurrent.CompletableFuture<GenericAPIResponse> queueMCServerInfo(@NotNull @NotNull java.lang.String host, int port)
Deprecated.Use thenew Builder
instead.CallsgetMCServerInfo(String, int)
and wraps it into aCompletableFuture<GeneratedImage>
for you to use.The returned
GenericAPIResponse
can be one of two instances:- Instance of
MCServerPingResponse
on a successful request. - Instance of
FailedAPIResponse
on a failed request
GenericAPIResponse response = getMCServerInfo("mc.example.com"); if(response instanceof FailedAPIResponse){ // The request was not successful! System.out.println("Request failed!"); return; } // Request was successful. Response is a MCServerPingResponse instance! GeneratedImage image = (MCServerPingResponse)response;
- Parameters:
host
- The server to ping. This can be a domain or IP.port
- The port to ping the server on.- Returns:
GenericAPIResponse
that is either a MCServerPingResponse or FailedAPIResponse instance.- See Also:
getMCServerInfo
- Instance of
-
-