Update to 1.19.3-rc3 (#893)

This commit is contained in:
Corey Shupe
2022-12-07 08:12:48 -05:00
committed by GitHub
parent 15216e5b00
commit b504e0857c
59 changed files with 2907 additions and 1272 deletions

View File

@@ -23,11 +23,11 @@ public enum ProtocolVersion {
UNKNOWN(-1, "Unknown"),
LEGACY(-2, "Legacy"),
MINECRAFT_1_7_2(4,
"1.7.2", "1.7.3", "1.7.4", "1.7.5"),
"1.7.2", "1.7.3", "1.7.4", "1.7.5"),
MINECRAFT_1_7_6(5,
"1.7.6", "1.7.7", "1.7.8", "1.7.9", "1.7.10"),
"1.7.6", "1.7.7", "1.7.8", "1.7.9", "1.7.10"),
MINECRAFT_1_8(47,
"1.8", "1.8.1", "1.8.2", "1.8.3", "1.8.4", "1.8.5", "1.8.6", "1.8.7", "1.8.8", "1.8.9"),
"1.8", "1.8.1", "1.8.2", "1.8.3", "1.8.4", "1.8.5", "1.8.6", "1.8.7", "1.8.8", "1.8.9"),
MINECRAFT_1_9(107, "1.9"),
MINECRAFT_1_9_1(108, "1.9.1"),
MINECRAFT_1_9_2(109, "1.9.2"),
@@ -59,7 +59,8 @@ public enum ProtocolVersion {
MINECRAFT_1_18(757, "1.18", "1.18.1"),
MINECRAFT_1_18_2(758, "1.18.2"),
MINECRAFT_1_19(759, "1.19"),
MINECRAFT_1_19_1(760, "1.19.1", "1.19.2");
MINECRAFT_1_19_1(760, "1.19.1", "1.19.2"),
MINECRAFT_1_19_3(761, 114, "1.19.3");
private static final int SNAPSHOT_BIT = 30;
@@ -80,8 +81,8 @@ public enum ProtocolVersion {
* The user-friendly representation of the lowest and highest supported versions.
*/
public static final String SUPPORTED_VERSION_STRING = String
.format("%s-%s", MINIMUM_VERSION.getVersionIntroducedIn(),
MAXIMUM_VERSION.getMostRecentSupportedVersion());
.format("%s-%s", MINIMUM_VERSION.getVersionIntroducedIn(),
MAXIMUM_VERSION.getMostRecentSupportedVersion());
/**
* A map linking the protocol version number to its {@link ProtocolVersion} representation.

View File

@@ -59,7 +59,7 @@ public interface IdentifiedKey extends KeySigned {
final Set<Revision> backwardsCompatibleTo;
final Set<ProtocolVersion> applicableTo;
Revision(Set<Revision> backwardsCompatibleTo, Set<ProtocolVersion> applicableTo) {
this.backwardsCompatibleTo = backwardsCompatibleTo;
this.applicableTo = applicableTo;

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 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.proxy.player;
import com.velocitypowered.api.proxy.crypto.KeyIdentifiable;
import java.util.UUID;
/**
* Represents a chat session held by a player.
*/
public interface ChatSession extends KeyIdentifiable {
/**
* Returns the {@link UUID} of the session.
*
* @return the session UUID
*/
UUID getSessionId();
}

View File

@@ -68,32 +68,53 @@ public interface TabList {
*/
Collection<TabListEntry> getEntries();
/**
* Clears all entries from the tab list.
*/
void clearAll();
/**
* Builds a tab list entry.
*
* @param profile profile
* @param profile profile
* @param displayName display name
* @param latency latency
* @param gameMode game mode
* @param latency latency
* @param gameMode game mode
* @return entry
* @deprecated Internal usage. Use {@link TabListEntry.Builder} instead.
*/
@Deprecated
TabListEntry buildEntry(GameProfile profile, @Nullable Component displayName, int latency,
int gameMode);
int gameMode);
/**
* Builds a tab list entry.
*
* @param profile profile
* @param profile profile
* @param displayName display name
* @param latency latency
* @param gameMode game mode
* @param key the player key
* @param latency latency
* @param gameMode game mode
* @param key the player key
* @return entry
* @deprecated Internal usage. Use {@link TabListEntry.Builder} instead.
* @deprecated Internal usage. Use {@link TabListEntry.Builder} instead.
*/
@Deprecated
TabListEntry buildEntry(GameProfile profile, @Nullable Component displayName, int latency,
int gameMode, @Nullable IdentifiedKey key);
/**
* Represents an entry in a {@link Player}'s tab list.
*
* @param profile the profile
* @param displayName the display name
* @param latency the latency
* @param gameMode the game mode
* @param chatSession the chat session
* @return the entry
* @deprecated Internal usage. Use {@link TabListEntry.Builder} instead.
*/
@Deprecated
TabListEntry buildEntry(GameProfile profile, @Nullable Component displayName, int latency,
int gameMode, @Nullable ChatSession chatSession);
}

View File

@@ -18,6 +18,21 @@ import org.checkerframework.checker.nullness.qual.Nullable;
* Represents a single entry in a {@link TabList}.
*/
public interface TabListEntry extends KeyIdentifiable {
/**
* Returns the {@link ChatSession} associated with this entry.
*
* @return the chat session
*/
@Nullable ChatSession getChatSession();
@Override
default IdentifiedKey getIdentifiedKey() {
ChatSession session = getChatSession();
if (session == null) {
return null;
}
return getChatSession().getIdentifiedKey();
}
/**
* Returns the parent {@link TabList} of this {@code this} {@link TabListEntry}.
@@ -41,7 +56,7 @@ public interface TabListEntry extends KeyIdentifiable {
* {@link GameProfile#getName()} is shown.
*
* @return {@link Optional} text {@link net.kyori.adventure.text.Component} of name displayed in
* the tab list
* the tab list
*/
Optional<Component> getDisplayNameComponent();
@@ -105,6 +120,25 @@ public interface TabListEntry extends KeyIdentifiable {
*/
TabListEntry setGameMode(int gameMode);
/**
* Whether or not the entry is listed, when listed they will be visible to other players in the tab list.
*
* @return Whether this entry is listed; only changeable in 1.19.3 and above
*/
default boolean isListed() {
return true;
}
/**
* Sets whether this entry is listed.
*
* @param listed whether this entry is listed
* @return {@code this}, for chaining
*/
default TabListEntry setListed(boolean listed) {
return this;
}
/**
* Returns a {@link Builder} to create a {@link TabListEntry}.
*
@@ -127,7 +161,7 @@ public interface TabListEntry extends KeyIdentifiable {
private int latency = 0;
private int gameMode = 0;
private @Nullable IdentifiedKey playerKey;
private @Nullable ChatSession chatSession;
private Builder() {
}
@@ -162,12 +196,12 @@ public interface TabListEntry extends KeyIdentifiable {
* <p>For any player currently connected to this proxy this will be filled automatically.</p>
* <p>Will ignore mismatching key revisions data.</p>
*
* @param playerKey key to set
* @param chatSession session to set
* @return {@code this}, for chaining
* @see TabListEntry#getIdentifiedKey()
* @see TabListEntry#getChatSession()
*/
public Builder playerKey(IdentifiedKey playerKey) {
this.playerKey = playerKey;
public Builder chatSession(ChatSession chatSession) {
this.chatSession = chatSession;
return this;
}
@@ -219,7 +253,7 @@ public interface TabListEntry extends KeyIdentifiable {
if (profile == null) {
throw new IllegalStateException("The GameProfile must be set when building a TabListEntry");
}
return tabList.buildEntry(profile, displayName, latency, gameMode, playerKey);
return tabList.buildEntry(profile, displayName, latency, gameMode, chatSession);
}
}
}