Merge branch 'dev/3.0.0' into dev/5.0.0

# Conflicts:
#	buildSrc/src/main/kotlin/com/velocitypowered/script/SetManifestImplVersionPlugin.kt
#	proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java
#	proxy/src/main/java/com/velocitypowered/proxy/event/VelocityEventManager.java
#	proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java
#	proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java
This commit is contained in:
Andrew Steinborn
2023-10-27 16:40:54 -04:00
89 changed files with 2869 additions and 1134 deletions

View File

@@ -47,7 +47,7 @@ public final class ServerPreConnectEvent implements
*
* @param player the player who is connecting to a server
* @param originalServer the server the player was trying to connect to
* @param previousServer the server the player ís connected to
* @param previousServer the server the player is connected to
*/
public ServerPreConnectEvent(Player player, RegisteredServer originalServer,
@Nullable RegisteredServer previousServer) {

View File

@@ -61,7 +61,9 @@ public enum ProtocolVersion {
MINECRAFT_1_19(759, "1.19"),
MINECRAFT_1_19_1(760, "1.19.1", "1.19.2"),
MINECRAFT_1_19_3(761, "1.19.3"),
MINECRAFT_1_19_4(762, "1.19.4");
MINECRAFT_1_19_4(762, "1.19.4"),
MINECRAFT_1_20(763, "1.20", "1.20.1"),
MINECRAFT_1_20_2(764, "1.20.2");
private static final int SNAPSHOT_BIT = 30;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Velocity Contributors
* Copyright (C) 2018-2023 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.
@@ -7,6 +7,7 @@
package com.velocitypowered.api.permission;
import java.util.Optional;
import net.kyori.adventure.util.TriState;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -66,6 +67,21 @@ public enum Tristate {
return val ? TRUE : FALSE;
}
/**
* Returns a {@link Tristate} from an {@link Optional}.
*
* <p>Unlike {@link #fromBoolean(boolean)}, this method returns {@link #UNDEFINED}
* if the value is empty.</p>
*
* @param val the optional boolean value
* @return {@link #UNDEFINED}, {@link #TRUE} or {@link #FALSE}, if the value is empty,
* <code>true</code> or <code>false</code>, respectively.
*/
public static Tristate fromOptionalBoolean(Optional<Boolean> val) {
return val.map(Tristate::fromBoolean).orElse(UNDEFINED);
}
private final boolean booleanValue;
Tristate(boolean booleanValue) {

View File

@@ -147,10 +147,17 @@ public interface Player extends
/**
* Clears the tab list header and footer for the player.
*
* @deprecated Use {@link TabList#clearHeaderAndFooter()}.
* @deprecated Use {@link Player#clearPlayerListHeaderAndFooter()}.
*/
@Deprecated
void clearHeaderAndFooter();
default void clearHeaderAndFooter() {
clearPlayerListHeaderAndFooter();
}
/**
* Clears the player list header and footer.
*/
void clearPlayerListHeaderAndFooter();
/**
* Returns the player's player list header.

View File

@@ -41,6 +41,12 @@ public interface ProxyServer extends Audience {
*/
void shutdown();
/**
* Closes all listening endpoints for this server.
* This includes the main minecraft listener and query channel.
*/
void closeListeners();
/**
* Retrieves the player currently connected to this proxy by their Minecraft username. The search
* is case-insensitive.

View File

@@ -43,6 +43,28 @@ public interface TabList {
*/
void addEntry(TabListEntry entry);
/**
* Adds a {@link Iterable} of {@link TabListEntry}'s to the {@link Player}'s tab list.
*
* @param entries to add to the tab list
*/
default void addEntries(Iterable<TabListEntry> entries) {
for (TabListEntry entry : entries) {
addEntry(entry);
}
}
/**
* Adds an array of {@link TabListEntry}'s to the {@link Player}'s tab list.
*
* @param entries to add to the tab list
*/
default void addEntries(TabListEntry... entries) {
for (TabListEntry entry : entries) {
addEntry(entry);
}
}
/**
* Removes the {@link TabListEntry} from the tab list with the {@link GameProfile} identified with
* the specified {@link UUID}.