diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1ef6f4f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,15 @@ +name: Build +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: actions/setup-java@master + name: Setup JDK + with: + distribution: 'microsoft' + java-version: 17 + - name: Build with Gradle + run: gradle shadowJar diff --git a/.gitignore b/.gitignore index 4788b4b..347e76b 100644 --- a/.gitignore +++ b/.gitignore @@ -111,3 +111,7 @@ buildNumber.properties # Common working directory run/ + +# Gradle +.gradle/ +build/ \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..86ed67e --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,115 @@ +import java.net.URL +import java.nio.file.Files + +val serverDir: File = projectDir.resolve("run") +val pluginDir: File = serverDir.resolve("plugins") + +plugins { + `java-library` + id("com.github.johnrengelman.shadow") version "8.1.1" +} + +repositories { + maven { + url = uri("https://oss.sonatype.org/content/groups/public/") + } + + maven { + url = uri("https://repo.purpurmc.org/snapshots") + } + + maven { + url = uri("https://papermc.io/repo/repository/maven-public/") + } + + maven { + url = uri("https://libraries.minecraft.net") + } + + maven { + url = uri("https://jitpack.io") + } + + maven { + url = uri("https://repo.maven.apache.org/maven2/") + } +} + +dependencies { + api("com.github.YouHaveTrouble:Entiddy:v2.0.1") + api("org.reflections:reflections:0.10.2") + compileOnly("org.purpurmc.purpur:purpur-api:1.20-R0.1-SNAPSHOT") +} + +group = "org.purpurmc.purpurextras" +version = "1.27.0" +description = "\"This should be a plugin\" features from Purpur" +java.sourceCompatibility = JavaVersion.VERSION_17 +java.targetCompatibility = JavaVersion.VERSION_17 + +tasks { + + compileJava { + options.encoding = "UTF-8" + } + + javadoc { + options.encoding = "UTF-8" + } + + clean { + doLast { + serverDir.deleteRecursively() + } + } + + processResources { + filesMatching("plugin.yml") { + expand( + mapOf( + "name" to project.name, + "version" to project.version, + "description" to project.description!!.replace('"'.toString(), "\\\"") + ) + ) + } + } + + shadowJar { + relocate("org.reflections", "org.purpurmc.purpurextras.reflections") + relocate("me.youhavetrouble.entiddy", "org.purpurmc.purpurextras.entiddy") + } + + register("downloadServer") { + group = "purpur" + doFirst { + serverDir.mkdirs() + pluginDir.mkdirs() + URL("https://api.purpurmc.org/v2/purpur/1.20.1/latest/download").openStream().use { + Files.copy(it, serverDir.resolve("server.jar").toPath()) + } + } + } + + register("runServer", JavaExec::class) { + group = "purpur" + dependsOn("shadowJar") + if (!serverDir.resolve("server.jar").exists()) { + dependsOn("downloadServer") + } + doFirst { + pluginDir.resolve("PurpurExtras.jar").delete() + Files.copy( + buildDir.resolve("libs").resolve("PurpurExtras-${version}-all.jar").toPath(), + pluginDir.resolve("PurpurExtras.jar").toPath() + ) + } + classpath = files(serverDir.resolve("server.jar")) + workingDir = serverDir + jvmArgs = listOf("-Dcom.mojang.eula.agree=true") + args = listOf("--nogui") + standardInput = System.`in` + } + +} + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..bdc9a83 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +networkTimeout=10000 +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..79a61d4 --- /dev/null +++ b/gradlew @@ -0,0 +1,244 @@ +#!/bin/sh + +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# 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 +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 + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +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 ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +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 + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +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. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +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" || "$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 + 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 + # 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 +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. + +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 new file mode 100644 index 0000000..93e3f59 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@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. +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% 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/pom.xml b/pom.xml deleted file mode 100644 index 47db9d7..0000000 --- a/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - 4.0.0 - - org.purpurmc.purpurextras - PurpurExtras - 1.26.0 - jar - - PurpurExtras - - \"This should be a plugin\" features from Purpur - - 17 - UTF-8 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - ${java.version} - ${java.version} - - - - org.apache.maven.plugins - maven-shade-plugin - 3.3.0 - - - package - - shade - - - false - - - me.youhavetrouble.entiddy - org.purpurextras.entiddy - - - org.reflections - org.purpurextras.reflections - - - - - - - - - - src/main/resources - true - - - - - - - sonatype - https://oss.sonatype.org/content/groups/public/ - - - purpur - https://repo.purpurmc.org/snapshots - - - papermc - https://papermc.io/repo/repository/maven-public/ - - - minecraft-libraries - Minecraft Libraries - https://libraries.minecraft.net - - - jitpack.io - https://jitpack.io - - - - - - org.purpurmc.purpur - purpur-api - 1.20-R0.1-SNAPSHOT - provided - - - com.github.YouHaveTrouble - Entiddy - v2.0.1 - compile - - - org.reflections - reflections - 0.10.2 - compile - - - diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..de3fb8f --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "PurpurExtras" diff --git a/src/main/java/org/purpurmc/purpurextras/PurpurExtras.java b/src/main/java/org/purpurmc/purpurextras/PurpurExtras.java index c9aa43d..96f10a3 100644 --- a/src/main/java/org/purpurmc/purpurextras/PurpurExtras.java +++ b/src/main/java/org/purpurmc/purpurextras/PurpurExtras.java @@ -32,7 +32,9 @@ public void onEnable() { PluginCommand command = getCommand("purpurextras"); if (command != null) { - command.setExecutor(new PurpurExtrasCommand()); + PurpurExtrasCommand cmd = new PurpurExtrasCommand(); + command.setExecutor(cmd); + command.setTabCompleter(cmd); } PurpurExtrasModule.reloadModules(); diff --git a/src/main/java/org/purpurmc/purpurextras/PurpurExtrasCommand.java b/src/main/java/org/purpurmc/purpurextras/PurpurExtrasCommand.java index 202f0e4..64597cd 100644 --- a/src/main/java/org/purpurmc/purpurextras/PurpurExtrasCommand.java +++ b/src/main/java/org/purpurmc/purpurextras/PurpurExtrasCommand.java @@ -4,11 +4,15 @@ import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextDecoration; import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; +import org.bukkit.command.TabExecutor; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -public class PurpurExtrasCommand implements CommandExecutor { +import java.util.Collections; +import java.util.List; + +public class PurpurExtrasCommand implements TabExecutor { @Override public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) { @@ -35,4 +39,15 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command return true; } + + + @Override + public @Nullable List onTabComplete(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args) { + List cmds = List.of("reload", "version"); + if(args.length == 1) { + return cmds.stream().filter(s -> s.toLowerCase().startsWith(args[0])).toList(); + }else { + return Collections.emptyList(); + } + } } diff --git a/src/main/java/org/purpurmc/purpurextras/modules/AnvilChangesBlocksModule.java b/src/main/java/org/purpurmc/purpurextras/modules/AnvilChangesBlocksModule.java index effad00..bb4bc14 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/AnvilChangesBlocksModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/AnvilChangesBlocksModule.java @@ -17,6 +17,11 @@ import java.util.Map; import java.util.logging.Logger; +/** + * If enabled, block list will be used. Key is the block material that will be converted from and value + * is block material that will be converted to. In default config if anvil falls on a + * cobblestone block, that cobblestone will be converted to sand. + */ public class AnvilChangesBlocksModule implements PurpurExtrasModule, Listener { private final HashSet anvils = new HashSet<>(); diff --git a/src/main/java/org/purpurmc/purpurextras/modules/AnvilSplitsMinecartsAndBoatsModule.java b/src/main/java/org/purpurmc/purpurextras/modules/AnvilSplitsMinecartsAndBoatsModule.java index c63453d..20c2b88 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/AnvilSplitsMinecartsAndBoatsModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/AnvilSplitsMinecartsAndBoatsModule.java @@ -12,6 +12,11 @@ import org.bukkit.inventory.ItemStack; import org.purpurmc.purpurextras.PurpurExtras; +/** + * If enabled, dropping an anvil from significant height onto minecart with content + * (chest minecart, furnace minecart, etc.) in its item form, it will not destroy the item, + * but split the minecart and the content and drop them both. Does the same to chest boats + */ public class AnvilSplitsMinecartsAndBoatsModule implements PurpurExtrasModule, Listener { private final boolean splitBoats, splitMinecarts; diff --git a/src/main/java/org/purpurmc/purpurextras/modules/BeeHiveLoreModule.java b/src/main/java/org/purpurmc/purpurextras/modules/BeeHiveLoreModule.java index 2ff9471..a88551c 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/BeeHiveLoreModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/BeeHiveLoreModule.java @@ -17,6 +17,9 @@ import java.util.List; +/** + * If true, will add lore with amount of bees and honey to the picked up hives. + */ public class BeeHiveLoreModule implements PurpurExtrasModule, Listener { private final String beeHiveLoreBees, beeHiveLoreHoney; diff --git a/src/main/java/org/purpurmc/purpurextras/modules/ChorusFlowerAlwaysDropsModule.java b/src/main/java/org/purpurmc/purpurextras/modules/ChorusFlowerAlwaysDropsModule.java index 19fa82a..a14a845 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/ChorusFlowerAlwaysDropsModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/ChorusFlowerAlwaysDropsModule.java @@ -11,6 +11,9 @@ import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.inventory.ItemStack; +/** + * Makes it so chorus flowers always drop, no matter if they were destroyed directly or not. + */ public class ChorusFlowerAlwaysDropsModule implements PurpurExtrasModule, Listener { protected ChorusFlowerAlwaysDropsModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/ColoredBossBarsModule.java b/src/main/java/org/purpurmc/purpurextras/modules/ColoredBossBarsModule.java index b2913be..5ee8b29 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/ColoredBossBarsModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/ColoredBossBarsModule.java @@ -15,6 +15,9 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; +/** + * If enabled, allows players to dye boss health bars by right-clicking the boss with a dye item. + */ public class ColoredBossBarsModule implements PurpurExtrasModule, Listener { private final NamespacedKey dyeColor = PurpurExtras.key("dyedColor"); diff --git a/src/main/java/org/purpurmc/purpurextras/modules/DispenserBlocksModule.java b/src/main/java/org/purpurmc/purpurextras/modules/DispenserBlocksModule.java index 68bda19..cb0f6b1 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/DispenserBlocksModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/DispenserBlocksModule.java @@ -19,6 +19,23 @@ import java.util.Map; +/** + * Dispenser modifications + * + * **break-blocks** + * If a tool category is enabled, that tool dispensed from dispenser will destroy the block in front of it. + * It will only destroy blocks that tool can destroy and it will destroy them like that tool was used on it, + * so wooden pickaxe will destroy diamond ore, but will not drop any items. + * + * **shears-shear-pumpkin** + * If enabled, when shears are dispensed and there's a pumpkin in front of a dispenser, shears will be used, making carved pumpkin. + * + * **interact-with-cauldron** + * If enabled, will allow dispensers fill and empty cauldrons. + * + * **put-discs-in-jukebox** + * If enabled, dispensers will be able to insert into or swap music discs in jukeboxes. + */ public class DispenserBlocksModule implements PurpurExtrasModule, Listener { private static final MaterialSetTag CAULDRON_BUCKETS = new MaterialSetTag(new NamespacedKey(PurpurExtras.getInstance(), "cauldron_buckets")) diff --git a/src/main/java/org/purpurmc/purpurextras/modules/EscapeCommandSlashModule.java b/src/main/java/org/purpurmc/purpurextras/modules/EscapeCommandSlashModule.java index 726edc5..b50345d 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/EscapeCommandSlashModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/EscapeCommandSlashModule.java @@ -9,6 +9,10 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +/** + * Allows players to send a message with a slash at the start by escaping it with backslash + * (\/command that will appear as /command in chat). + */ public class EscapeCommandSlashModule implements PurpurExtrasModule, Listener { protected EscapeCommandSlashModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/ForceNametaggedForRidingModule.java b/src/main/java/org/purpurmc/purpurextras/modules/ForceNametaggedForRidingModule.java index 68288d6..f19164b 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/ForceNametaggedForRidingModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/ForceNametaggedForRidingModule.java @@ -8,6 +8,9 @@ import org.bukkit.event.Listener; import org.spigotmc.event.entity.EntityMountEvent; +/** + * If enabled, only nametagged mobs can be mounted/steered using purpur's rideable option. + */ public class ForceNametaggedForRidingModule implements PurpurExtrasModule, Listener { protected ForceNametaggedForRidingModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/FurnaceBurnTimeModule.java b/src/main/java/org/purpurmc/purpurextras/modules/FurnaceBurnTimeModule.java index 1269264..68cd7cb 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/FurnaceBurnTimeModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/FurnaceBurnTimeModule.java @@ -6,6 +6,9 @@ import org.bukkit.event.Listener; import org.bukkit.event.inventory.FurnaceBurnEvent; +/** + * If enabled, multiplier field will be used to modify fuel burn time in furnaces. + */ public class FurnaceBurnTimeModule implements PurpurExtrasModule, Listener { private final double furnaceBurnTimeMultiplier; diff --git a/src/main/java/org/purpurmc/purpurextras/modules/GrindstoneEnchantsBooksModule.java b/src/main/java/org/purpurmc/purpurextras/modules/GrindstoneEnchantsBooksModule.java index 8491082..9386c13 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/GrindstoneEnchantsBooksModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/GrindstoneEnchantsBooksModule.java @@ -18,7 +18,13 @@ import java.util.Map; -// Listeners yoinked from https://gist.github.com/BillyGalbreath/de0f899a27b39daad5f5bf7c00e11045 +/** + * If enabled and player has books in their inventory while disenchanting item in a grindstone, + * books will be consumed to return the enchantments removed from the item to the player. + * No exp will drop when doing this. + * + * Listeners yoinked from here} + */ public class GrindstoneEnchantsBooksModule implements PurpurExtrasModule, Listener { private final ItemStack BOOK = new ItemStack(Material.BOOK); diff --git a/src/main/java/org/purpurmc/purpurextras/modules/InvisibleItemFrameModule.java b/src/main/java/org/purpurmc/purpurextras/modules/InvisibleItemFrameModule.java index 5ca9e60..d22157c 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/InvisibleItemFrameModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/InvisibleItemFrameModule.java @@ -13,6 +13,10 @@ import org.bukkit.util.permissions.DefaultPermissions; import org.purpurmc.purpurextras.PurpurExtras; +/** + * Right click when sneaking on an item frame with item inside of it will make the item frame invisible. + * Requires purpurextras.invisibleframes permission. + */ public class InvisibleItemFrameModule implements PurpurExtrasModule, Listener { protected InvisibleItemFrameModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/LightningTransformsMobsModule.java b/src/main/java/org/purpurmc/purpurextras/modules/LightningTransformsMobsModule.java index 6f46082..ad28cac 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/LightningTransformsMobsModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/LightningTransformsMobsModule.java @@ -18,6 +18,16 @@ import java.util.Locale; import java.util.Map; +/** + * If enabled, entities with type on the left will be transformed into entity of type on the right. + * This overrides vanilla transformations. Vanilla mob ids are used to identify mobs. + * There are also special cases: + * + * `killer_bunny` - a killer bunny + * `jeb_sheep` - rainbow sheep + * `johhny` - vindicator aggressive to most mobs + * `toast` - special variant of rabbit + */ public class LightningTransformsMobsModule implements PurpurExtrasModule, Listener { private final HashMap entities = new HashMap<>(); diff --git a/src/main/java/org/purpurmc/purpurextras/modules/MobNoTargetModule.java b/src/main/java/org/purpurmc/purpurextras/modules/MobNoTargetModule.java index 1cb5cbd..4aae593 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/MobNoTargetModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/MobNoTargetModule.java @@ -7,6 +7,9 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityTargetEvent; +/** + * If enabled, players having target.bypass. permission won't be targetted by that type of mob. + */ public class MobNoTargetModule implements PurpurExtrasModule, Listener { protected MobNoTargetModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/NetherBuildHeightModule.java b/src/main/java/org/purpurmc/purpurextras/modules/NetherBuildHeightModule.java index 6ef5512..a349a28 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/NetherBuildHeightModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/NetherBuildHeightModule.java @@ -13,6 +13,19 @@ import org.purpurmc.purpurextras.PurpurConfig; import org.purpurmc.purpurextras.PurpurExtras; +/** + * Adds a build height limit to the nether + * Configuration: + * + * **enabled** + * Enables the feature. + * + * **height-limit** + * Maximum height players without purpurextras.netherbuildheightbypass permission can build in nether worlds. + * + * **no-permission-message** + * Message to display in action bar when trying to build above set limit in nether worlds. + */ public class NetherBuildHeightModule implements PurpurExtrasModule, Listener { private final int configBuildHeight; diff --git a/src/main/java/org/purpurmc/purpurextras/modules/NoFallDamageWhileHavingJumpBoostModule.java b/src/main/java/org/purpurmc/purpurextras/modules/NoFallDamageWhileHavingJumpBoostModule.java index 38ff053..345c425 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/NoFallDamageWhileHavingJumpBoostModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/NoFallDamageWhileHavingJumpBoostModule.java @@ -8,6 +8,9 @@ import org.bukkit.potion.PotionEffectType; import org.purpurmc.purpurextras.PurpurExtras; +/** + * Toggles if entities with jump boost effect will take fall damage + */ public class NoFallDamageWhileHavingJumpBoostModule implements PurpurExtrasModule, Listener { protected NoFallDamageWhileHavingJumpBoostModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/OpenIronDoorsWithHandModule.java b/src/main/java/org/purpurmc/purpurextras/modules/OpenIronDoorsWithHandModule.java index bc61a6f..9e9acac 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/OpenIronDoorsWithHandModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/OpenIronDoorsWithHandModule.java @@ -14,6 +14,9 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.EquipmentSlot; +/** + * Allows opening iron doors and trapdoors with a hand, just like wooden doors. + */ public class OpenIronDoorsWithHandModule implements PurpurExtrasModule, Listener { private final boolean doors, trapdoors; diff --git a/src/main/java/org/purpurmc/purpurextras/modules/RespawnAnchorNeedsChargeModule.java b/src/main/java/org/purpurmc/purpurextras/modules/RespawnAnchorNeedsChargeModule.java index 169ac75..34302b2 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/RespawnAnchorNeedsChargeModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/RespawnAnchorNeedsChargeModule.java @@ -13,6 +13,9 @@ import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.util.BoundingBox; +/** + * If false, will make it so respawn anchors will never run out of charges. + */ public class RespawnAnchorNeedsChargeModule implements PurpurExtrasModule, Listener { protected RespawnAnchorNeedsChargeModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/RunFasterOnPathsModule.java b/src/main/java/org/purpurmc/purpurextras/modules/RunFasterOnPathsModule.java index 4905c30..6ef8fa0 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/RunFasterOnPathsModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/RunFasterOnPathsModule.java @@ -18,6 +18,10 @@ import java.util.Locale; import java.util.logging.Logger; +/** + * If speed-multiplier value is higher than 0, player will gain speed potion effect of the level of that value. + * This only accepts integer values. Which blocks count as paths can be configured by listing them in path-blocks list. + */ public class RunFasterOnPathsModule implements PurpurExtrasModule, Listener { private final HashSet pathBlocks = new HashSet<>(); diff --git a/src/main/java/org/purpurmc/purpurextras/modules/ShieldSettingsModule.java b/src/main/java/org/purpurmc/purpurextras/modules/ShieldSettingsModule.java index 0d56708..a96f97c 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/ShieldSettingsModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/ShieldSettingsModule.java @@ -5,6 +5,14 @@ import org.purpurmc.purpurextras.modules.listeners.ShieldCooldownListener; import org.purpurmc.purpurextras.modules.listeners.ShieldDamageReductionListener; +/** + * Shield configurations + * {@link ShieldCooldownListener} - Amount of ticks (1/20th of a second) of cooldown for a shield after + * hitting it with an axe crit. By default this is 100 ticks (5 seconds). + * + * {@link ShieldDamageReductionListener} - Value between 0 and 1. This is the percentage of damage reduction + * that defending with a shield will provide. By default shield reduces 100% of the damage (1.0). + */ public class ShieldSettingsModule implements PurpurExtrasModule, Listener { private static final double DEFAULT_SHIELD_DAMAGE_REDUCTION = 1.0; diff --git a/src/main/java/org/purpurmc/purpurextras/modules/SpawnerPlacementPermissionsModule.java b/src/main/java/org/purpurmc/purpurextras/modules/SpawnerPlacementPermissionsModule.java index 922c92c..b81e8b5 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/SpawnerPlacementPermissionsModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/SpawnerPlacementPermissionsModule.java @@ -18,6 +18,9 @@ import static org.bukkit.util.permissions.DefaultPermissions.registerPermission; +/** + * Players will need purpurextras.spawnerplace. permission to place spawners of that mob. + */ public class SpawnerPlacementPermissionsModule implements PurpurExtrasModule, Listener { protected SpawnerPlacementPermissionsModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/UnlockAllRecipesModule.java b/src/main/java/org/purpurmc/purpurextras/modules/UnlockAllRecipesModule.java index 209ef9c..44e32db 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/UnlockAllRecipesModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/UnlockAllRecipesModule.java @@ -14,6 +14,10 @@ import java.util.Iterator; +/** + * Unlocks all available recipes on join. + * Players can be exempt from this by denying them purpurextras.unlockallrecipesonjoin permission. + */ public class UnlockAllRecipesModule implements PurpurExtrasModule, Listener { private final String permission = "purpurextras.unlockallrecipesonjoin"; diff --git a/src/main/java/org/purpurmc/purpurextras/modules/UpgradeIronToDiamondsToolsModule.java b/src/main/java/org/purpurmc/purpurextras/modules/UpgradeIronToDiamondsToolsModule.java index cf32f08..d76deb2 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/UpgradeIronToDiamondsToolsModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/UpgradeIronToDiamondsToolsModule.java @@ -7,6 +7,9 @@ import org.bukkit.inventory.RecipeChoice; import org.bukkit.inventory.SmithingRecipe; +/** + * Allows upgrading tools from iron to diamond in the smithing table + */ public class UpgradeIronToDiamondsToolsModule implements PurpurExtrasModule { protected UpgradeIronToDiamondsToolsModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/UpgradeStoneToIronToolsModule.java b/src/main/java/org/purpurmc/purpurextras/modules/UpgradeStoneToIronToolsModule.java index 8f1dcd9..f0f96d7 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/UpgradeStoneToIronToolsModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/UpgradeStoneToIronToolsModule.java @@ -7,6 +7,9 @@ import org.bukkit.inventory.RecipeChoice; import org.bukkit.inventory.SmithingRecipe; +/** + * Allows upgrading tools from stone to iron in the smithing table + */ public class UpgradeStoneToIronToolsModule implements PurpurExtrasModule { protected UpgradeStoneToIronToolsModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/UpgradeWoodToStoneToolsModule.java b/src/main/java/org/purpurmc/purpurextras/modules/UpgradeWoodToStoneToolsModule.java index 04c116c..fbbf9d7 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/UpgradeWoodToStoneToolsModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/UpgradeWoodToStoneToolsModule.java @@ -7,6 +7,9 @@ import org.bukkit.inventory.RecipeChoice; import org.bukkit.inventory.SmithingRecipe; +/** + * Allows upgrading tools from wood to stone in the smithing table + */ public class UpgradeWoodToStoneToolsModule implements PurpurExtrasModule { protected UpgradeWoodToStoneToolsModule() {} diff --git a/src/main/java/org/purpurmc/purpurextras/modules/VoidTotemModule.java b/src/main/java/org/purpurmc/purpurextras/modules/VoidTotemModule.java index 3985dea..7fee189 100644 --- a/src/main/java/org/purpurmc/purpurextras/modules/VoidTotemModule.java +++ b/src/main/java/org/purpurmc/purpurextras/modules/VoidTotemModule.java @@ -20,6 +20,11 @@ import java.util.HashMap; import java.util.UUID; +/** + * If enabled, totem of undying will save players from death in the void and will + * teleport them to the last place their feet touched the ground. + * If for any reason that position is not found, they will be teleported to world spawn. + */ public class VoidTotemModule implements PurpurExtrasModule, Listener { private final Collection totemEffects = new ArrayList<>(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8fb1deb..843e042 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,9 +1,9 @@ -name: "${project.name}" -version: "${project.version}" -main: "${project.groupId}.${project.artifactId}" -api-version: 1.19 +name: "${name}" +version: ${version} +main: "org.purpurmc.purpurextras.PurpurExtras" +api-version: '1.20' authors: [ YouHaveTrouble ] -description: "${project.description}" +description: "${description}" commands: purpurextras: description: Command controlling PurpurExtras