Add Configuration State API (#1261)
* Implement Configuration State events * Implement PlayerFinishedConfigurationEvent * Fixed PlayerFinishConfigurationEvent execution * Apply suggestions * Fix keep alive when blocking PlayerFinishConfigurationEvent * Add ServerConnection to configuration events * Separate PlayPacketQueueHandler to fix AutoReadHolderHandler --------- Co-authored-by: Gero <gecam59@gmail.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Velocity Contributors
|
||||
*
|
||||
* The Velocity API is licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in the api top-level directory.
|
||||
*/
|
||||
|
||||
package com.velocitypowered.api.event.player.configuration;
|
||||
|
||||
import com.velocitypowered.api.network.ProtocolState;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This event is executed when a player with version 1.20.2 or higher enters the configuration phase.
|
||||
* <p>From this moment on, until the {@link PlayerFinishedConfigurationEvent} is executed,
|
||||
* the {@linkplain Player#getProtocolState()} method is guaranteed
|
||||
* to return {@link ProtocolState#CONFIGURATION}.</p>
|
||||
*
|
||||
* @param player The player that has entered the configuration phase.
|
||||
* @param server The server that will now (re-)configure the player.
|
||||
* @since 3.3.0
|
||||
* @sinceMinecraft 1.20.2
|
||||
*/
|
||||
public record PlayerEnterConfigurationEvent(@NotNull Player player, ServerConnection server) {
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Velocity Contributors
|
||||
*
|
||||
* The Velocity API is licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in the api top-level directory.
|
||||
*/
|
||||
|
||||
package com.velocitypowered.api.event.player.configuration;
|
||||
|
||||
import com.velocitypowered.api.event.annotation.AwaitingEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This event is executed when the player is about to finish the Configuration state.
|
||||
* <p>Velocity will wait for this event to finish the configuration phase on the client.</p>
|
||||
*
|
||||
* @param player The player who is about to complete the configuration phase.
|
||||
* @param server The server that is currently (re-)configuring the player.
|
||||
* @since 3.3.0
|
||||
* @sinceMinecraft 1.20.2
|
||||
*/
|
||||
@AwaitingEvent
|
||||
public record PlayerFinishConfigurationEvent(@NotNull Player player, @NotNull ServerConnection server) {
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Velocity Contributors
|
||||
*
|
||||
* The Velocity API is licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in the api top-level directory.
|
||||
*/
|
||||
|
||||
package com.velocitypowered.api.event.player.configuration;
|
||||
|
||||
import com.velocitypowered.api.network.ProtocolState;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Event executed when a player of version 1.20.2 or higher finishes the Configuration state.
|
||||
* <p>From this moment on, the {@link Player#getProtocolState()} method
|
||||
* will return {@link ProtocolState#PLAY}.</p>
|
||||
*
|
||||
* @param player The player who has completed the Configuration state
|
||||
* @param server The server that has (re-)configured the player.
|
||||
* @since 3.3.0
|
||||
* @sinceMinecraft 1.20.2
|
||||
*/
|
||||
public record PlayerFinishedConfigurationEvent(@NotNull Player player, @NotNull ServerConnection server) {
|
||||
}
|
Reference in New Issue
Block a user