This repository has been archived by the owner on Feb 1, 2025. It is now read-only.
forked from PaperMC/Velocity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Configuration State API (PaperMC#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 <[email protected]>
- Loading branch information
Showing
23 changed files
with
264 additions
and
90 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...ava/com/velocitypowered/api/event/player/configuration/PlayerEnterConfigurationEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) { | ||
} |
26 changes: 26 additions & 0 deletions
26
...va/com/velocitypowered/api/event/player/configuration/PlayerFinishConfigurationEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) { | ||
} |
26 changes: 26 additions & 0 deletions
26
.../com/velocitypowered/api/event/player/configuration/PlayerFinishedConfigurationEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.