类 PlayerLoginEvent
请注意本事件在玩家初始化的早期阶段被触发. 建议与玩家实体有关的大部分选项在
PlayerJoinEvent
后应用.-
嵌套类概要
-
字段概要
从类继承的字段 org.bukkit.event.player.PlayerEvent
player
-
构造器概要
构造器说明PlayerLoginEvent
(@NotNull Player player, @NotNull String hostname, @NotNull InetAddress address) 这个构造器默认踢出消息为空、登录状态为ALLOWED.PlayerLoginEvent
(@NotNull Player player, @NotNull String hostname, @NotNull InetAddress address, @NotNull InetAddress realAddress) 这个构造器默认踢出消息为空、登录状态为ALLOWED.PlayerLoginEvent
(@NotNull Player player, @NotNull String hostname, @NotNull InetAddress address, @NotNull PlayerLoginEvent.Result result, @NotNull String message, @NotNull InetAddress realAddress) 此构造器预配置事件的结果和消息. -
方法概要
修饰符和类型方法说明void
allow()
允许玩家登录void
disallow
(@NotNull PlayerLoginEvent.Result result, @NotNull String message) 以给定的理由不允许玩家登录获取玩家的IP地址
.static @NotNull HandlerList
获取玩家用于连接服务器的主机名,如果未知则为空如果getResult() !
Gets the connection address of this player, regardless of whether it has been spoofed or not.获取当前的登录状态.void
setKickMessage
(@NotNull String message) 如果getResult() !
void
setResult
(@NotNull PlayerLoginEvent.Result result) 设置登录的状态.从类继承的方法 org.bukkit.event.player.PlayerEvent
getPlayer
从类继承的方法 org.bukkit.event.Event
getEventName, isAsynchronous
-
构造器详细资料
-
PlayerLoginEvent
public PlayerLoginEvent(@NotNull @NotNull Player player, @NotNull @NotNull String hostname, @NotNull @NotNull InetAddress address, @NotNull @NotNull InetAddress realAddress) 这个构造器默认踢出消息为空、登录状态为ALLOWED.原文: This constructor defaults message to an empty string, and result to ALLOWED
- 参数:
player
- 这个事件的玩家
hostname
- 用于连接服务器的主机名address
- 玩家的IP地址realAddress
- the actual, unspoofed connecting address
-
PlayerLoginEvent
public PlayerLoginEvent(@NotNull @NotNull Player player, @NotNull @NotNull String hostname, @NotNull @NotNull InetAddress address) 这个构造器默认踢出消息为空、登录状态为ALLOWED.原文: This constructor defaults message to an empty string, and result to ALLOWED
- 参数:
player
- 这个事件的玩家
hostname
- 用于连接服务器的主机名address
- 玩家的IP地址
-
PlayerLoginEvent
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) 此构造器预配置事件的结果和消息.原文:This constructor pre-configures the event with a result and message
- 参数:
player
- 这个事件的玩家
hostname
- 用于连接服务器的主机名address
- 玩家的IP地址result
- 事件的登录状态结果message
- 拒绝登录时显示的消息realAddress
- the actual, unspoofed connecting address
-
-
方法详细资料
-
getResult
获取当前的登录状态.原文:Gets the current result of the login, as an enum
- 返回:
- 登录状态
-
setResult
设置登录的状态.原文:Sets the new result of the login, as an enum
- 参数:
result
- 登录状态
-
getKickMessage
如果getResult() != Result.ALLOWED
,获取将使用的踢出消息原文:Gets the current kick message that will be used if getResult() != Result.ALLOWED
- 返回:
- 踢出消息
-
setKickMessage
如果getResult() != Result.ALLOWED
,设置要显示的踢出消息原文:Sets the kick message to display if getResult() != Result.ALLOWED
- 参数:
message
- 踢出消息
-
getHostname
获取玩家用于连接服务器的主机名,如果未知则为空原文:Gets the hostname that the player used to connect to the server, or blank if unknown
- 返回:
- 主机名
-
allow
public void allow()允许玩家登录原文:Allows the player to log in
-
disallow
public void disallow(@NotNull @NotNull PlayerLoginEvent.Result result, @NotNull @NotNull String message) 以给定的理由不允许玩家登录原文:Disallows the player from logging in, with the given reason
- 参数:
result
- 不允许玩家登录的理由message
- 给用户显示的踢出消息
-
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.- 返回:
- 玩家的IP地址。为兼容旧版,这可能是null
-
getRealAddress
Gets the connection address of this player, regardless of whether it has been spoofed or not.- 返回:
- the player's connection address
- 另请参阅:
-
getHandlers
- 指定者:
getHandlers
在类中Event
-
getHandlerList
-