Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev/3.0.0' into dev/3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Dec 25, 2023
2 parents 3ab03b3 + 9450e66 commit 6970a04
Show file tree
Hide file tree
Showing 63 changed files with 1,288 additions and 574 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ name: Java CI with Gradle
on: [push, pull_request]

jobs:
build-11:
build-17:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Grant execute permission for gradlew
Expand Down
12 changes: 4 additions & 8 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies {
api(libs.guice)
api(libs.checker.qual)
api(libs.brigadier)
api(libs.bundles.configurate)
api(libs.bundles.configurate4)
api(libs.caffeine)
}

Expand All @@ -60,17 +60,13 @@ tasks {
"https://www.slf4j.org/apidocs/",
"https://guava.dev/releases/${libs.guava.get().version}/api/docs/",
"https://google.github.io/guice/api-docs/${libs.guice.get().version}/javadoc/",
"https://docs.oracle.com/en/java/javase/11/docs/api/",
"https://jd.advntr.dev/api/${libs.adventure.bom.get().version}/",
"https://docs.oracle.com/en/java/javase/17/docs/api/",
//"https://jd.advntr.dev/api/${libs.adventure.bom.get().version}/",
"https://jd.advntr.dev/api/4.14.0/",
"https://javadoc.io/doc/com.github.ben-manes.caffeine/caffeine"
)

// Disable the crazy super-strict doclint tool in Java 8
o.addStringOption("Xdoclint:none", "-quiet")

