Package dev.qixils.crowdcontrol
Class CrowdControlServerBuilder
- java.lang.Object
-
- dev.qixils.crowdcontrol.CrowdControlServerBuilder
-
@AvailableSince("3.0.0") public final class CrowdControlServerBuilder extends Object
Builds a newCrowdControl
instance that acts as a server for Crowd Control clients to connect to.- Since:
- 3.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected InetAddress
IP
The IP that the client/server will connect to or bind on.protected org.slf4j.Logger
logger
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 CrowdControlServerBuilder()
Creates a newCrowdControl
server builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull CrowdControl
build()
B
ip(@Nullable String IP)
B
ip(@Nullable InetAddress IP)
@NotNull CrowdControlServerBuilder
password(@NotNull String password)
Sets the password required for Crowd Control clients to connect.B
port(int port)
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
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
-
IP
@AvailableSince("3.9.0") protected InetAddress IP
The IP that the client/server will connect to or bind on.- Since:
- 3.9.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
-
CrowdControlServerBuilder
@AvailableSince("3.0.0") @CheckReturnValue public CrowdControlServerBuilder()
Creates a newCrowdControl
server builder.- Since:
- 3.0.0
-
-
Method Detail
-
password
@AvailableSince("3.0.0") @CheckReturnValue @Contract("_ -> this") @NotNull public @NotNull CrowdControlServerBuilder password(@NotNull @NotNull String password) throws IllegalArgumentException
Sets the password required for Crowd Control clients to connect.- Parameters:
password
- password clients must enter to connect- Returns:
- this builder
- Throws:
IllegalArgumentException
- the password was null or blank- Since:
- 3.0.0
-
build
@AvailableSince("3.0.0") @CheckReturnValue @Contract("-> new") @NotNull public @NotNull CrowdControl build() throws IllegalStateException
- Returns:
- new CrowdControl instance
- Throws:
IllegalStateException
-port(int)
orpassword(String)
was not called- Since:
- 3.0.0
-
port
@CheckReturnValue @Contract("_ -> this") @AvailableSince("3.0.0") @NotNull public B port(int port) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
ip
@AvailableSince("3.9.0") @CheckReturnValue @Contract("_ -> this") @NotNull public B ip(@Nullable @Nullable InetAddress IP) throws IllegalArgumentException
- Parameters:
IP
- IP to connect to- Returns:
- this builder
- Throws:
IllegalArgumentException
- Since:
- 3.9.0
-
ip
@AvailableSince("3.9.0") @CheckReturnValue @Contract("_ -> this") @NotNull public B ip(@Nullable @Nullable String IP) throws IllegalArgumentException
- Parameters:
IP
- IP to connect to- Returns:
- this builder
- Throws:
IllegalArgumentException
- the IP was invalid- Since:
- 3.9.0
-
-