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 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()
@NotNull CrowdControlServerBuilder
password(@NotNull String password)
Sets the password required for Crowd Control clients to connect.@NotNull CrowdControlServerBuilder
port(int port)
Sets the port that will be used by the Crowd Control server.
-
-
-
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
-
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
-
port
@AvailableSince("3.0.0") @CheckReturnValue @Contract("_ -> this") @NotNull public @NotNull CrowdControlServerBuilder port(int port) throws IllegalArgumentException
Sets the port that will be used by the Crowd Control server.- Parameters:
port
- port to listen for new connections on- Returns:
- this builder
- Throws:
IllegalArgumentException
- the port was outside the expected bounds of [1,65536]- 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
-
-