Package us.ajg0702.queue.api.events
Class PreConnectEvent
java.lang.Object
us.ajg0702.queue.api.events.PreConnectEvent
- All Implemented Interfaces:
Cancellable,Event
Called before AjQueue attempts to connect a player to an AdaptedServer (via Bungee or Velocity)
You can use setTargetServer to provide a custom AdaptedServer object for the player to connect to.
If canceled, the player will not be connected to the target server.
If you cancel this event, it is up to you to send a message telling the player why they were not connected.
-
Constructor Summary
ConstructorsConstructorDescriptionPreConnectEvent(@NotNull AdaptedServer targetServer, @NotNull QueuePlayer queuePlayer) -
Method Summary
Modifier and TypeMethodDescription@NotNull QueuePlayer@NotNull AdaptedServerbooleanWhether this event is canceled.voidsetCancelled(boolean cancelled) Allows you to cancel or un-cancel this eventvoidsetTargetServer(@NotNull AdaptedServer targetServer) Set the target server to connect the player to.
-
Constructor Details
-
PreConnectEvent
public PreConnectEvent(@NotNull @NotNull AdaptedServer targetServer, @NotNull @NotNull QueuePlayer queuePlayer)
-
-
Method Details
-
setTargetServer
Set the target server to connect the player to. (Override default behavior with a custom server)- Parameters:
targetServer- the target server (AdaptedServer)
-
getTargetServer
- Returns:
- The target server that the player is trying to connect to
-
getPlayer
- Returns:
- The player that is being connected to the server
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableWhether this event is canceled.- Specified by:
isCancelledin interfaceCancellable- Returns:
- True if canceled. False if not.
-
setCancelled
public void setCancelled(boolean cancelled) Description copied from interface:CancellableAllows you to cancel or un-cancel this event- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancelled- True to cancel the event, false to un-cancel
-