Package us.ajg0702.queue.api.events
Class PreConnectEvent
- java.lang.Object
-
- us.ajg0702.queue.api.events.PreConnectEvent
-
- All Implemented Interfaces:
Cancellable
,Event
public class PreConnectEvent extends java.lang.Object implements Event, Cancellable
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
Constructors Constructor Description PreConnectEvent(@NotNull AdaptedServer targetServer, @NotNull QueuePlayer queuePlayer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull QueuePlayer
getPlayer()
@NotNull AdaptedServer
getTargetServer()
boolean
isCancelled()
Whether this event is canceled.void
setCancelled(boolean cancelled)
Allows you to cancel or un-cancel this eventvoid
setTargetServer(@NotNull AdaptedServer targetServer)
Set the target server to connect the player to.
-
-
-
Constructor Detail
-
PreConnectEvent
public PreConnectEvent(@NotNull @NotNull AdaptedServer targetServer, @NotNull @NotNull QueuePlayer queuePlayer)
-
-
Method Detail
-
setTargetServer
public void setTargetServer(@NotNull @NotNull AdaptedServer targetServer)
Set the target server to connect the player to. (Override default behavior with a custom server)- Parameters:
targetServer
- the target server (AdaptedServer)
-
getTargetServer
@NotNull public @NotNull AdaptedServer getTargetServer()
- Returns:
- The target server that the player is trying to connect to
-
getPlayer
@NotNull public @NotNull QueuePlayer getPlayer()
- Returns:
- The player that is being connected to the server
-
isCancelled
public boolean isCancelled()
Description copied from interface:Cancellable
Whether this event is canceled.- Specified by:
isCancelled
in interfaceCancellable
- Returns:
- True if canceled. False if not.
-
setCancelled
public void setCancelled(boolean cancelled)
Description copied from interface:Cancellable
Allows you to cancel or un-cancel this event- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancelled
- True to cancel the event, false to un-cancel
-
-