diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d80cdd8..630083a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,10 +13,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Build with Gradle uses: gradle/gradle-build-action@v2.4.2 @@ -24,6 +24,6 @@ jobs: arguments: shadowJar - name: Upload jarfiles if: github.event_name != 'pull_request' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: plugin/build/libs/*.jar diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 601cc03b..a8f0afb3 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -3,7 +3,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { id("chatchat.base-conventions") id("chatchat.publish-conventions") - id("com.github.johnrengelman.shadow") version "7.1.2" + id("com.gradleup.shadow") version "8.3.5" } repositories { diff --git a/build-logic/src/main/kotlin/chatchat.base-conventions.gradle.kts b/build-logic/src/main/kotlin/chatchat.base-conventions.gradle.kts index b97e556d..2f0b84bd 100644 --- a/build-logic/src/main/kotlin/chatchat.base-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/chatchat.base-conventions.gradle.kts @@ -4,12 +4,12 @@ plugins { repositories { mavenCentral() - maven("https://papermc.io/repo/repository/maven-public/") + maven("https://repo.papermc.io/repository/maven-public/") } java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 withSourcesJar() withJavadocJar() } diff --git a/build-logic/src/main/kotlin/chatchat.parent-conventions.gradle.kts b/build-logic/src/main/kotlin/chatchat.parent-conventions.gradle.kts index 408156c4..8d3362e7 100644 --- a/build-logic/src/main/kotlin/chatchat.parent-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/chatchat.parent-conventions.gradle.kts @@ -7,6 +7,6 @@ repositories { } java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 -} \ No newline at end of file + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 43afebf0..7745e73d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,15 +1,15 @@ [versions] # Minecraft -spigot = "1.20.1-R0.1-SNAPSHOT" +spigot = "1.21.4-R0.1-SNAPSHOT" # Adventure minimessage = "4.16.0" -adventure-platform = "4.3.3-SNAPSHOT" +adventure-platform = "4.3.4" # Other configurate = "4.1.2" cmds = "2.0.0-SNAPSHOT" -papi = "2.11.1" +papi = "2.11.6" towny = "0.98.1.3" discordsrv = "1.25.1" supervanish = "6.2.17" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927a..a4b76b95 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 8049c684..9355b415 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-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..f5feea6d 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,12 @@ 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 +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +134,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 +201,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" \ @@ -205,6 +217,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 107acd32..9d21a218 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,8 +13,10 @@ @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 +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 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. +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 @@ -56,11 +59,11 @@ 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. +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 @@ -75,13 +78,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +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 diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index a6b1d025..302e5466 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -1,10 +1,14 @@ -import dev.triumphteam.helper.* import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import dev.triumphteam.helper.papi +import dev.triumphteam.helper.triumphSnapshots +import xyz.jpenilla.resourcefactory.bukkit.Permission +import xyz.jpenilla.resourcefactory.bukkit.bukkitPluginYaml plugins { id("chatchat.base-conventions") - id("com.github.johnrengelman.shadow") version "7.1.2" + id("com.gradleup.shadow") version "8.3.5" id("me.mattstudios.triumph") version "0.2.8" + id("xyz.jpenilla.resource-factory") version "1.2.0" } version = "${rootProject.version}-${System.getenv("BUILD_NUMBER")}" @@ -41,164 +45,177 @@ dependencies { compileOnly(libs.griefprevention) } -bukkit { +val yaml = bukkitPluginYaml { + // Defaults for name, version, and description are inherited from the Gradle project + main = "at.helpch.chatchat.ChatChatPlugin" + authors.add("HelpChat") name = "ChatChat" + apiVersion = "1.21.4" description = "DelucksChat 2.0 or smth like that" - authors = listOf("HelpChat") depend = listOf("PlaceholderAPI") - softdepend = listOf("Towny", "DiscordSRV", "SuperVanish", "PremiumVanish", "GriefPrevention") - loadbefore = listOf("Essentials") - apiVersion = "1.13" + + dependencies { + softDepend = listOf("Towny", "DiscordSRV", "SuperVanish", "PremiumVanish", "GriefPrevention") + loadBefore = listOf("Essentials") + } + permissions { - permission("chatchat.admin") { + create("chatchat.admin") { description = "Execute admin commands" - default = "op" + default = Permission.Default.OP } - permission("chatchat.socialspy") { + create("chatchat.socialspy") { description = "Spy on private messages" - default = "op" + default = Permission.Default.OP } - permission("chatchat.test.format") { + create("chatchat.test.format") { description = "Test formats" - default = "op" + default = Permission.Default.OP } - permission("chatchat.pm") { + create("chatchat.pm") { description = "Send or reply to private messages" - default = "op" + default = Permission.Default.OP } - permission("chatchat.pm.toggle") { + create("chatchat.pm.toggle") { description = "Toggle private messages" - default = "op" + default = Permission.Default.OP } - permission("chatchat.ignore") { + create("chatchat.ignore") { description = "Permission to use /ignore to toggle ignoring a user" - default = "op" + default = Permission.Default.OP } - permission("chatchat.ignore.bypass") { + create("chatchat.ignore.bypass") { description = "Bypass being ignored." - default = "op" + default = Permission.Default.OP } - permission("chatchat.ignorelist") { + create("chatchat.ignorelist") { description = "List all the players that you are ignoring." - default = "op" + default = Permission.Default.OP } - permission("chatchat.utf") { + create("chatchat.utf") { description = "Send any char in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.url") { + create("chatchat.url") { description = "Send clickable URLs in chat" - default = "false" + default = Permission.Default.FALSE } - permission("chatchat.channel.bypass-radius") { + create("chatchat.channel.bypass-radius") { description = "Bypass the channel radius" - default = "op" + default = Permission.Default.OP } - permission("chatchat.mention.personal") { + create("chatchat.mention.personal") { description = "Mention other players" - default = "op" + default = Permission.Default.OP } - permission("chatchat.mention.everyone") { + create("chatchat.mention.everyone") { description = "Mention the whole channel" - default = "op" + default = Permission.Default.OP } - permission("chatchat.mention.personal.block") { + create("chatchat.mention.personal.block") { description = "Don't get mentioned by other players" - default = "op" + default = Permission.Default.OP } - permission("chatchat.mention.everyone.block") { + create("chatchat.mention.everyone.block") { description = "Don't get mentioned when there's a channel ping" - default = "op" + default = Permission.Default.OP } - permission("chatchat.mention.personal.block.override") { + create("chatchat.mention.personal.block.override") { description = "Mention other players even when they have mentions blocked" - default = "op" + default = Permission.Default.OP } - permission("chatchat.mention.everyone.block.override") { + create("chatchat.mention.everyone.block.override") { description = "Mention the whole channel even those that have channel mentions blocked" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.item") { + create("chatchat.tag.item") { description = "Use the tag in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.click") { + create("chatchat.tag.click") { description = "Use the tag in chat" - default = "false" + default = Permission.Default.FALSE } - permission("chatchat.tag.color") { + create("chatchat.tag.color") { description = "Use the tags in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.font") { + create("chatchat.tag.font") { description = "Use the tag in chat" - default = "false" + default = Permission.Default.FALSE } - permission("chatchat.tag.gradient") { + create("chatchat.tag.gradient") { description = "Use the tag in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.hover") { + create("chatchat.tag.hover") { description = "Use the tag in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.insertion") { + create("chatchat.tag.insertion") { description = "Use the tag in chat" - default = "false" + default = Permission.Default.FALSE } - permission("chatchat.tag.keybind") { + create("chatchat.tag.keybind") { description = "Use the tag in chat" - default = "false" + default = Permission.Default.FALSE } - permission("chatchat.tag.newline") { + create("chatchat.tag.newline") { description = "Use the tags in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.rainbow") { + create("chatchat.tag.rainbow") { description = "Use the tag in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.reset") { + create("chatchat.tag.reset") { description = "Use the tag in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.translatable") { + create("chatchat.tag.translatable") { description = "Use the tags in chat" - default = "false" + default = Permission.Default.FALSE } - permission("chatchat.tag.obfuscated") { + create("chatchat.tag.obfuscated") { description = "Use the tags in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.bold") { + create("chatchat.tag.bold") { description = "Use the tags in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.strikethrough") { + create("chatchat.tag.strikethrough") { description = "Use the tags in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.underlined") { + create("chatchat.tag.underlined") { description = "Use the tags in chat" - default = "op" + default = Permission.Default.OP } - permission("chatchat.tag.italic") { + create("chatchat.tag.italic") { description = "Use the tags in chat" - default = "op" + default = Permission.Default.OP } } } +sourceSets.main { + resourceFactory { + factory(yaml.resourceFactory()) + } +} + tasks { withType { - listOf("net.kyori", + listOf( + "net.kyori", "dev.triumphteam", "org.spongepowered", "io.leangen",