diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92324c2..98ef87c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,20 +16,20 @@ jobs: run: | echo "87.251.74.5 maven.elytrium.net" | sudo tee -a /etc/hosts - name: Checkout - uses: actions/checkout@v4.2.2 + uses: actions/checkout@v6.0.2 - name: Set up JDK - uses: actions/setup-java@v4.7.0 + uses: actions/setup-java@v5.2.0 with: - distribution: adopt - java-version: 17 + distribution: temurin + java-version: 21 - name: Build FastMOTD run: ./gradlew build - name: Upload FastMOTD - uses: actions/upload-artifact@v4.6.2 + uses: actions/upload-artifact@v7.0.0 with: name: FastMOTD path: "build/libs/FastMOTD*.jar" - - uses: dev-drprasad/delete-tag-and-release@v0.2.1 + - uses: dev-drprasad/delete-tag-and-release@v1.1 if: ${{ github.event_name == 'push' }} with: delete_release: true @@ -47,7 +47,7 @@ jobs: echo "::set-output name=jarname::$output" - name: Release the build if: ${{ github.event_name == 'push' }} - uses: ncipollo/release-action@v1 + uses: ncipollo/release-action@v1.20.0 with: artifacts: build/libs/${{ steps.find-jar.outputs.jarname }} body: ${{ join(github.event.commits.*.message, '\n') }} @@ -56,7 +56,7 @@ jobs: tag: dev-build - name: Upload to Modrinth if: ${{ github.event_name == 'push' }} - uses: RubixDev/modrinth-upload@v1.0.0 + uses: RubixDev/modrinth-upload@v1 with: token: ${{ secrets.MODRINTH_TOKEN }} file_path: build/libs/${{ steps.find-jar.outputs.jarname }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cb4f666..1bf74a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,16 +9,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4.2.2 + uses: actions/checkout@v6.0.2 - name: Set up JDK - uses: actions/setup-java@v4.7.0 + uses: actions/setup-java@v5.2.0 with: - distribution: adopt - java-version: 17 + distribution: temurin + java-version: 21 - name: Build FastMOTD run: ./gradlew build - name: Upload FastMOTD - uses: actions/upload-artifact@v4.6.2 + uses: actions/upload-artifact@v7.0.0 with: name: FastMOTD path: "build/libs/FastMOTD*.jar" @@ -28,7 +28,7 @@ jobs: output="$(find build/libs/ ! -name "*-javadoc.jar" ! -name "*-sources.jar" -type f -printf "%f\n")" echo "::set-output name=jarname::$output" - name: Upload to the GitHub release - uses: actions/upload-release-asset@v1 + uses: actions/upload-release-asset@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -37,7 +37,7 @@ jobs: asset_name: ${{ steps.find-jar.outputs.jarname }} asset_content_type: application/java-archive - name: Upload to Modrinth - uses: RubixDev/modrinth-upload@v1.0.0 + uses: RubixDev/modrinth-upload@v1 with: token: ${{ secrets.MODRINTH_TOKEN }} file_path: build/libs/${{ steps.find-jar.outputs.jarname }} diff --git a/VERSION b/VERSION index 66c4c22..7ee7020 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.9 +1.0.10 diff --git a/build.gradle b/build.gradle index df97e5f..fe4ae32 100644 --- a/build.gradle +++ b/build.gradle @@ -3,17 +3,17 @@ plugins { id("java") id("checkstyle") - id("com.github.spotbugs").version("6.1.7") + id("com.github.spotbugs").version("6.4.8") id("org.cadixdev.licenser").version("0.6.1") - id("com.gradleup.shadow").version("8.3.6") + id("com.gradleup.shadow").version("9.3.2") } setGroup("net.elytrium") -setVersion("1.0.9") +setVersion("1.0.10") java { - setSourceCompatibility(JavaVersion.VERSION_17) - setTargetCompatibility(JavaVersion.VERSION_17) + setSourceCompatibility(JavaVersion.VERSION_21) + setTargetCompatibility(JavaVersion.VERSION_21) } compileJava { @@ -40,15 +40,15 @@ dependencies { implementation("net.elytrium:fastprepare:1.0.13") implementation("net.elytrium:serializer:1.1.1") implementation("it.unimi.dsi:fastutil-core:8.5.18") - compileOnly("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT") - annotationProcessor("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT") - compileOnly("com.velocitypowered:velocity-proxy:3.4.0-SNAPSHOT") - compileOnly("com.github.spotbugs:spotbugs-annotations:4.9.3") + compileOnly("com.velocitypowered:velocity-api:3.5.0-SNAPSHOT") + annotationProcessor("com.velocitypowered:velocity-api:3.5.0-SNAPSHOT") + compileOnly("com.velocitypowered:velocity-proxy:3.5.0-SNAPSHOT") + compileOnly("com.github.spotbugs:spotbugs-annotations:4.9.8") - compileOnly("io.netty:netty-codec:4.2.7.Final") - compileOnly("io.netty:netty-handler:4.2.7.Final") + compileOnly("io.netty:netty-codec:4.2.10.Final") + compileOnly("io.netty:netty-handler:4.2.10.Final") - implementation("org.bstats:bstats-velocity:3.0.0") + implementation("org.bstats:bstats-velocity:3.2.1") } shadowJar { @@ -112,7 +112,7 @@ license { } checkstyle { - setToolVersion("10.1") + setToolVersion("13.3.0") setConfigFile(file("${this.getRootDir()}/config/checkstyle/checkstyle.xml")) setConfigProperties("configDirectory": "${this.getRootDir()}/config/checkstyle") @@ -147,4 +147,4 @@ sourceSets.main.getJava().srcDir(getTasks().register("generateTemplates", Copy) it.getOutputs() }) -assemble.dependsOn(shadowJar) \ No newline at end of file +assemble.dependsOn(shadowJar) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927..9bbc975 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2733ed5..aaaabb3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..faf9300 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# 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 -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +133,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=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=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +200,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, 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" \ @@ -205,6 +216,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..9b42019 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/main/java/net/elytrium/fastmotd/utils/ByteBufCopyThreadLocal.java b/src/main/java/net/elytrium/fastmotd/utils/ByteBufCopyThreadLocal.java index 9c97bfa..10cb0bd 100644 --- a/src/main/java/net/elytrium/fastmotd/utils/ByteBufCopyThreadLocal.java +++ b/src/main/java/net/elytrium/fastmotd/utils/ByteBufCopyThreadLocal.java @@ -30,7 +30,11 @@ public class ByteBufCopyThreadLocal extends ThreadLocal { public ByteBufCopyThreadLocal(ByteBuf from) { super(); - for (int i = 0; i < Runtime.getRuntime().availableProcessors(); ++i) { + int eventLoopThreads = Math.max(1, Integer.getInteger( + "io.netty.eventLoopThreads", + Math.max(1, Runtime.getRuntime().availableProcessors() * 2) + )); + for (int i = 0; i < eventLoopThreads; ++i) { this.byteBuffers.add(from.copy()); }