Package net.md_5.bungee.api.event

# Class ServerConnectEvent

java.lang.Object
net.md_5.bungee.api.plugin.Event
net.md_5.bungee.api.event.ServerConnectEvent

All Implemented Interfaces:
  `Cancellable`

public class ServerConnectEvent extends Event implements Cancellable
Called when deciding to connect to a server. At the time when this event is called, no connection has actually been made. Cancelling the event will ensure that the connection does not proceed and can be useful to prevent certain players from accessing certain servers.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `ServerConnectEvent.Reason`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ServerConnectEvent(ProxiedPlayer player, ServerInfo target)`
  Deprecated.
  `ServerConnectEvent(ProxiedPlayer player, ServerInfo target, ServerConnectEvent.Reason reason)`
  Deprecated.
  `ServerConnectEvent(ProxiedPlayer player, ServerInfo target, ServerConnectEvent.Reason reason, ServerConnectRequest request)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `canEqual(Object other)`
  `boolean`
  `equals(Object o)`
  `ProxiedPlayer`
  `getPlayer()`
  Player connecting to a new server.
  `ServerConnectEvent.Reason`
  `getReason()`
  Reason for connecting to a new server.
  `ServerConnectRequest`
  `getRequest()`
  Request used to connect to given server.
  `@NonNull ServerInfo`
  `getTarget()`
  Server the player will be connected to.
  `int`
  `hashCode()`
  `boolean`
  `isCancelled()`
  Cancelled state.
  `void`
  `setCancelled(boolean cancelled)`
  Cancelled state.
  `void`
  `setTarget(@NonNull ServerInfo target)`
  Server the player will be connected to.
  `String`
  `toString()`

  ### Methods inherited from class net.md_5.bungee.api.plugin.Event

  `postCall`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ServerConnectEvent

    @Deprecated public ServerConnectEvent(ProxiedPlayer player, ServerInfo target)
    Deprecated.

  - ### ServerConnectEvent

    @Deprecated public ServerConnectEvent(ProxiedPlayer player, ServerInfo target, ServerConnectEvent.Reason reason)
    Deprecated.

  - ### ServerConnectEvent

    public ServerConnectEvent(ProxiedPlayer player, ServerInfo target, ServerConnectEvent.Reason reason, ServerConnectRequest request)

- ## Method Details

  - ### getPlayer

    public ProxiedPlayer getPlayer()
    Player connecting to a new server.

  - ### getTarget

    @NonNull public @NonNull ServerInfo getTarget()
    Server the player will be connected to.

  - ### getReason

    public ServerConnectEvent.Reason getReason()
    Reason for connecting to a new server.

  - ### getRequest

    public ServerConnectRequest getRequest()
    Request used to connect to given server.

  - ### isCancelled

    public boolean isCancelled()
    Cancelled state.
    Specified by:
      `isCancelled` in interface `Cancellable`
    Returns:
      the cancelled state of this event

  - ### setTarget

    public void setTarget(@NonNull @NonNull ServerInfo target)
    Server the player will be connected to.

  - ### setCancelled

    public void setCancelled(boolean cancelled)
    Cancelled state.
    Specified by:
      `setCancelled` in interface `Cancellable`
    Parameters:
      `cancelled` - the state to set

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### canEqual

    protected boolean canEqual(Object other)

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`