Class 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 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 interface Cancellable
        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 interface Cancellable
        Parameters:
        cancelled - True to cancel the event, false to un-cancel