public class PlayerLoginEvent extends PlayerEvent
限定符和类型 | 类和说明 |
---|---|
static class |
PlayerLoginEvent.Result
踢出玩家的理由
|
player
构造器和说明 |
---|
PlayerLoginEvent(Player player,
java.lang.String hostname,
java.net.InetAddress address)
这个构造器默认踢出消息为空、登录状态为ALLOWED
原文:
This constructor defaults message to an empty string, and result to
ALLOWED
|
PlayerLoginEvent(Player player,
java.lang.String hostname,
java.net.InetAddress address,
PlayerLoginEvent.Result result,
java.lang.String message)
此构造器预配置事件的结果和消息.
|
限定符和类型 | 方法和说明 |
---|---|
void |
allow()
允许玩家登录
原文:Allows the player to log in
|
void |
disallow(PlayerLoginEvent.Result result,
java.lang.String message)
以给定的理由不允许玩家登录
原文:Disallows the player from logging in, with the given reason
|
java.net.InetAddress |
getAddress()
获取玩家的
IP地址 . |
static HandlerList |
getHandlerList() |
HandlerList |
getHandlers() |
java.lang.String |
getHostname()
获取玩家用于连接服务器的主机名,如果未知则为空
原文:Gets the hostname that the player used to connect to the server, or
blank if unknown
|
java.lang.String |
getKickMessage()
如果
getResult() ! |
PlayerLoginEvent.Result |
getResult()
获取当前的登录状态.
|
void |
setKickMessage(java.lang.String message)
如果
getResult() ! |
void |
setResult(PlayerLoginEvent.Result result)
设置登录的状态.
|
getPlayer
getEventName, isAsynchronous
public PlayerLoginEvent(Player player, java.lang.String hostname, java.net.InetAddress address)
原文: This constructor defaults message to an empty string, and result to ALLOWED
player
- 这个事件的玩家
hostname
- 用于连接服务器的主机名address
- 玩家的IP地址public PlayerLoginEvent(Player player, java.lang.String hostname, java.net.InetAddress address, PlayerLoginEvent.Result result, java.lang.String message)
原文:This constructor pre-configures the event with a result and message
player
- 这个事件的玩家
hostname
- 用于连接服务器的主机名address
- 玩家的IP地址result
- 事件的登录状态结果message
- 拒绝登录时显示的消息public PlayerLoginEvent.Result getResult()
原文:Gets the current result of the login, as an enum
public void setResult(PlayerLoginEvent.Result result)
原文:Sets the new result of the login, as an enum
result
- 登录状态public java.lang.String getKickMessage()
getResult() != Result.ALLOWED
,获取将使用的踢出消息
原文:Gets the current kick message that will be used if getResult() != Result.ALLOWED
public void setKickMessage(java.lang.String message)
getResult() != Result.ALLOWED
,设置要显示的踢出消息
原文:Sets the kick message to display if getResult() != Result.ALLOWED
message
- 踢出消息public java.lang.String getHostname()
原文:Gets the hostname that the player used to connect to the server, or blank if unknown
public void allow()
原文:Allows the player to log in
public void disallow(PlayerLoginEvent.Result result, java.lang.String message)
原文:Disallows the player from logging in, with the given reason
result
- 不允许玩家登录的理由message
- 给用户显示的踢出消息public java.net.InetAddress getAddress()
IP地址
.
这个方法是在此事件期间使用 player.getAddress()
为null的解决办法
原文:Gets the InetAddress
for the Player associated with this event.
This method is provided as a workaround for player.getAddress()
returning null during PlayerLoginEvent.
public HandlerList getHandlers()
getHandlers
在类中 Event
public static HandlerList getHandlerList()