// Remove "undefined" from search paths when generating javadoc for a non-modular project (JDK-8215291)
if (JavaVersion.current() >= JavaVersion.VERSION_1_9 && JavaVersion.current() < JavaVersion.VERSION_12) {
o.addBooleanOption("-no-module-directories", true)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,33 @@ public enum Status {
/**
* The player has accepted the resource pack and is now downloading it.
*/
ACCEPTED
ACCEPTED,
/**
* The player has downloaded the resource pack.
*/
DOWNLOADED,
/**
* The URL of the resource pack failed to load.
*/
INVALID_URL,
/**
* The player failed to reload the resource pack.
*/
FAILED_RELOAD,
/**
* The resource pack was discarded.
*/
DISCARDED;

/**
* Returns true if the resource pack status is intermediate, indicating that the player has
* either accepted the resource pack and is currently downloading it or has successfully
* downloaded it.
*
* @return true if the status is intermediate (ACCEPTED or DOWNLOADED), false otherwise
*/
public boolean isIntermediate() {
return this == ACCEPTED || this == DOWNLOADED;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public enum ProtocolVersion {
MINECRAFT_1_19_3(761, "1.19.3"),
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");
MINECRAFT_1_20_2(764, "1.20.2"),
MINECRAFT_1_20_3(765, "1.20.3", "1.20.4");

private static final int SNAPSHOT_BIT = 30;

Expand Down
22 changes: 21 additions & 1 deletion api/src/main/java/com/velocitypowered/api/proxy/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.api.util.ModInfo;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
Expand Down Expand Up @@ -236,6 +237,7 @@ default void clearHeaderAndFooter() {
* @return the applied resource pack or null if none.
*/
@Nullable
@Deprecated
ResourcePackInfo getAppliedResourcePack();

/**
Expand All @@ -246,8 +248,26 @@ default void clearHeaderAndFooter() {
* @return the pending resource pack or null if none
*/
@Nullable
@Deprecated
ResourcePackInfo getPendingResourcePack();

/**
* Gets the {@link ResourcePackInfo} of the currently applied
* resource-packs.
*
* @return collection of the applied resource packs.
*/
Collection<ResourcePackInfo> getAppliedResourcePacks();

/**
* Gets the {@link ResourcePackInfo} of the resource packs
* the user is currently downloading or is currently
* prompted to install.
*
* @return collection of the pending resource packs
*/
Collection<ResourcePackInfo> getPendingResourcePacks();

/**
* <strong>Note that this method does not send a plugin message to the server the player
* is connected to.</strong> You should only use this method if you are trying to communicate
Expand Down Expand Up @@ -279,4 +299,4 @@ default void clearHeaderAndFooter() {
* @return the player's client brand
*/
@Nullable String getClientBrand();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package com.velocitypowered.api.proxy.player;

import java.util.UUID;
import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.Nullable;

Expand All @@ -15,6 +16,13 @@
*/
public interface ResourcePackInfo {

/**
* Gets the id of this resource-pack.
*
* @return the id of the resource-pack
*/
UUID getId();

/**
* Gets the link the resource-pack can be found at.
*
Expand Down Expand Up @@ -96,6 +104,13 @@ public interface ResourcePackInfo {
*/
interface Builder {

/**
* Sets the id of the resource pack.
*
* @param id the id the resource-pack
*/
Builder setId(UUID id);

/**
* Sets the resource-pack as required to play on the network.
* This feature was introduced in 1.17.
Expand Down Expand Up @@ -159,4 +174,4 @@ enum Origin {
*/
PLUGIN_ON_PROXY
}
}
}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ subprojects {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
languageVersion.set(JavaLanguageVersion.of(17))
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=com.velocitypowered
version=3.2.0-SNAPSHOT
version=3.3.0-SNAPSHOT
18 changes: 12 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[versions]
configurate = "3.7.3"
configurate3 = "3.7.3"
configurate4 = "4.1.2"
flare = "2.0.1"
log4j = "2.20.0"
netty = "4.1.100.Final"
Expand All @@ -10,7 +11,8 @@ shadow = "com.github.johnrengelman.shadow:8.1.0"
spotless = "com.diffplug.spotless:6.12.0"

[libraries]
adventure-bom = "net.kyori:adventure-bom:4.14.0"
# See JD links in velocity-apo when moving to non-snapshot versions
adventure-bom = "net.kyori:adventure-bom:4.15.0-SNAPSHOT"
adventure-facet = "net.kyori:adventure-platform-facet:4.3.0"
asm = "org.ow2.asm:asm:9.5"
asynchttpclient = "org.asynchttpclient:async-http-client:2.12.3"
Expand All @@ -20,9 +22,12 @@ caffeine = "com.github.ben-manes.caffeine:caffeine:3.1.5"
checker-qual = "org.checkerframework:checker-qual:3.28.0"
checkstyle = "com.puppycrawl.tools:checkstyle:10.9.3"
completablefutures = "com.spotify:completable-futures:0.3.5"
configurate-hocon = { module = "org.spongepowered:configurate-hocon", version.ref = "configurate" }
configurate-yaml = { module = "org.spongepowered:configurate-yaml", version.ref = "configurate" }
configurate-gson = { module = "org.spongepowered:configurate-gson", version.ref = "configurate" }
configurate3-hocon = { module = "org.spongepowered:configurate-hocon", version.ref = "configurate3" }
configurate3-yaml = { module = "org.spongepowered:configurate-yaml", version.ref = "configurate3" }
configurate3-gson = { module = "org.spongepowered:configurate-gson", version.ref = "configurate3" }
configurate4-hocon = { module = "org.spongepowered:configurate-hocon", version.ref = "configurate4" }
configurate4-yaml = { module = "org.spongepowered:configurate-yaml", version.ref = "configurate4" }
configurate4-gson = { module = "org.spongepowered:configurate-gson", version.ref = "configurate4" }
disruptor = "com.lmax:disruptor:3.4.4"
fastutil = "it.unimi.dsi:fastutil:8.5.12"
flare-core = { module = "space.vectrix.flare:flare", version.ref = "flare" }
Expand Down Expand Up @@ -54,6 +59,7 @@ spotbugs-annotations = "com.github.spotbugs:spotbugs-annotations:4.7.3"
terminalconsoleappender = "net.minecrell:terminalconsoleappender:1.3.0"

[bundles]
configurate = ["configurate-hocon", "configurate-yaml", "configurate-gson"]
configurate3 = ["configurate3-hocon", "configurate3-yaml", "configurate3-gson"]
configurate4 = ["configurate4-hocon", "configurate4-yaml", "configurate4-gson"]
flare = ["flare-core", "flare-fastutil"]
log4j = ["log4j-api", "log4j-core", "log4j-slf4j-impl", "log4j-iostreams", "log4j-jul"]
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 17 additions & 12 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
5 changes: 5 additions & 0 deletions proxy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ tasks {
exclude("org/checkerframework/checker/**")

relocate("org.bstats", "com.velocitypowered.proxy.bstats")

// Include Configurate 3
val configurateBuildTask = project(":deprecated-configurate3").tasks.named("shadowJar")
dependsOn(configurateBuildTask)
from(zipTree(configurateBuildTask.map { it.outputs.files.singleFile }))
}
}

Expand Down
13 changes: 13 additions & 0 deletions proxy/deprecated/configurate3/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
alias(libs.plugins.shadow)
}

dependencies {
implementation(libs.bundles.configurate3)
}

tasks.shadowJar {
exclude("com/google/**")
exclude("com/typesafe/**")
exclude("org/yaml/**")
}
Loading

0 comments on commit 6970a04

Please sign in to comment.