diff --git a/.gitignore b/.gitignore index 87356d808..d43de5a15 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ env.sh .project .settings .idea +.vscode build libs/ target/ diff --git a/build.gradle.kts b/build.gradle.kts index 3e48e5c44..eb8a800fe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,15 +1,15 @@ plugins { `java-library` - id("io.papermc.paperweight.userdev") version "1.5.11" - id("xyz.jpenilla.run-paper") version "2.2.0" // Adds runServer and runMojangMappedServer tasks for testing + id("io.papermc.paperweight.userdev") version "1.7.1" + id("xyz.jpenilla.run-paper") version "2.3.0" // Adds runServer and runMojangMappedServer tasks for testing } dependencies { - paperDevBundle("1.20.4-R0.1-SNAPSHOT") + paperDevBundle("1.20.6-R0.1-SNAPSHOT") } java { - sourceCompatibility = JavaVersion.VERSION_17 + toolchain.languageVersion.set(JavaLanguageVersion.of(21)) } // We don't need to generate an empty `vane.jar` @@ -26,9 +26,10 @@ subprojects { version = "1.14.0" repositories() { + mavenLocal() mavenCentral() maven("https://papermc.io/repo/repository/maven-public/") - //maven("https://repo.dmulloy2.net/nexus/repository/public/") + maven("https://repo.dmulloy2.net/nexus/repository/public/") maven("https://repo.mikeprimm.com/") maven("https://repo.codemc.org/repository/maven-public/") maven("https://jitpack.io") @@ -53,14 +54,14 @@ configure(subprojects.filter { apply(plugin = "io.papermc.paperweight.userdev") dependencies { - paperDevBundle("1.20.4-R0.1-SNAPSHOT") + paperDevBundle("1.20.6-R0.1-SNAPSHOT") } tasks { build { dependsOn("reobfJar") } - } + } } // All Projects except proxies and annotations. @@ -85,7 +86,7 @@ configure(subprojects.filter { } dependencies { - implementation(group = "com.comphenix.protocol", name = "ProtocolLib", version = "5.0.0-SNAPSHOT") + implementation(group = "com.comphenix.protocol", name = "ProtocolLib", version = "5.2.1-SNAPSHOT") compileOnly(project(":vane-annotations")) annotationProcessor(project(path = ":vane-annotations", configuration = "reobf")) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c02..e6441136f 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 84d1f85fd..b82aa23a4 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.3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0c8..1aa94a426 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,99 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$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"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# 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" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +119,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the 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. + JAVACMD=java + 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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +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 fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# 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" \ + -classpath "$CLASSPATH" \ + 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. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index ac1b06f93..7101f8e46 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,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 +41,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 +57,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 +76,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/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/CommandAnnotationProcessor.java b/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/CommandAnnotationProcessor.java index 9822bf229..b9d45d63c 100644 --- a/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/CommandAnnotationProcessor.java +++ b/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/CommandAnnotationProcessor.java @@ -20,7 +20,7 @@ "org.oddlama.vane.annotation.command.VaneCommand", } ) -@SupportedSourceVersion(SourceVersion.RELEASE_17) +@SupportedSourceVersion(SourceVersion.RELEASE_21) public class CommandAnnotationProcessor extends AbstractProcessor { @SuppressWarnings({ "rawtypes", "unchecked" }) diff --git a/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/ConfigAndLangProcessor.java b/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/ConfigAndLangProcessor.java index cf9f58dc0..fae2373b7 100644 --- a/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/ConfigAndLangProcessor.java +++ b/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/ConfigAndLangProcessor.java @@ -36,7 +36,7 @@ "org.oddlama.vane.annotation.lang.LangVersion", } ) -@SupportedSourceVersion(SourceVersion.RELEASE_17) +@SupportedSourceVersion(SourceVersion.RELEASE_21) public class ConfigAndLangProcessor extends AbstractProcessor { @Override diff --git a/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/VaneEnchantmentProcessor.java b/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/VaneEnchantmentProcessor.java index 74b3c7008..38242a0b0 100644 --- a/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/VaneEnchantmentProcessor.java +++ b/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/VaneEnchantmentProcessor.java @@ -13,7 +13,7 @@ import javax.tools.Diagnostic; @SupportedAnnotationTypes("org.oddlama.vane.annotation.enchantment.VaneEnchantment") -@SupportedSourceVersion(SourceVersion.RELEASE_17) +@SupportedSourceVersion(SourceVersion.RELEASE_21) public class VaneEnchantmentProcessor extends AbstractProcessor { @Override diff --git a/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/VaneModuleProcessor.java b/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/VaneModuleProcessor.java index 377e81766..cbcb63baf 100644 --- a/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/VaneModuleProcessor.java +++ b/vane-annotations/src/main/java/org/oddlama/vane/annotation/processor/VaneModuleProcessor.java @@ -13,7 +13,7 @@ import javax.tools.Diagnostic; @SupportedAnnotationTypes("org.oddlama.vane.annotation.VaneModule") -@SupportedSourceVersion(SourceVersion.RELEASE_17) +@SupportedSourceVersion(SourceVersion.RELEASE_21) public class VaneModuleProcessor extends AbstractProcessor { @Override diff --git a/vane-core/build.gradle.kts b/vane-core/build.gradle.kts index 9fa9be49c..e30e9ab68 100644 --- a/vane-core/build.gradle.kts +++ b/vane-core/build.gradle.kts @@ -1,7 +1,7 @@ import java.security.MessageDigest plugins { - id("com.github.johnrengelman.shadow") version "7.1.0" + id("io.github.goooler.shadow") version "8.1.7" id("net.kyori.blossom") version "1.2.0" // Text replacement for version numbers } @@ -10,10 +10,10 @@ blossom { } dependencies { - implementation(group = "org.bstats", name = "bstats-base", version = "3.0.0") - implementation(group = "org.bstats", name = "bstats-bukkit", version = "3.0.0") + implementation(group = "org.bstats", name = "bstats-base", version = "3.0.2") + implementation(group = "org.bstats", name = "bstats-bukkit", version = "3.0.2") implementation(group = "org.reflections", name = "reflections", version = "0.10.2") - implementation(group = "org.json", name = "json", version = "20200518") + api(group = "org.json", name = "json", version = "20200518") implementation(project(":vane-annotations")) } diff --git a/vane-core/src/main/java/org/oddlama/vane/core/Core.java b/vane-core/src/main/java/org/oddlama/vane/core/Core.java index c8e26bb7f..0efe657c4 100644 --- a/vane-core/src/main/java/org/oddlama/vane/core/Core.java +++ b/vane-core/src/main/java/org/oddlama/vane/core/Core.java @@ -5,6 +5,7 @@ import java.io.File; import java.io.IOException; +import java.net.URISyntaxException; import java.util.Collections; import java.util.IdentityHashMap; import java.util.Properties; @@ -21,6 +22,7 @@ import org.oddlama.vane.annotation.VaneModule; import org.oddlama.vane.annotation.config.ConfigBoolean; import org.oddlama.vane.annotation.lang.LangMessage; +import org.oddlama.vane.core.enchantments.CustomEnchantmentFixer; import org.oddlama.vane.core.enchantments.EnchantmentManager; import org.oddlama.vane.core.functional.Consumer1; import org.oddlama.vane.core.item.CustomItemRegistry; @@ -46,7 +48,6 @@ import net.minecraft.core.MappedRegistry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.enchantment.Enchantment; @VaneModule(name = "core", bstats = 8637, config_version = 6, lang_version = 4, storage_version = 1) @@ -78,6 +79,8 @@ public static Core instance() { public final ResourcePackDistributor resource_pack_distributor; + public final CustomEnchantmentFixer custom_enchantment_fixer; + public void register_module(Module module) { vane_modules.add(module); } @@ -136,6 +139,7 @@ public Core() { new org.oddlama.vane.core.commands.Enchant(this); menu_manager = new MenuManager(this); resource_pack_distributor = new ResourcePackDistributor(this); + custom_enchantment_fixer = new CustomEnchantmentFixer(this); new CommandHider(this); model_data_registry = new CustomModelDataRegistry(); item_registry = new CustomItemRegistry(); @@ -246,7 +250,7 @@ public void check_for_update() { log.warning("Please update as soon as possible to get the latest features and fixes."); log.warning("Get the latest release here: https://github.com/oddlama/vane/releases/latest"); } - } catch (IOException | JSONException e) { + } catch (IOException | JSONException | URISyntaxException e) { log.warning("Could not check for updates: " + e); } } diff --git a/vane-core/src/main/java/org/oddlama/vane/core/enchantments/CustomEnchantment.java b/vane-core/src/main/java/org/oddlama/vane/core/enchantments/CustomEnchantment.java index 706e5fb97..740a7b5c0 100644 --- a/vane-core/src/main/java/org/oddlama/vane/core/enchantments/CustomEnchantment.java +++ b/vane-core/src/main/java/org/oddlama/vane/core/enchantments/CustomEnchantment.java @@ -9,7 +9,7 @@ import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.EnchantmentTarget; import org.bukkit.inventory.ItemStack; -import org.bukkit.craftbukkit.v1_20_R3.enchantments.CraftEnchantment; +import org.bukkit.craftbukkit.enchantments.CraftEnchantment; import org.jetbrains.annotations.NotNull; import org.oddlama.vane.annotation.enchantment.Rarity; import org.oddlama.vane.annotation.enchantment.VaneEnchantment; diff --git a/vane-core/src/main/java/org/oddlama/vane/core/enchantments/CustomEnchantmentFixer.java b/vane-core/src/main/java/org/oddlama/vane/core/enchantments/CustomEnchantmentFixer.java new file mode 100644 index 000000000..f25b8ddc1 --- /dev/null +++ b/vane-core/src/main/java/org/oddlama/vane/core/enchantments/CustomEnchantmentFixer.java @@ -0,0 +1,208 @@ +package org.oddlama.vane.core.enchantments; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.inventory.InventoryCreativeEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.EnchantmentStorageMeta; +import org.oddlama.vane.core.Core; +import org.oddlama.vane.core.Listener; +import org.oddlama.vane.core.module.Context; +import org.oddlama.vane.util.Nms; + +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.events.ListenerPriority; +import com.comphenix.protocol.events.PacketAdapter; +import com.comphenix.protocol.events.PacketContainer; +import com.comphenix.protocol.events.PacketEvent; +import com.comphenix.protocol.wrappers.EnumWrappers; + +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; +import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket; +import net.minecraft.network.syncher.EntityDataSerializer; +import net.minecraft.network.syncher.SynchedEntityData.DataValue; +import net.minecraft.world.item.crafting.RecipeHolder; + +public class CustomEnchantmentFixer extends Listener { + + ArrayList containerAdapters = new ArrayList(); + + public CustomEnchantmentFixer(Context context) { + super(context); + + } + + @Override + protected void on_enable() { + super.on_enable(); + for (var type : new PacketType[] { + PacketType.Play.Server.WINDOW_ITEMS, + PacketType.Play.Server.ENTITY_METADATA, + PacketType.Play.Server.ENTITY_EQUIPMENT, + PacketType.Play.Server.SET_SLOT, + }) { + var a = new ContainerAdapter(type); + get_module().protocol_manager.addPacketListener(a); + containerAdapters.add(a); + } + + var recipeAdapter = new RecipeAdapter(); + get_module().protocol_manager.addPacketListener(recipeAdapter); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onCreativeItemMove(InventoryCreativeEvent event) { + Optional vaneEnchantment = event.getCurrentItem().getEnchantments().keySet().stream() + .filter((enchantment) -> enchantment.getKey().getNamespace().startsWith("vane")) + .findFirst(); + if(vaneEnchantment.isPresent()) { + event.setCancelled(true); + event.getView().getPlayer().sendMessage(Component.text("Moving items with Vane enchantments in creative mode is temporarily inactive.", NamedTextColor.GOLD)); + } + } + + public static ItemStack removeVaneEnchants(ItemStack item) { + if (item == null || item.getType() == null || item.getType() == Material.AIR) + return item; + ItemStack itemCopy = item.clone(); + + itemCopy.getEnchantments().forEach((enchantment, level) -> { + if (enchantment.getKey().getNamespace().startsWith("vane")) { + itemCopy.removeEnchantment(enchantment); + } + }); + + // also remove stored enchantments for enchanted books + if (itemCopy.getItemMeta() instanceof EnchantmentStorageMeta) { + EnchantmentStorageMeta meta = (EnchantmentStorageMeta) itemCopy.getItemMeta(); + meta.getStoredEnchants().forEach((enchantment, level) -> { + if (enchantment.getKey().getNamespace().startsWith("vane")) { + meta.removeStoredEnchant(enchantment); + } + }); + itemCopy.setItemMeta(meta); + } + + return itemCopy; + } + + class ContainerAdapter extends PacketAdapter { + private PacketType type; + + public ContainerAdapter(PacketType type) { + super( + CustomEnchantmentFixer.this.get_module(), + ListenerPriority.HIGHEST, + type); + this.type = type; + } + + @Override + public void onPacketSending(PacketEvent event) { + if (event.getPacket().getHandle() instanceof ClientboundSetEntityDataPacket edp) { + var newlist = edp.packedItems().stream().map(x -> { + if (x.value() instanceof net.minecraft.world.item.ItemStack itemStack) { + var bukkititem = CustomEnchantmentFixer.removeVaneEnchants(itemStack.asBukkitCopy()); + var newitem = Nms.item_handle(bukkititem); + return new DataValue(x.id(), + (EntityDataSerializer) x.serializer(), newitem); + } + return x; + }).toList(); + var newPacket = new ClientboundSetEntityDataPacket(edp.id(), newlist); + event.setPacket(PacketContainer.fromPacket(newPacket)); + } + try { + var mods = event.getPacket().getItemListModifier(); + for (int i = 0; i < mods.size(); ++i) { + try { + var slots = mods.readSafely(i); + List newSlots = slots.stream() + .map((item) -> CustomEnchantmentFixer.removeVaneEnchants(item)).toList(); + mods.writeSafely(i, newSlots); + } catch (Exception e) { + } + } + } catch (Exception e) { + } + try { + var mods = event.getPacket().getItemArrayModifier(); + for (int i = 0; i < mods.size(); ++i) { + try { + var slots = mods.readSafely(i); + var newSlots = (ItemStack[]) Arrays.stream(slots) + .map((item) -> CustomEnchantmentFixer.removeVaneEnchants(item)).toArray(); + mods.writeSafely(i, newSlots); + } catch (Exception e) { + } + } + } catch (Exception e) { + } + try { + var mods = event.getPacket().getSlotStackPairLists(); + for (int i = 0; i < mods.size(); ++i) { + try { + var slots = mods.readSafely(i); + var newSlots = slots.stream() + .map((pair) -> new com.comphenix.protocol.wrappers.Pair( + pair.getFirst(), + CustomEnchantmentFixer.removeVaneEnchants(pair.getSecond()))) + .toList(); + mods.writeSafely(i, newSlots); + } catch (Exception e) { + } + } + } catch (Exception e) { + } + try { + var mods = event.getPacket().getItemModifier(); + for (int i = 0; i < mods.size(); ++i) { + try { + var item = mods.readSafely(i); + item = CustomEnchantmentFixer.removeVaneEnchants(item); + mods.writeSafely(i, item); + } catch (Exception e) { + } + } + } catch (Exception e) { + } + } + } + class RecipeAdapter extends PacketAdapter { + public RecipeAdapter() { + super(CustomEnchantmentFixer.this.get_module(), + ListenerPriority.HIGHEST, + PacketType.Play.Server.RECIPE_UPDATE); + } + + @Override + public void onPacketSending(PacketEvent event) { + if(event.getPacketType().getCurrentId() != 0x77) { + return; + } + var packet = (ClientboundUpdateRecipesPacket) event.getPacket().getHandle(); + + var newRecipes = new ArrayList>(); + for (RecipeHolder recipe : packet.getRecipes()) { + if(recipe.id().getNamespace().startsWith("vane_enchantment")) continue; + newRecipes.add(recipe); + } + + var newPacket = new PacketContainer(PacketType.Play.Server.RECIPE_UPDATE, new ClientboundUpdateRecipesPacket(newRecipes)); + + event.setPacket(newPacket); + } + } + +} diff --git a/vane-core/src/main/java/org/oddlama/vane/core/enchantments/EnchantmentManager.java b/vane-core/src/main/java/org/oddlama/vane/core/enchantments/EnchantmentManager.java index 5b29d8c7a..523f4bc6f 100644 --- a/vane-core/src/main/java/org/oddlama/vane/core/enchantments/EnchantmentManager.java +++ b/vane-core/src/main/java/org/oddlama/vane/core/enchantments/EnchantmentManager.java @@ -27,7 +27,7 @@ import org.oddlama.vane.util.ItemUtil; import org.oddlama.vane.util.StorageUtil; -import org.bukkit.craftbukkit.v1_20_R3.enchantments.CraftEnchantment; +import org.bukkit.craftbukkit.enchantments.CraftEnchantment; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TranslatableComponent; diff --git a/vane-core/src/main/java/org/oddlama/vane/core/enchantments/NativeEnchantmentWrapper.java b/vane-core/src/main/java/org/oddlama/vane/core/enchantments/NativeEnchantmentWrapper.java index 6758e2a3e..2a1ae85ec 100644 --- a/vane-core/src/main/java/org/oddlama/vane/core/enchantments/NativeEnchantmentWrapper.java +++ b/vane-core/src/main/java/org/oddlama/vane/core/enchantments/NativeEnchantmentWrapper.java @@ -3,7 +3,11 @@ import static org.oddlama.vane.util.Nms.bukkit_enchantment; import static org.oddlama.vane.util.Nms.enchantment_slot_type; +import java.util.Optional; + import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; import org.jetbrains.annotations.NotNull; @@ -18,49 +22,45 @@ public class NativeEnchantmentWrapper extends Enchantment { private CustomEnchantment enchantment; public NativeEnchantmentWrapper(CustomEnchantment enchantment) { - super(Enchantment.Rarity.VERY_RARE, enchantment_slot_type(enchantment.target()), new EquipmentSlot[] {}); + // FIXME not sure of this constructor + super(new EnchantmentDefinition( + enchantment_slot_type(enchantment.target()), + Optional.empty(), + 0, + enchantment.max_level(), + new Enchantment.Cost(0, 0), + new Enchantment.Cost(0, 0), + 0, + FeatureFlags.VANILLA_SET, + new EquipmentSlot[] {} + )); this.enchantment = enchantment; } - @Override - public Enchantment.Rarity getRarity() { - switch (enchantment.rarity()) { - case COMMON: - return Enchantment.Rarity.COMMON; - case UNCOMMON: - return Enchantment.Rarity.UNCOMMON; - case RARE: - return Enchantment.Rarity.RARE; - case VERY_RARE: - return Enchantment.Rarity.VERY_RARE; - default: - return Enchantment.Rarity.VERY_RARE; - } - } - public CustomEnchantment custom() { return this.enchantment; } - @Override - public int getMinLevel() { - return enchantment.min_level(); - } - - @Override - public int getMaxLevel() { - return enchantment.max_level(); - } - - @Override - public int getMinCost(int level) { - return enchantment.min_cost(level); - } - - @Override - public int getMaxCost(int level) { - return enchantment.max_cost(level); - } + // FIXME these overriden methods are final + // @Override + // public int getMinLevel() { + // return enchantment.min_level(); + // } + + // @Override + // public int getMaxLevel() { + // return enchantment.max_level(); + // } + + // @Override + // public int getMinCost(int level) { + // return enchantment.min_cost(level); + // } + + // @Override + // public int getMaxCost(int level) { + // return enchantment.max_cost(level); + // } @Override public boolean isTreasureOnly() { diff --git a/vane-core/src/main/java/org/oddlama/vane/core/item/VanillaFunctionalityInhibitor.java b/vane-core/src/main/java/org/oddlama/vane/core/item/VanillaFunctionalityInhibitor.java index f97bbe77a..99415dc5f 100644 --- a/vane-core/src/main/java/org/oddlama/vane/core/item/VanillaFunctionalityInhibitor.java +++ b/vane-core/src/main/java/org/oddlama/vane/core/item/VanillaFunctionalityInhibitor.java @@ -4,7 +4,8 @@ import static org.oddlama.vane.util.Nms.item_handle; import org.bukkit.Keyed; -import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.entity.CraftItem; +import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.EntityType; import org.bukkit.entity.Item; @@ -129,10 +130,10 @@ public void on_prepare_smithing_copy_nbt(final PrepareSmithingEvent event) { } final var input = event.getInventory().getInputEquipment(); - final var input_nbt = CraftItemStack.asNMSCopy(input).getOrCreateTag(); - final var result_nbt = CraftItemStack.asNMSCopy(result).getOrCreateTag(); - final var nms_result = item_handle(result).copy(); - nms_result.setTag(result_nbt.merge(input_nbt)); + final var input_components = CraftItemStack.asNMSCopy(input).getComponents(); + final var nms_result = CraftItemStack.asNMSCopy(result); + nms_result.applyComponents(input_components); + event.setResult(custom_item_result.convertExistingStack(CraftItemStack.asCraftMirror(nms_result))); } @@ -195,7 +196,7 @@ public void on_item_mend(final PlayerItemMendEvent event) { @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void on_item_burn(final EntityDamageEvent event) { // Only burn damage on dropped items - if (event.getEntity().getType() != EntityType.DROPPED_ITEM) { + if (event.getEntity().getType() != EntityType.ITEM) { return; } diff --git a/vane-core/src/main/java/org/oddlama/vane/core/misc/AuthMultiplexer.java b/vane-core/src/main/java/org/oddlama/vane/core/misc/AuthMultiplexer.java index 4069d8fec..9882faa06 100644 --- a/vane-core/src/main/java/org/oddlama/vane/core/misc/AuthMultiplexer.java +++ b/vane-core/src/main/java/org/oddlama/vane/core/misc/AuthMultiplexer.java @@ -5,6 +5,7 @@ import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; +import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -88,7 +89,7 @@ private void try_init_multiplexed_player_name(final Player player) { Resolve.Skin skin; try { skin = resolve_skin(original_player_id); - } catch (IOException e) { + } catch (IOException | URISyntaxException e) { Bukkit.getLogger().log(Level.WARNING, "Failed to resolve skin for uuid '" + id + "'", e); return; } diff --git a/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/CustomResourcePackConfig.java b/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/CustomResourcePackConfig.java index 0d550eacb..f55acb6c8 100644 --- a/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/CustomResourcePackConfig.java +++ b/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/CustomResourcePackConfig.java @@ -16,6 +16,9 @@ public class CustomResourcePackConfig extends ModuleComponent { @ConfigString(def = "", desc = "Resource pack SHA-1 sum. Required to verify resource pack integrity.") public String config_sha1; + @ConfigString(def = "", desc = "Resource pack UUID.") + public String config_uuid; + public CustomResourcePackConfig(Context context) { super( context.group( diff --git a/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/ResourcePackDistributor.java b/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/ResourcePackDistributor.java index 815d6fcdb..8be6056f8 100644 --- a/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/ResourcePackDistributor.java +++ b/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/ResourcePackDistributor.java @@ -1,12 +1,11 @@ package org.oddlama.vane.core.resourcepack; -import com.google.common.hash.Hashing; -import com.google.common.io.Files; import java.io.File; import java.io.IOException; -import java.nio.file.StandardCopyOption; +import java.net.URI; +import java.net.URISyntaxException; import java.util.Properties; -import java.util.logging.Level; +import java.util.UUID; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -24,6 +23,13 @@ import org.oddlama.vane.core.module.ModuleGroup; import org.oddlama.vane.util.Nms; +import com.google.common.hash.Hashing; +import com.google.common.io.Files; + +import net.kyori.adventure.resource.ResourcePackInfo; +import net.kyori.adventure.resource.ResourcePackRequest; +import net.kyori.adventure.text.Component; + public class ResourcePackDistributor extends Listener { // Assume debug environment if both add-plugin and vane-debug are defined, until run-paper adds a better way. @@ -45,6 +51,7 @@ public class ResourcePackDistributor extends Listener { public String url = null; public String sha1 = null; + public UUID uuid = null; public int counter = 0; // The permission to bypass the resource pack @@ -94,6 +101,7 @@ public void on_enable() { get_module().log.info("Serving custom resource pack"); url = custom_resource_pack_config.config_url; sha1 = custom_resource_pack_config.config_sha1; + uuid = UUID.fromString(custom_resource_pack_config.config_uuid); } else { get_module().log.info("Serving official vane resource pack"); try { @@ -101,10 +109,12 @@ public void on_enable() { properties.load(Core.class.getResourceAsStream("/vane-core.properties")); url = properties.getProperty("resource_pack_url"); sha1 = properties.getProperty("resource_pack_sha1"); + uuid = UUID.fromString(properties.getProperty("resource_pack_uuid")); } catch (IOException e) { get_module().log.severe("Could not load official resource pack sha1 from included properties file"); url = ""; sha1 = ""; + uuid = UUID.randomUUID(); } } @@ -162,7 +172,13 @@ public void send_resource_pack(Player player) { url2 = url + "?" + counter; player.sendMessage(url2 + " " + sha1); } - player.setResourcePack(url2, sha1); + + try { + ResourcePackInfo info = ResourcePackInfo.resourcePackInfo(uuid, new URI(url2), sha1); + player.sendResourcePacks(ResourcePackRequest.resourcePackRequest().packs(info).asResourcePackRequest()); + } catch (URISyntaxException e) { + get_module().log.warning("The provided resource pack URL is incorrect: " + url2); + }; } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false) diff --git a/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/ResourcePackGenerator.java b/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/ResourcePackGenerator.java index b3ea0c60d..36ccecfac 100644 --- a/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/ResourcePackGenerator.java +++ b/vane-core/src/main/java/org/oddlama/vane/core/resourcepack/ResourcePackGenerator.java @@ -76,7 +76,7 @@ public void add_item_override( private String generate_pack_mcmeta() { final var pack = new JSONObject(); - pack.put("pack_format", 18); + pack.put("pack_format", 32); pack.put("description", description); final var root = new JSONObject(); diff --git a/vane-core/src/main/java/org/oddlama/vane/util/BlockUtil.java b/vane-core/src/main/java/org/oddlama/vane/util/BlockUtil.java index 2dc61e84e..c9ee933e2 100644 --- a/vane-core/src/main/java/org/oddlama/vane/util/BlockUtil.java +++ b/vane-core/src/main/java/org/oddlama/vane/util/BlockUtil.java @@ -15,7 +15,7 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Skull; -import org.bukkit.craftbukkit.v1_20_R3.CraftWorld; +import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/vane-core/src/main/java/org/oddlama/vane/util/IOUtil.java b/vane-core/src/main/java/org/oddlama/vane/util/IOUtil.java index a7db6f847..58cdf4e23 100644 --- a/vane-core/src/main/java/org/oddlama/vane/util/IOUtil.java +++ b/vane-core/src/main/java/org/oddlama/vane/util/IOUtil.java @@ -1,15 +1,16 @@ package org.oddlama.vane.util; -import org.json.JSONException; -import org.json.JSONObject; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; +import org.json.JSONException; +import org.json.JSONObject; + public class IOUtil { private static String read_all(Reader rd) throws IOException { final var sb = new StringBuilder(); @@ -20,9 +21,9 @@ private static String read_all(Reader rd) throws IOException { return sb.toString(); } - public static JSONObject read_json_from_url(String url) throws IOException, JSONException { + public static JSONObject read_json_from_url(String url) throws IOException, JSONException, URISyntaxException { try (final var rd = new BufferedReader( - new InputStreamReader(new URL(url).openStream(), StandardCharsets.UTF_8))) { + new InputStreamReader(new URI(url).toURL().openStream(), StandardCharsets.UTF_8))) { return new JSONObject(read_all(rd)); } } diff --git a/vane-core/src/main/java/org/oddlama/vane/util/ItemUtil.java b/vane-core/src/main/java/org/oddlama/vane/util/ItemUtil.java index 33c7ae701..1283504ea 100644 --- a/vane-core/src/main/java/org/oddlama/vane/util/ItemUtil.java +++ b/vane-core/src/main/java/org/oddlama/vane/util/ItemUtil.java @@ -20,8 +20,8 @@ import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_20_R3.enchantments.CraftEnchantment; -import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.enchantments.CraftEnchantment; +import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -38,9 +38,12 @@ import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextDecoration; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; +import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.item.ItemParser; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.RandomSource; import net.minecraft.world.item.Item; public class ItemUtil { @@ -52,6 +55,8 @@ public class ItemUtil { public static final UUID MODIFIER_UUID_GENERIC_ATTACK_SPEED = UUID.fromString( "FA233E1C-4180-4865-B01B-BCCE9785ACA3"); + private static RandomSource randomSource = RandomSource.create(); + public static void damage_item(final Player player, final ItemStack item_stack, final int amount) { if (amount <= 0) { return; @@ -62,8 +67,7 @@ public static void damage_item(final Player player, final ItemStack item_stack, return; } - handle.hurtAndBreak(amount, player_handle(player), onBreak -> { - }); + handle.hurtAndBreak(amount, randomSource, player_handle(player), () -> {}); } public static String name_of(final ItemStack item) { @@ -152,22 +156,7 @@ public static int compare_enchantments(final ItemStack item_a, final ItemStack i if (a_count != b_count) { return b_count - a_count; } - - // Sort by combined rarity (rare = low value) first - final var a_rarity = ae - .keySet() - .stream() - .mapToInt(e -> ((CraftEnchantment)e).getHandle().getRarity().getWeight()) - .sum(); - final var b_rarity = be - .keySet() - .stream() - .mapToInt(e -> ((CraftEnchantment)e).getHandle().getRarity().getWeight()) - .sum(); - if (a_rarity != b_rarity) { - return b_rarity - a_rarity; - } - + final var a_sorted = ae .entrySet() .stream() @@ -359,7 +348,7 @@ private static ItemStack apply_enchants(final ItemStack item_stack, @Nullable St * material. */ public static @NotNull Pair itemstack_from_string(String definition) { - // namespace:key[{nbtdata}][#enchants{}], where the key can reference a + // namespace:key[[components]][#enchants{}], where the key can reference a // material, head material or customitem. final var enchants_delim = definition.indexOf("#enchants{"); String enchants = null; @@ -368,7 +357,7 @@ private static ItemStack apply_enchants(final ItemStack item_stack, @Nullable St definition = definition.substring(0, enchants_delim); } - final var nbt_delim = definition.indexOf('{'); + final var nbt_delim = definition.indexOf('['); NamespacedKey key; if (nbt_delim == -1) { key = NamespacedKey.fromString(definition); @@ -393,12 +382,12 @@ private static ItemStack apply_enchants(final ItemStack item_stack, @Nullable St // of whatever the extended material gave us. final var vanilla_definition = item_stack.getType().key() + definition.substring(nbt_delim); try { - final var parsed_nbt = ItemParser - .parseForItem(BuiltInRegistries.ITEM.asLookup(), new StringReader(vanilla_definition)).nbt(); - final var inherent_nbt = CraftItemStack.asNMSCopy(item_stack).getOrCreateTag(); + final var parsed_nbt = new ItemParser(Commands.createValidationContext(MinecraftServer.getDefaultRegistryAccess())).parse(new StringReader(vanilla_definition)).components(); + // Now apply the NBT be parsed by minecraft's internal parser to the itemstack. final var nms_item = item_handle(item_stack).copy(); - nms_item.setTag(inherent_nbt.merge(parsed_nbt)); + nms_item.applyComponents(parsed_nbt); + return Pair.of(apply_enchants(CraftItemStack.asCraftMirror(nms_item), enchants), false); } catch (final CommandSyntaxException e) { throw new IllegalArgumentException("Could not parse NBT of item definition: " + definition, e); diff --git a/vane-core/src/main/java/org/oddlama/vane/util/Nms.java b/vane-core/src/main/java/org/oddlama/vane/util/Nms.java index 99bd35aad..a1bd727f8 100644 --- a/vane-core/src/main/java/org/oddlama/vane/util/Nms.java +++ b/vane-core/src/main/java/org/oddlama/vane/util/Nms.java @@ -8,13 +8,12 @@ import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.NamespacedKey; -import org.bukkit.craftbukkit.v1_20_R3.CraftServer; -import org.bukkit.craftbukkit.v1_20_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R3.enchantments.CraftEnchantment; -import org.bukkit.craftbukkit.v1_20_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_20_R3.util.CraftNamespacedKey; +import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.craftbukkit.enchantments.CraftEnchantment; +import org.bukkit.craftbukkit.entity.CraftEntity; +import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.enchantments.EnchantmentTarget; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -27,6 +26,8 @@ import net.minecraft.server.dedicated.DedicatedServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; import net.minecraft.util.datafix.DataFixers; import net.minecraft.util.datafix.fixes.References; import net.minecraft.world.Clearable; @@ -34,8 +35,8 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.CreativeModeTabs; +import net.minecraft.world.item.Item; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentCategory; public class Nms { @@ -59,37 +60,36 @@ public static org.bukkit.enchantments.Enchantment bukkit_enchantment(Enchantment public static org.bukkit.inventory.ItemStack bukkit_item_stack(ItemStack stack) { return CraftItemStack.asCraftMirror(stack); } - - public static EnchantmentCategory enchantment_slot_type(EnchantmentTarget target) { + public static TagKey enchantment_slot_type(EnchantmentTarget target) { switch (target) { case ARMOR: - return EnchantmentCategory.ARMOR; + return ItemTags.ARMOR_ENCHANTABLE; case ARMOR_FEET: - return EnchantmentCategory.ARMOR_FEET; + return ItemTags.FOOT_ARMOR_ENCHANTABLE; case ARMOR_HEAD: - return EnchantmentCategory.ARMOR_HEAD; + return ItemTags.HEAD_ARMOR_ENCHANTABLE; case ARMOR_LEGS: - return EnchantmentCategory.ARMOR_LEGS; + return ItemTags.LEG_ARMOR_ENCHANTABLE; case ARMOR_TORSO: - return EnchantmentCategory.ARMOR_CHEST; + return ItemTags.CHEST_ARMOR_ENCHANTABLE; case TOOL: - return EnchantmentCategory.DIGGER; + return ItemTags.MINING_ENCHANTABLE; case WEAPON: - return EnchantmentCategory.WEAPON; + return ItemTags.WEAPON_ENCHANTABLE; case BOW: - return EnchantmentCategory.BOW; + return ItemTags.BOW_ENCHANTABLE; case FISHING_ROD: - return EnchantmentCategory.FISHING_ROD; + return ItemTags.FISHING_ENCHANTABLE; case BREAKABLE: - return EnchantmentCategory.BREAKABLE; + return ItemTags.DURABILITY_ENCHANTABLE; case WEARABLE: - return EnchantmentCategory.WEARABLE; + return ItemTags.EQUIPPABLE_ENCHANTABLE; case TRIDENT: - return EnchantmentCategory.TRIDENT; + return ItemTags.TRIDENT_ENCHANTABLE; case CROSSBOW: - return EnchantmentCategory.CROSSBOW; + return ItemTags.CROSSBOW_ENCHANTABLE; case VANISHABLE: - return EnchantmentCategory.VANISHABLE; + return ItemTags.VANISHING_ENCHANTABLE; default: return null; } diff --git a/vane-core/src/main/java/org/oddlama/vane/util/Resolve.java b/vane-core/src/main/java/org/oddlama/vane/util/Resolve.java index e0358ad52..f300279bf 100644 --- a/vane-core/src/main/java/org/oddlama/vane/util/Resolve.java +++ b/vane-core/src/main/java/org/oddlama/vane/util/Resolve.java @@ -1,8 +1,11 @@ package org.oddlama.vane.util; import java.io.IOException; +import java.net.URISyntaxException; import java.util.UUID; +import org.json.JSONException; + public class Resolve { public static class Skin { @@ -10,7 +13,7 @@ public static class Skin { public String signature; } - public static Skin resolve_skin(UUID id) throws IOException { + public static Skin resolve_skin(UUID id) throws IOException, JSONException, URISyntaxException { final var url = "https://sessionserver.mojang.com/session/minecraft/profile/" + id + "?unsigned=false"; final var json = IOUtil.read_json_from_url(url); @@ -21,7 +24,7 @@ public static Skin resolve_skin(UUID id) throws IOException { return skin; } - public static UUID resolve_uuid(String name) throws IOException { + public static UUID resolve_uuid(String name) throws IOException, JSONException, URISyntaxException { final var url = "https://api.mojang.com/users/profiles/minecraft/" + name; final var json = IOUtil.read_json_from_url(url); diff --git a/vane-core/src/main/resources/vane-core.properties b/vane-core/src/main/resources/vane-core.properties index 97f092649..d1e8b8550 100644 --- a/vane-core/src/main/resources/vane-core.properties +++ b/vane-core/src/main/resources/vane-core.properties @@ -1,3 +1,4 @@ resource_pack_url=https://oddlama.github.io/vane/resourcepacks/v${version}.zip resource_pack_sha1=${resource_pack_sha1} +resource_pack_uuid=97338e2a-3653-468c-a000-330c52ea10cb version=${version} diff --git a/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Angel.java b/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Angel.java index 797f28c2c..17c5e4470 100644 --- a/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Angel.java +++ b/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Angel.java @@ -118,6 +118,6 @@ public void on_player_move(final PlayerMoveEvent event) { // Spawn particles loc .getWorld() - .spawnParticle(Particle.FIREWORKS_SPARK, loc, 0, -new_vel.getX(), -new_vel.getY(), -new_vel.getZ(), 0.4); + .spawnParticle(Particle.FIREWORK, loc, 0, -new_vel.getX(), -new_vel.getY(), -new_vel.getZ(), 0.4); } } diff --git a/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Soulbound.java b/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Soulbound.java index 78da26b28..15ba8d536 100644 --- a/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Soulbound.java +++ b/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Soulbound.java @@ -24,6 +24,7 @@ import org.oddlama.vane.core.lang.TranslatedMessage; import org.oddlama.vane.core.module.Context; import org.oddlama.vane.core.enchantments.CustomEnchantment; +import org.oddlama.vane.core.enchantments.CustomEnchantmentFixer; import org.oddlama.vane.enchantments.Enchantments; import org.oddlama.vane.util.StorageUtil; @@ -140,7 +141,7 @@ public void on_player_drop_item(final PlayerDropItemEvent event) { var meta = dropped_item.getItemMeta(); drop_cooldown.clear(dropped_item.getItemMeta()); dropped_item.setItemMeta(meta); - lang_dropped_notification.send(event.getPlayer(), dropped_item.displayName()); + lang_dropped_notification.send(event.getPlayer(), CustomEnchantmentFixer.removeVaneEnchants(dropped_item).displayName()); return; } final var inventory = event.getPlayer().getInventory(); @@ -149,7 +150,7 @@ public void on_player_drop_item(final PlayerDropItemEvent event) { event.setCancelled(true); lang_drop_lock_warning.send_action_bar( event.getPlayer(), - event.getItemDrop().getItemStack().displayName() + CustomEnchantmentFixer.removeVaneEnchants(event.getItemDrop().getItemStack()).displayName() ); } else { // Inventory is full (e.g. when exiting crafting table with soulbound item in it) @@ -177,7 +178,7 @@ public void on_player_drop_item(final PlayerDropItemEvent event) { final var player = event.getPlayer(); inventory.setItem(non_soulbound_item_slot, dropped_item); player.getLocation().getWorld().dropItem(player.getLocation(), non_soulbound_item); - lang_drop_lock_warning.send_action_bar(player, event.getItemDrop().getItemStack().displayName()); + lang_drop_lock_warning.send_action_bar(player, CustomEnchantmentFixer.removeVaneEnchants(event.getItemDrop().getItemStack()).displayName()); event.setCancelled(true); } } diff --git a/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/TakeOff.java b/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/TakeOff.java index be2408ef6..0e7c57c4f 100644 --- a/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/TakeOff.java +++ b/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/TakeOff.java @@ -107,7 +107,7 @@ public void on_player_toggle_glide(EntityToggleGlideEvent event) { loc .getWorld() .spawnParticle( - Particle.FIREWORKS_SPARK, + Particle.FIREWORK, loc.add(rnd), 0, dir.getX(), diff --git a/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Unbreakable.java b/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Unbreakable.java index a9bb14845..df92b1c0c 100644 --- a/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Unbreakable.java +++ b/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Unbreakable.java @@ -22,7 +22,7 @@ public class Unbreakable extends CustomEnchantment { public Unbreakable(Context context) { super(context); - supersedes(Enchantment.DURABILITY); + supersedes(Enchantment.UNBREAKING); supersedes(Enchantment.MENDING); } diff --git a/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Wings.java b/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Wings.java index a7b41c7d7..4ce930bf4 100644 --- a/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Wings.java +++ b/vane-enchantments/src/main/java/org/oddlama/vane/enchantments/enchantments/Wings.java @@ -130,7 +130,7 @@ public void on_player_toggle_sneak(PlayerToggleSneakEvent event) { loc .getWorld() .spawnParticle( - Particle.FIREWORKS_SPARK, + Particle.FIREWORK, loc.add(rnd), 0, dir.getX(), diff --git a/vane-portals/build.gradle.kts b/vane-portals/build.gradle.kts index 6849e1fad..a9e190a7e 100644 --- a/vane-portals/build.gradle.kts +++ b/vane-portals/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("com.github.johnrengelman.shadow") version "7.1.0" + id("io.github.goooler.shadow") version "8.1.7" } dependencies { diff --git a/vane-portals/src/main/java/org/oddlama/vane/portals/Portals.java b/vane-portals/src/main/java/org/oddlama/vane/portals/Portals.java index d4ffdc60f..2b767acb7 100644 --- a/vane-portals/src/main/java/org/oddlama/vane/portals/Portals.java +++ b/vane-portals/src/main/java/org/oddlama/vane/portals/Portals.java @@ -511,7 +511,7 @@ public void remove_portal_block(final PortalBlock portal_block) { // Spawn effect if not portal area if (portal_block.type() != PortalBlock.Type.PORTAL) { portal_block.block().getWorld() - .spawnParticle(Particle.ENCHANTMENT_TABLE, portal_block.block().getLocation().add(0.5, 0.5, 0.5), 50, 0.0, 0.0, 0.0, 1.0); + .spawnParticle(Particle.ENCHANT, portal_block.block().getLocation().add(0.5, 0.5, 0.5), 50, 0.0, 0.0, 0.0, 1.0); } } diff --git a/vane-portals/src/main/java/org/oddlama/vane/portals/entity/FloatingItem.java b/vane-portals/src/main/java/org/oddlama/vane/portals/entity/FloatingItem.java index 7fbb76e30..ddd634703 100644 --- a/vane-portals/src/main/java/org/oddlama/vane/portals/entity/FloatingItem.java +++ b/vane-portals/src/main/java/org/oddlama/vane/portals/entity/FloatingItem.java @@ -99,8 +99,7 @@ public void load(CompoundTag nbt) {} @Override public void setItem(ItemStack itemStack) { super.setItem(itemStack); - - if (itemStack.hasCustomHoverName()) { + if (itemStack.getHoverName().toFlatList().size() > 0) { setCustomNameVisible(true); setCustomName(itemStack.getHoverName()); } else setCustomNameVisible(false); diff --git a/vane-proxy-core/build.gradle.kts b/vane-proxy-core/build.gradle.kts index b38cff522..cce7ebde1 100644 --- a/vane-proxy-core/build.gradle.kts +++ b/vane-proxy-core/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("com.github.johnrengelman.shadow") version "7.1.0" + id("io.github.goooler.shadow") version "8.1.7" } dependencies { diff --git a/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/listeners/PreLoginEvent.java b/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/listeners/PreLoginEvent.java index a0ddde3e8..1bcf06708 100644 --- a/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/listeners/PreLoginEvent.java +++ b/vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/listeners/PreLoginEvent.java @@ -8,6 +8,7 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; +import java.net.URISyntaxException; import java.util.UUID; import java.util.logging.Level; @@ -45,7 +46,7 @@ public void fire(PreLoginDestination destination) { try { uuid = resolve_uuid(playerName); - } catch (IOException e) { + } catch (IOException | URISyntaxException e) { plugin.get_logger().log(Level.WARNING, "Failed to resolve UUID for player '" + playerName + "'", e); return; } diff --git a/vane-regions/build.gradle.kts b/vane-regions/build.gradle.kts index d9da6416f..398fc3af1 100644 --- a/vane-regions/build.gradle.kts +++ b/vane-regions/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("com.github.johnrengelman.shadow") version "7.1.0" + id("io.github.goooler.shadow") version "8.1.7" } dependencies { diff --git a/vane-regions/src/main/java/org/oddlama/vane/regions/Regions.java b/vane-regions/src/main/java/org/oddlama/vane/regions/Regions.java index 4429d4d5f..40df366dc 100644 --- a/vane-regions/src/main/java/org/oddlama/vane/regions/Regions.java +++ b/vane-regions/src/main/java/org/oddlama/vane/regions/Regions.java @@ -320,7 +320,7 @@ private void visualize_edge(final World world, final BlockPos c1, final BlockPos // Spawn colored particles indicating validity world.spawnParticle( - Particle.REDSTONE, + Particle.DUST, mx, my, mz, diff --git a/vane-trifles/src/main/java/org/oddlama/vane/trifles/FastWalkingListener.java b/vane-trifles/src/main/java/org/oddlama/vane/trifles/FastWalkingListener.java index 74f44640d..9d01a3d91 100644 --- a/vane-trifles/src/main/java/org/oddlama/vane/trifles/FastWalkingListener.java +++ b/vane-trifles/src/main/java/org/oddlama/vane/trifles/FastWalkingListener.java @@ -20,13 +20,13 @@ public FastWalkingListener(FastWalkingGroup context) { this.fast_walking = context; } @ConfigBoolean(def = false, desc = "Whether hostile mobs should be allowed to fast walk on paths.") - public boolean hostile_speedwalk; + public boolean config_hostile_speedwalk; @ConfigBoolean(def = true, desc = "Whether villagers should be allowed to fast walk on paths.") - public boolean villager_speedwalk; + public boolean config_villager_speedwalk; @ConfigBoolean(def = false, desc = "Whether players should be the only entities allowed to fast walk on paths (will override other path walk settings).") - public boolean players_only_speedwalk; + public boolean config_players_only_speedwalk; @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void on_player_move(final PlayerMoveEvent event) { @@ -57,13 +57,13 @@ public void on_entity_move(final EntityMoveEvent event) { final var entity = event.getEntity(); // Cancel event if speedwalking is only enabled for players - if(players_only_speedwalk) return; + if(config_players_only_speedwalk) return; // Cancel event if speedwalking is disabled for Hostile mobs - if(entity instanceof Monster && !hostile_speedwalk) return; + if(entity instanceof Monster && !config_hostile_speedwalk) return; // Cancel event if speedwalking is disabled for villagers - if(entity.getType() == EntityType.VILLAGER && !villager_speedwalk) return; + if(entity.getType() == EntityType.VILLAGER && !config_villager_speedwalk) return; // Inspect block type just a little below var block = event.getTo().clone().subtract(0.0, 0.1, 0.0).getBlock(); diff --git a/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/LodestoneScroll.java b/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/LodestoneScroll.java index 63d6167ce..ba38b1f4f 100644 --- a/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/LodestoneScroll.java +++ b/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/LodestoneScroll.java @@ -119,7 +119,7 @@ public void on_player_interact(final PlayerInteractEvent event) { // Effects and sound swing_arm(player, event.getHand()); - block.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, block.getLocation().add(0.5, 2.0, 0.5), 100, 0.1, 0.3, 0.1, 2.0); + block.getWorld().spawnParticle(Particle.ENCHANT, block.getLocation().add(0.5, 2.0, 0.5), 100, 0.1, 0.3, 0.1, 2.0); block.getWorld().playSound(block.getLocation(), Sound.BLOCK_RESPAWN_ANCHOR_CHARGE, SoundCategory.BLOCKS, 1.0f, 3.0f); // Prevent offhand from triggering (e.g. placing torches) diff --git a/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/NorthCompass.java b/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/NorthCompass.java index a25b4cfef..33b5f22b6 100644 --- a/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/NorthCompass.java +++ b/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/NorthCompass.java @@ -43,6 +43,7 @@ public ItemStack updateItemStack(final ItemStack item_stack) { if (worlds.size() > 0) { final var world = worlds.get(0); if (world != null) { + item_stack.editMeta(CompassMeta.class, meta -> meta.setLodestoneTracked(true)); item_stack.editMeta(CompassMeta.class, meta -> meta.setLodestone(new Location(world, 0.0, 0.0, -999999999.0))); } } diff --git a/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/Trowel.java b/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/Trowel.java index 2e1c61ded..dffbd1245 100644 --- a/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/Trowel.java +++ b/vane-trifles/src/main/java/org/oddlama/vane/trifles/items/Trowel.java @@ -14,7 +14,7 @@ import org.bukkit.Sound; import org.bukkit.SoundCategory; import org.bukkit.Tag; -import org.bukkit.craftbukkit.v1_20_R3.block.CraftBlock; +import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; diff --git a/vane-velocity/build.gradle.kts b/vane-velocity/build.gradle.kts index 2157e4735..b9da65c18 100644 --- a/vane-velocity/build.gradle.kts +++ b/vane-velocity/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("com.github.johnrengelman.shadow") version "7.1.0" + id("io.github.goooler.shadow") version "8.1.7" } dependencies {