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 PlayerConfigurationEvent and PlayerEnteredConfigurationEvent (Pap…
…erMC#1371) * Configuring the player (i.e. sending resource packs) should now be done in the new PlayerConfigurationEvent. * The new PlayerEnteredConfigurationEvent is called when a player acknowledged the switch to configuration state. * The PlayerEnterConfigurationEvent is no longer called twice. It is now called when the backed wants to reconfigure the player. * The PlayerFinishConfigurationEvent should no longer be used to configure the player (i.e. sending resource packs). This is because since 1.20.5 the backend server can't send keep alive packets between switching state anymore and the connection will thus time out.
- Loading branch information
1 parent
38be199
commit 425bf00
Showing
10 changed files
with
173 additions
and
95 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...ain/java/com/velocitypowered/api/event/player/configuration/PlayerConfigurationEvent.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 a player entered the configuration state and can be configured by Velocity. | ||
* <p>Velocity will wait for this event before continuing/ending the configuration state.</p> | ||
* | ||
* @param player The player who can be configured. | ||
* @param server The server that is currently configuring the player. | ||
* @since 3.3.0 | ||
* @sinceMinecraft 1.20.2 | ||
*/ | ||
@AwaitingEvent | ||
public record PlayerConfigurationEvent(@NotNull Player player, 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
27 changes: 27 additions & 0 deletions
27
...a/com/velocitypowered/api/event/player/configuration/PlayerEnteredConfigurationEvent.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 has entered the configuration state. | ||
* <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 who has entered the configuration state. | ||
* @param server The server that will now (re-)configure the player. | ||
* @since 3.3.0 | ||
* @sinceMinecraft 1.20.2 | ||
*/ | ||
public record PlayerEnteredConfigurationEvent(@NotNull Player player, 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
Oops, something went wrong.