Update gradle to 8.14.2, add formatting, update dependencies

This commit is contained in:
NotAlexNoyle committed 2025-06-20 18:00:32 -04:00
1 parent eb0ebc6227
commit d900fca913
10 files changed
+80 -83

No files matched your search

+25 -21
View File
@@ -1,8 +1,9 @@
plugins {
id("java") // Tell gradle this is a java project.
id("java-library") // Import helper for source-based libraries.
id("com.diffplug.spotless") version "7.0.4" // Import auto-formatter.
id("com.gradleup.shadow") version "8.3.6" // Import shadow API.
java // Tell gradle this is a java project.
eclipse // Import eclipse plugin for IDE integration.
kotlin("jvm") version "2.1.21" // Import kotlin jvm plugin for kotlin/java integration.
}
java {
@@ -11,20 +12,17 @@ java {
}
group = "net.trueog.duelenhancer-og" // Declare bundle identifier.
version = "1.1" // Declare plugin version (will be in .jar).
val apiVersion = "1.19" // Declare minecraft server target version.
tasks.named<ProcessResources>("processResources") {
val props = mapOf(
"version" to version,
"apiVersion" to apiVersion
)
val props = mapOf("version" to version, "apiVersion" to apiVersion)
inputs.properties(props) // Indicates to rerun if version changes.
filesMatching("plugin.yml") {
expand(props)
}
filesMatching("plugin.yml") { expand(props) }
from("LICENSE") { // Bundle license into .jars.
into("/")
}
@@ -37,7 +35,7 @@ repositories {
url = uri("https://repo.purpurmc.org/snapshots") // Import the PurpurMC Maven Repository.
}
maven {
url = uri("https://jitpack.io") // Import Jitpack repository for Duels API.
url = uri("https://jitpack.io") // Import Jitpack repository for Duels API.
}
}
@@ -45,9 +43,9 @@ dependencies {
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Declare purpur API version to be packaged.
compileOnly("io.github.miniplaceholders:miniplaceholders-api:2.2.3") // Import MiniPlaceholders API.
compileOnly("com.github.Realizedd.Duels:duels-api:3.5.1") // Build the Duels API.
compileOnly(project(":libs:Utilities-OG"))
compileOnly(project(":libs:GxUI-OG"))
compileOnlyApi(project(":libs:Utilities-OG"))
compileOnlyApi(project(":libs:GxUI-OG"))
}
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
@@ -56,18 +54,17 @@ tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .ja
}
tasks.shadowJar {
archiveClassifier.set("") // Use empty string instead of null.
exclude("io.github.miniplaceholders.*") // Exclude the MiniPlaceholders package from being shadowed.
archiveClassifier.set("") // Use empty string instead of null.
minimize()
}
tasks.build {
dependsOn(tasks.spotlessApply)
dependsOn(tasks.shadowJar)
}
tasks.jar {
archiveClassifier.set("part")
}
tasks.jar { archiveClassifier.set("part") }
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-parameters")
@@ -76,13 +73,20 @@ tasks.withType<JavaCompile>().configureEach {
options.isFork = true
}
kotlin {
jvmToolchain(17)
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.GRAAL_VM
}
}
spotless {
java {
removeUnusedImports()
palantirJavaFormat()
}
kotlinGradle {
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) }
target("build.gradle.kts", "settings.gradle.kts")
}
}
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+4 -5
View File
@@ -86,8 +86,7 @@ done
# 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 -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -115,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -206,7 +205,7 @@ fi
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,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
@@ -214,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+2 -2
View File
@@ -70,11 +70,11 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
+3 -3
View File
@@ -1,14 +1,14 @@
rootProject.name = "DuelEnhancer-OG"
// Run the bootstrap at configuration time.
val process = ProcessBuilder("sh", "bootstrap.sh")
.directory(rootDir)
.start()
val process = ProcessBuilder("sh", "bootstrap.sh").directory(rootDir).start()
val exitValue = process.waitFor()
if (exitValue != 0) {
throw GradleException("bootstrap.sh failed with exit code $exitValue")
}
include("libs:Utilities-OG")
include("libs:GxUI-OG")
+14 -16
View File
@@ -3,24 +3,22 @@ package plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
// Extending this class is standard bukkit boilerplate for any plugin, or else the server software won't load the classes.
// Extending this class is standard bukkit boilerplate for any plugin, or else the server software won't load the
// classes.
public class DuelEnhancerOG extends JavaPlugin {
// What to do when the plugin is run by the server.
@Override
public void onEnable() {
// What to do when the plugin is run by the server.
@Override
public void onEnable() {
// Register the Event Listener class.
this.getServer().getPluginManager().registerEvents(new Listeners(), this);
// Register the Event Listener class.
this.getServer().getPluginManager().registerEvents(new Listeners(), this);
}
}
// Runs plugin asynchronously so multiple players can use it at once efficiently.
public BukkitTask runTaskAsynchronously(final Runnable run) {
// Runs plugin asynchronously so multiple players can use it at once efficiently.
public BukkitTask runTaskAsynchronously(final Runnable run) {
// Schedule Processes.
return this.getServer().getScheduler().runTaskAsynchronously(this, run);
}
}
// Schedule Processes.
return this.getServer().getScheduler().runTaskAsynchronously(this, run);
}
}
+29 -33
View File
@@ -3,6 +3,8 @@
package plugin;
import me.realized.duels.api.Duels;
import net.trueog.utilitiesog.UtilitiesOG;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
@@ -10,47 +12,41 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import me.realized.duels.api.Duels;
import net.trueog.utilitiesog.UtilitiesOG;
public class Listeners implements Listener {
// Declare instance of class as static so multiple players can use it.
private static Listeners instance;
// Declare instance of class as static so multiple players can use it.
private static Listeners instance;
// Initialize Duels API.
private static Duels api = (Duels) Bukkit.getServer().getPluginManager().getPlugin("Duels");
// Initialize Duels API.
private static Duels api = (Duels) Bukkit.getServer().getPluginManager().getPlugin("Duels");
// Return instance of class as static so multiple players can use it.
public static Listeners getInstance() {
// Return instance of class as static so multiple players can use it.
public static Listeners getInstance() {
return instance;
return instance;
}
}
// Listen for a player's game mode changing.
@EventHandler
public void onSurvivalMode(PlayerGameModeChangeEvent event) {
// Listen for a player's game mode changing.
@EventHandler
public void onSurvivalMode(PlayerGameModeChangeEvent event) {
// Store player as object for multiple references.
Player player = event.getPlayer();
// Store player as object for multiple references.
Player player = event.getPlayer();
// Use Duels API to tell if the player whose game mode has changed is spectating a duel.
if (api.getSpectateManager().isSpectating(player)) {
// Use Duels API to tell if the player whose game mode has changed is spectating a duel.
if(api.getSpectateManager().isSpectating(player)) {
// If the player was put in survival (presumably by WorldGuard), do this...
if (player.getGameMode() == GameMode.SURVIVAL) {
// If the player was put in survival (presumably by WorldGuard), do this...
if(player.getGameMode() == GameMode.SURVIVAL) {
// Inform the player that they will stop spectating the match.
UtilitiesOG.trueogMessage(
player,
"<gray>[<dark_green>True<red>OG<gray>] <gold>Out of bounds! Your Duel spectating session has ended.");
// Inform the player that they will stop spectating the match.
UtilitiesOG.trueogMessage(player, "<gray>[<dark_green>True<red>OG<gray>] <gold>Out of bounds! Your Duel spectating session has ended.");
// Stop the player from spectating the match.
api.getSpectateManager().stopSpectating(player);
}
}
}
}
// Stop the player from spectating the match.
api.getSpectateManager().stopSpectating(player);
}
}
}
}