Package dev.qixils.crowdcontrol
Class CrowdControlClientBuilder
- java.lang.Object
-
- dev.qixils.crowdcontrol.CrowdControlClientBuilder
-
@AvailableSince("3.0.0") public final class CrowdControlClientBuilder extends Object
Builds a newCrowdControl
instance that acts as a client and connects to a single Crowd Control server instance.- Since:
- 3.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected int
port
The port that the client/server will connect to or listen on.protected @NotNull Function<@NotNull CrowdControl,@NotNull SocketManager>
socketManagerCreator
A function (usually a constructor) that creates a newSocketManager
given aCrowdControl
instance.
-
Constructor Summary
Constructors Constructor Description CrowdControlClientBuilder()
Creates a newCrowdControl
client builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull CrowdControl
build()
@NotNull CrowdControlClientBuilder
ip(@NotNull String IP)
Sets the IP that the Crowd Control client will connect to.@NotNull CrowdControlClientBuilder
port(int port)
Sets the port that will be used by the Crowd Control client.
-
-
-
Field Detail
-
socketManagerCreator
@AvailableSince("3.0.0") @NotNull protected final @NotNull Function<@NotNull CrowdControl,@NotNull SocketManager> socketManagerCreator
A function (usually a constructor) that creates a newSocketManager
given aCrowdControl
instance.- Since:
- 3.0.0
-
port
@AvailableSince("3.0.0") protected int port
The port that the client/server will connect to or listen on.- Since:
- 3.0.0
-
-
Constructor Detail
-
CrowdControlClientBuilder
@AvailableSince("3.0.0") @CheckReturnValue public CrowdControlClientBuilder()
Creates a newCrowdControl
client builder.- Since:
- 3.0.0
-
-
Method Detail
-
ip
@AvailableSince("3.0.0") @CheckReturnValue @Contract("_ -> this") @NotNull public @NotNull CrowdControlClientBuilder ip(@NotNull @NotNull String IP) throws IllegalArgumentException
Sets the IP that the Crowd Control client will connect to.- Parameters:
IP
- IP to connect to- Returns:
- this builder
- Throws:
IllegalArgumentException
- the IP was null or blank- Since:
- 3.0.0
-
port
@AvailableSince("3.0.0") @CheckReturnValue @Contract("_ -> this") @NotNull public @NotNull CrowdControlClientBuilder port(int port) throws IllegalArgumentException
Sets the port that will be used by the Crowd Control client.- Parameters:
port
- port to connect to- Returns:
- this builder
- Throws:
IllegalArgumentException
- the port was outside the expected bounds of [1,65536]- Since:
- 3.0.0
-
build
@AvailableSince("3.0.0") @Contract("-> new") @NotNull public @NotNull CrowdControl build() throws IllegalStateException
- Returns:
- new CrowdControl instance
- Throws:
IllegalStateException
-port(int)
orip(String)
was not called- Since:
- 3.0.0
-
-