public class PlayerLoginEvent extends PlayerEvent
PlayerJoinEvent
instead.Modifier and Type | Class and Description |
---|---|
static class |
PlayerLoginEvent.Result
Basic kick reasons for communicating to plugins
|
player
Constructor and Description |
---|
PlayerLoginEvent(@NotNull Player player,
@NotNull String hostname,
@NotNull InetAddress address) |
PlayerLoginEvent(@NotNull Player player,
@NotNull String hostname,
@NotNull InetAddress address,
@NotNull InetAddress realAddress)
This constructor defaults message to an empty string, and result to
ALLOWED
|
PlayerLoginEvent(@NotNull Player player,
@NotNull String hostname,
@NotNull InetAddress address,
@NotNull PlayerLoginEvent.Result result,
net.kyori.adventure.text.Component message,
@NotNull InetAddress realAddress)
This constructor pre-configures the event with a result and message
|
PlayerLoginEvent(@NotNull Player player,
@NotNull String hostname,
@NotNull InetAddress address,
@NotNull PlayerLoginEvent.Result result,
@NotNull String message,
@NotNull InetAddress realAddress)
|
Modifier and Type | Method and Description |
---|---|
void |
allow()
Allows the player to log in
|
void |
disallow(@NotNull PlayerLoginEvent.Result result,
net.kyori.adventure.text.Component message)
Disallows the player from logging in, with the given reason
|
void |
disallow(@NotNull PlayerLoginEvent.Result result,
@NotNull String message)
Deprecated.
in favour of
disallow(Result, net.kyori.adventure.text.Component) |
@NotNull InetAddress |
getAddress()
Gets the
InetAddress for the Player associated with this event. |
static @NotNull HandlerList |
getHandlerList() |
@NotNull HandlerList |
getHandlers() |
@NotNull String |
getHostname()
Gets the hostname that the player used to connect to the server, or
blank if unknown
|
@NotNull String |
getKickMessage()
Deprecated.
in favour of
kickMessage() |
@NotNull InetAddress |
getRealAddress()
Gets the connection address of this player, regardless of whether it has been spoofed or not.
|
@NotNull PlayerLoginEvent.Result |
getResult()
Gets the current result of the login, as an enum
|
net.kyori.adventure.text.Component |
kickMessage()
Gets the current kick message that will be used if getResult() !=
Result.ALLOWED
|
void |
kickMessage(net.kyori.adventure.text.Component message)
Sets the kick message to display if getResult() != Result.ALLOWED
|
void |
setKickMessage(@NotNull String message)
Deprecated.
in favour of
kickMessage(net.kyori.adventure.text.Component) |
void |
setResult(@NotNull PlayerLoginEvent.Result result)
Sets the new result of the login, as an enum
|
getPlayer
callEvent, getEventName, isAsynchronous
public PlayerLoginEvent(@NotNull @NotNull Player player, @NotNull @NotNull String hostname, @NotNull @NotNull InetAddress address, @NotNull @NotNull InetAddress realAddress)
player
- The Player
for this eventhostname
- The hostname that was used to connect to the serveraddress
- The address the player used to connect, provided for
timing issuesrealAddress
- the actual, unspoofed connecting addresspublic PlayerLoginEvent(@NotNull @NotNull Player player, @NotNull @NotNull String hostname, @NotNull @NotNull InetAddress address)
@Deprecated public PlayerLoginEvent(@NotNull @NotNull Player player, @NotNull @NotNull String hostname, @NotNull @NotNull InetAddress address, @NotNull @NotNull PlayerLoginEvent.Result result, @NotNull @NotNull String message, @NotNull @NotNull InetAddress realAddress)
PlayerLoginEvent(Player, String, InetAddress, Result, net.kyori.adventure.text.Component, InetAddress)
player
- The Player
for this eventhostname
- The hostname that was used to connect to the serveraddress
- The address the player used to connect, provided for
timing issuesresult
- The result status for this eventmessage
- The message to be displayed if result denies loginrealAddress
- the actual, unspoofed connecting addresspublic PlayerLoginEvent(@NotNull @NotNull Player player, @NotNull @NotNull String hostname, @NotNull @NotNull InetAddress address, @NotNull @NotNull PlayerLoginEvent.Result result, @NotNull net.kyori.adventure.text.Component message, @NotNull @NotNull InetAddress realAddress)
player
- The Player
for this eventhostname
- The hostname that was used to connect to the serveraddress
- The address the player used to connect, provided for
timing issuesresult
- The result status for this eventmessage
- The message to be displayed if result denies loginrealAddress
- the actual, unspoofed connecting address@NotNull public net.kyori.adventure.text.Component kickMessage()
public void kickMessage(@NotNull net.kyori.adventure.text.Component message)
message
- New kick message@NotNull public @NotNull InetAddress getRealAddress()
@NotNull public @NotNull PlayerLoginEvent.Result getResult()
public void setResult(@NotNull @NotNull PlayerLoginEvent.Result result)
result
- New result to set@NotNull @Deprecated public @NotNull String getKickMessage()
kickMessage()
@Deprecated public void setKickMessage(@NotNull @NotNull String message)
kickMessage(net.kyori.adventure.text.Component)
message
- New kick message@NotNull public @NotNull String getHostname()
public void allow()
@Deprecated public void disallow(@NotNull @NotNull PlayerLoginEvent.Result result, @NotNull @NotNull String message)
disallow(Result, net.kyori.adventure.text.Component)
result
- New result for disallowing the playermessage
- Kick message to display to the userpublic void disallow(@NotNull @NotNull PlayerLoginEvent.Result result, @NotNull net.kyori.adventure.text.Component message)
result
- New result for disallowing the playermessage
- Kick message to display to the user@NotNull public @NotNull InetAddress getAddress()
InetAddress
for the Player associated with this event.
This method is provided as a workaround for player.getAddress()
returning null during PlayerLoginEvent.@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2021. All rights reserved.