Package net.minestom.server.event.player
Class AsyncPlayerConfigurationEvent
java.lang.Object
net.minestom.server.event.player.AsyncPlayerConfigurationEvent
- All Implemented Interfaces:
Event
,EntityEvent
,PlayerEvent
Called when a player enters the configuration state (either on first connection, or if they are
sent back to configuration later). The player is moved to the play state as soon as all event
handles finish processing this event.
The spawning instance must be set for the player to join.
The event is called off the tick threads, so it is safe to block here
It is valid to kick a player using Player.kick(net.kyori.adventure.text.Component)
during this event.
-
Constructor Summary
ConstructorDescriptionAsyncPlayerConfigurationEvent
(@NotNull Player player, boolean isFirstConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFeatureFlag
(@NotNull FeatureFlag feature) Add a feature flag, see Minecraft Wiki's Feature Flags for a list of applicable features Note: the flag "minecraft:vanilla" is already included by default.@NotNull Set
<FeatureFlag> The list of currently added feature flags.@NotNull Player
Gets the player.@Nullable Instance
boolean
Returns true if this is the first time the player is in the configuration phase (they are joining), false otherwise.boolean
boolean
removeFeatureFlag
(@NotNull FeatureFlag feature) Remove a feature flag, see Minecraft Wiki's Feature Flags for a list of applicable features Note: removing the flag "minecraft:vanilla" may result in weird behaviorvoid
setClearChat
(boolean clearChat) Set whether the player's chat will be cleared when exiting the configuration state.void
setHardcore
(boolean hardcore) void
setSendRegistryData
(boolean sendRegistryData) void
setSpawningInstance
(@Nullable Instance spawningInstance) boolean
If true, the player's chat will be cleared when exiting the configuration state, otherwise it will be preserved.boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.event.trait.PlayerEvent
getEntity
-
Constructor Details
-
AsyncPlayerConfigurationEvent
-
-
Method Details
-
getPlayer
Description copied from interface:PlayerEvent
Gets the player.- Specified by:
getPlayer
in interfacePlayerEvent
- Returns:
- the player
-
isFirstConfig
public boolean isFirstConfig()Returns true if this is the first time the player is in the configuration phase (they are joining), false otherwise. -
isHardcore
public boolean isHardcore() -
setHardcore
public void setHardcore(boolean hardcore) -
addFeatureFlag
Add a feature flag, see Minecraft Wiki's Feature Flags for a list of applicable features Note: the flag "minecraft:vanilla" is already included by default.- Parameters:
feature
- A minecraft feature flag- See Also:
-
removeFeatureFlag
Remove a feature flag, see Minecraft Wiki's Feature Flags for a list of applicable features Note: removing the flag "minecraft:vanilla" may result in weird behavior- Parameters:
feature
- A minecraft feature flag- Returns:
- if the feature specified existed prior to being removed
- See Also:
-
getFeatureFlags
The list of currently added feature flags. This is an unmodifiable copy of what will be sent to the client.- Returns:
- An unmodifiable set of feature flags
- See Also:
-
willClearChat
public boolean willClearChat()If true, the player's chat will be cleared when exiting the configuration state, otherwise it will be preserved. The default is not to clear the chat.- Returns:
- true if the chat will be cleared, false otherwise
- See Also:
-
setClearChat
public void setClearChat(boolean clearChat) Set whether the player's chat will be cleared when exiting the configuration state.- Parameters:
clearChat
- true to clear the chat, false otherwise- See Also:
-
willSendRegistryData
public boolean willSendRegistryData() -
setSendRegistryData
public void setSendRegistryData(boolean sendRegistryData) -
getSpawningInstance
-
setSpawningInstance
-