Skip to content

Commit 8fc2a4b

Browse files
Merge branch 'PaperMC:dev/3.0.0' into dev/3.0.0
2 parents 1b548df + 07a525b commit 8fc2a4b

File tree

94 files changed

+3094
-1161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+3094
-1161
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ gradle-app.setting
8383
logs/
8484
/velocity.toml
8585
/forwarding.secret
86+
forwarding.secret
87+
velocity.toml
8688
server-icon.png
8789
/bin/
8890
run/

Jenkinsfile

Lines changed: 0 additions & 38 deletions
This file was deleted.

api/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
`java-library`
33
`maven-publish`
4+
id("velocity-publish")
45
}
56

67
java {
@@ -29,6 +30,10 @@ dependencies {
2930
api("net.kyori:adventure-text-serializer-legacy")
3031
api("net.kyori:adventure-text-serializer-plain")
3132
api("net.kyori:adventure-text-minimessage")
33+
api("net.kyori:adventure-text-logger-slf4j")
34+
api("net.kyori:adventure-text-serializer-ansi")
35+
36+
api(libs.snakeyaml)
3237

3338
api(libs.slf4j)
3439
api(libs.guice)

api/src/main/java/com/velocitypowered/api/event/player/ServerPreConnectEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public ServerPreConnectEvent(Player player, RegisteredServer originalServer) {
4747
*
4848
* @param player the player who is connecting to a server
4949
* @param originalServer the server the player was trying to connect to
50-
* @param previousServer the server the player ís connected to
50+
* @param previousServer the server the player is connected to
5151
*/
5252
public ServerPreConnectEvent(Player player, RegisteredServer originalServer,
5353
@Nullable RegisteredServer previousServer) {

api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public enum ProtocolVersion {
6262
MINECRAFT_1_19_1(760, "1.19.1", "1.19.2"),
6363
MINECRAFT_1_19_3(761, "1.19.3"),
6464
MINECRAFT_1_19_4(762, "1.19.4"),
65-
MINECRAFT_1_20(763, "1.20", "1.20.1");
65+
MINECRAFT_1_20(763, "1.20", "1.20.1"),
66+
MINECRAFT_1_20_2(764, "1.20.2");
6667

6768
private static final int SNAPSHOT_BIT = 30;
6869

api/src/main/java/com/velocitypowered/api/permission/Tristate.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* Copyright (C) 2018-2022 Velocity Contributors
2+
* Copyright (C) 2018-2023 Velocity Contributors
33
*
44
* The Velocity API is licensed under the terms of the MIT License. For more details,
55
* reference the LICENSE file in the api top-level directory.
66
*/
77

88
package com.velocitypowered.api.permission;
99

10+
import java.util.Optional;
1011
import net.kyori.adventure.util.TriState;
1112
import org.checkerframework.checker.nullness.qual.Nullable;
1213

@@ -66,6 +67,21 @@ public static Tristate fromNullableBoolean(@Nullable Boolean val) {
6667
return val ? TRUE : FALSE;
6768
}
6869

70+
/**
71+
* Returns a {@link Tristate} from an {@link Optional}.
72+
*
73+
* <p>Unlike {@link #fromBoolean(boolean)}, this method returns {@link #UNDEFINED}
74+
* if the value is empty.</p>
75+
*
76+
* @param val the optional boolean value
77+
* @return {@link #UNDEFINED}, {@link #TRUE} or {@link #FALSE}, if the value is empty,
78+
* <code>true</code> or <code>false</code>, respectively.
79+
*/
80+
public static Tristate fromOptionalBoolean(Optional<Boolean> val) {
81+
return val.map(Tristate::fromBoolean).orElse(UNDEFINED);
82+
}
83+
84+
6985
private final boolean booleanValue;
7086

7187
Tristate(boolean booleanValue) {

api/src/main/java/com/velocitypowered/api/proxy/Player.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import net.kyori.adventure.text.event.HoverEvent;
3232
import net.kyori.adventure.text.event.HoverEventSource;
3333
import org.checkerframework.checker.nullness.qual.Nullable;
34-
import org.checkerframework.checker.nullness.qual.Nullable;
3534
import org.jetbrains.annotations.NotNull;
3635

3736
/**
@@ -148,10 +147,17 @@ public interface Player extends
148147
/**
149148
* Clears the tab list header and footer for the player.
150149
*
151-
* @deprecated Use {@link TabList#clearHeaderAndFooter()}.
150+
* @deprecated Use {@link Player#clearPlayerListHeaderAndFooter()}.
152151
*/
153152
@Deprecated
154-
void clearHeaderAndFooter();
153+
default void clearHeaderAndFooter() {
154+
clearPlayerListHeaderAndFooter();
155+
}
156+
157+
/**
158+
* Clears the player list header and footer.
159+
*/
160+
void clearPlayerListHeaderAndFooter();
155161

156162
/**
157163
* Returns the player's player list header.

api/src/main/java/com/velocitypowered/api/proxy/ProxyServer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ public interface ProxyServer extends Audience {
4141
*/
4242
void shutdown();
4343

44+
/**
45+
* Closes all listening endpoints for this server.
46+
* This includes the main minecraft listener and query channel.
47+
*/
48+
void closeListeners();
49+
4450
/**
4551
* Retrieves the player currently connected to this proxy by their Minecraft username. The search
4652
* is case-insensitive.

api/src/main/java/com/velocitypowered/api/proxy/player/TabList.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,28 @@ public interface TabList {
4343
*/
4444
void addEntry(TabListEntry entry);
4545

46+
/**
47+
* Adds a {@link Iterable} of {@link TabListEntry}'s to the {@link Player}'s tab list.
48+
*
49+
* @param entries to add to the tab list
50+
*/
51+
default void addEntries(Iterable<TabListEntry> entries) {
52+
for (TabListEntry entry : entries) {
53+
addEntry(entry);
54+
}
55+
}
56+
57+
/**
58+
* Adds an array of {@link TabListEntry}'s to the {@link Player}'s tab list.
59+
*
60+
* @param entries to add to the tab list
61+
*/
62+
default void addEntries(TabListEntry... entries) {
63+
for (TabListEntry entry : entries) {
64+
addEntry(entry);
65+
}
66+
}
67+
4668
/**
4769
* Removes the {@link TabListEntry} from the tab list with the {@link GameProfile} identified with
4870
* the specified {@link UUID}.

build-logic/build.gradle.kts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
plugins {
2+
`kotlin-dsl`
3+
alias(libs.plugins.spotless)
4+
}
5+
6+
dependencies {
7+
// this is OK as long as the same version catalog is used in the main build and build-logic
8+
// see https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
9+
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
10+
implementation("com.diffplug.spotless:spotless-plugin-gradle:${libs.plugins.spotless.get().version}")
11+
}
12+
13+
spotless {
14+
kotlin {
15+
licenseHeaderFile(rootProject.file("../HEADER.txt"))
16+
}
17+
}

0 commit comments

Comments
 (0)