Update gradle to 8.14.2, add auto formatting

This commit is contained in:
NotAlexNoyle committed 2025-06-24 23:03:54 -04:00
1 parent 9c6008219b
commit 5e17a5c0c5
14 files changed
+161 -94

No files matched your search

+21 -14
View File
@@ -1,6 +1,8 @@
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.
}
@@ -10,20 +12,17 @@ java {
}
group = "net.trueog.celeste-og" // Declare bundle identifier.
version = "1.0" // 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("/")
}
@@ -32,9 +31,7 @@ tasks.named<ProcessResources>("processResources") {
repositories {
mavenCentral()
gradlePluginPortal()
maven {
url = uri("https://repo.purpurmc.org/snapshots")
}
maven { url = uri("https://repo.purpurmc.org/snapshots") }
}
dependencies {
@@ -54,12 +51,11 @@ tasks.shadowJar {
}
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")
@@ -74,3 +70,14 @@ java {
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
+6 -4
View File
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -84,7 +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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || 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
@@ -112,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.
@@ -203,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.
@@ -211,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
+4 -2
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -68,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
@@ -2,12 +2,10 @@ package net.trueog.celeste;
import java.util.List;
import java.util.Random;
import net.trueog.celeste.config.CelesteConfig;
import org.bukkit.World;
import org.bukkit.scheduler.BukkitRunnable;
import net.trueog.celeste.config.CelesteConfig;
public class Astronomer extends BukkitRunnable {
private final Celeste celeste;
@@ -49,12 +47,16 @@ public class Astronomer extends BukkitRunnable {
}
if (config.shootingStarsEnabled && new Random().nextDouble() <= shootingStarChance) {
CelestialSphere.createShootingStar(celeste,
world.getPlayers().get(new Random().nextInt(world.getPlayers().size())));
CelestialSphere.createShootingStar(
celeste,
world.getPlayers()
.get(new Random().nextInt(world.getPlayers().size())));
}
if (config.fallingStarsEnabled && new Random().nextDouble() <= fallingStarChance) {
CelestialSphere.createFallingStar(celeste,
world.getPlayers().get(new Random().nextInt(world.getPlayers().size())));
CelestialSphere.createFallingStar(
celeste,
world.getPlayers()
.get(new Random().nextInt(world.getPlayers().size())));
}
}
}
@@ -1,13 +1,12 @@
package net.trueog.celeste;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import net.trueog.celeste.commands.CommandCeleste;
import net.trueog.celeste.commands.CommandFallingStar;
import net.trueog.celeste.commands.CommandShootingStar;
import net.trueog.celeste.config.CelesteConfigManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
public class Celeste extends JavaPlugin {
@@ -24,7 +23,6 @@ public class Celeste extends JavaPlugin {
BukkitRunnable stargazingTask = new Astronomer(this);
stargazingTask.runTaskTimer(this, 0, 10);
}
public void reload() {
@@ -35,7 +33,5 @@ public class Celeste extends JavaPlugin {
public static void getLogger(String message) {
Bukkit.getLogger().info("[Celeste-OG]" + message);
}
}
@@ -3,15 +3,13 @@ package net.trueog.celeste;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Random;
import net.trueog.celeste.config.CelesteConfig;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import net.trueog.celeste.config.CelesteConfig;
public class CelestialSphere {
public static void createShootingStar(Celeste celeste, Player player) {
@@ -28,7 +26,8 @@ public class CelestialSphere {
public static void createShootingStar(Celeste celeste, Location location, boolean approximate) {
Location starLocation;
CelesteConfig config = celeste.configManager.getConfigForWorld(location.getWorld().getName());
CelesteConfig config =
celeste.configManager.getConfigForWorld(location.getWorld().getName());
double w = 100 * Math.sqrt(new Random().nextDouble());
double t = 2d * Math.PI * new Random().nextDouble();
double x = w * Math.cos(t);
@@ -40,17 +39,40 @@ public class CelestialSphere {
} else {
starLocation = new Location(location.getWorld(), location.getX(), y, location.getZ());
}
Vector direction = new Vector(new Random().nextDouble() * 2 - 1, new Random().nextDouble() * -0.75d, new Random().nextDouble() * 2 - 1);
Vector direction = new Vector(
new Random().nextDouble() * 2 - 1,
new Random().nextDouble() * -0.75d,
new Random().nextDouble() * 2 - 1);
direction.normalize();
double speed = new Random().nextDouble() * 2 + 0.75;
location.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, starLocation, 0, direction.getX(),
direction.getY(), direction.getZ(), speed, null, true);
location.getWorld()
.spawnParticle(
Particle.FIREWORKS_SPARK,
starLocation,
0,
direction.getX(),
direction.getY(),
direction.getZ(),
speed,
null,
true);
if (new Random().nextDouble() >= 0.5) {
location.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, starLocation, 0, direction.getX(),
direction.getY(), direction.getZ(), speed, null, true);
location.getWorld()
.spawnParticle(
Particle.EXPLOSION_NORMAL,
starLocation,
0,
direction.getX(),
direction.getY(),
direction.getZ(),
speed,
null,
true);
}
if (celeste.getConfig().getBoolean("debug")) {
celeste.getLogger().info("Shooting star at " + stringifyLocation(starLocation) + " in world " + starLocation.getWorld().getName());
celeste.getLogger()
.info("Shooting star at " + stringifyLocation(starLocation) + " in world "
+ starLocation.getWorld().getName());
}
}
@@ -68,7 +90,8 @@ public class CelestialSphere {
public static void createFallingStar(Celeste celeste, final Location location, boolean approximate) {
Location target = location;
CelesteConfig config = celeste.configManager.getConfigForWorld(location.getWorld().getName());
CelesteConfig config =
celeste.configManager.getConfigForWorld(location.getWorld().getName());
if (approximate) {
double fallingStarRadius = config.fallingStarsRadius;
double w = fallingStarRadius * Math.sqrt(new Random().nextDouble());
@@ -80,13 +103,16 @@ public class CelestialSphere {
BukkitRunnable fallingStarTask = new FallingStar(celeste, target);
fallingStarTask.runTaskTimer(celeste, 0, 1);
if (celeste.getConfig().getBoolean("debug")) {
celeste.getLogger().info("Falling star at " + stringifyLocation(target) + " in world " + target.getWorld().getName());
celeste.getLogger()
.info("Falling star at " + stringifyLocation(target) + " in world "
+ target.getWorld().getName());
}
}
private static String stringifyLocation(Location location) {
DecimalFormat format = new DecimalFormat("##.00");
format.setRoundingMode(RoundingMode.HALF_UP);
return "x: " + format.format(location.getX()) + " y: " + format.format(location.getY()) + " z: " + format.format(location.getZ());
return "x: " + format.format(location.getX()) + " y: " + format.format(location.getY()) + " z: "
+ format.format(location.getZ());
}
}
@@ -1,7 +1,7 @@
package net.trueog.celeste;
import java.util.Random;
import net.trueog.celeste.config.CelesteConfig;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
@@ -12,8 +12,6 @@ import org.bukkit.entity.ExperienceOrb;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import net.trueog.celeste.config.CelesteConfig;
public class FallingStar extends BukkitRunnable {
private final Celeste celeste;
@@ -30,25 +28,55 @@ public class FallingStar extends BukkitRunnable {
this.location = location;
config = celeste.configManager.getConfigForWorld(location.getWorld().getName());
sparkTimer = config.fallingStarsSparkTime;
dropLoc = new Location(location.getWorld(), location.getX(),
location.getWorld().getHighestBlockAt(location).getY() + 1, location.getZ());
dropLoc = new Location(
location.getWorld(),
location.getX(),
location.getWorld().getHighestBlockAt(location).getY() + 1,
location.getZ());
}
public void run() {
double step = 1;
location.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, location.getX(), y, location.getZ(),
0, 0, new Random().nextDouble(), 0,
0.2, null, true);
location.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, location.getX(),
location.getWorld()
.spawnParticle(
Particle.FIREWORKS_SPARK,
location.getX(),
y,
location.getZ(),
0,
0,
new Random().nextDouble(),
0,
0.2,
null,
true);
location.getWorld()
.spawnParticle(
Particle.FIREWORKS_SPARK,
location.getX(),
y + new Random().nextDouble() * step,
location.getZ(),
0, 0, -1, 0,
1, null, true);
0,
0,
-1,
0,
1,
null,
true);
if (y % (step * 2) == 0) {
location.getWorld().spawnParticle(Particle.LAVA, location.getX(), y + new Random().nextDouble(),
location.getWorld()
.spawnParticle(
Particle.LAVA,
location.getX(),
y + new Random().nextDouble(),
location.getZ(),
0, 0, new Random().nextDouble(), 0,
0.2, null, true);
0,
0,
new Random().nextDouble(),
0,
0.2,
null,
true);
}
if (config.fallingStarsSoundEnabled && !soundPlayed && y <= dropLoc.getY() + 75) {
location.getWorld().playSound(dropLoc, Sound.BLOCK_BELL_RESONATE, (float) config.fallingStarsVolume, 0.5f);
@@ -67,7 +95,8 @@ public class FallingStar extends BukkitRunnable {
if (config.fallingStarLootTable != null) {
// Armor stands are used as markers are not compatible with 1.14
Entity marker = dropLoc.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
String command = String.format("execute at %s run loot spawn %s %s %s loot %s",
String command = String.format(
"execute at %s run loot spawn %s %s %s loot %s",
marker.getUniqueId(),
dropLoc.getX(),
dropLoc.getY(),
@@ -76,22 +105,25 @@ public class FallingStar extends BukkitRunnable {
celeste.getServer().dispatchCommand(celeste.getServer().getConsoleSender(), command);
marker.remove();
if (celeste.getConfig().getBoolean("debug")) {
celeste.getLogger().info("Spawned falling star loot from loot table '" + config.fallingStarLootTable + "'");
celeste.getLogger()
.info("Spawned falling star loot from loot table '" + config.fallingStarLootTable
+ "'");
}
}
if (config.fallingStarsExperience > 0) {
ExperienceOrb orb = (ExperienceOrb) dropLoc.getWorld().spawnEntity(dropLoc, EntityType.EXPERIENCE_ORB);
ExperienceOrb orb =
(ExperienceOrb) dropLoc.getWorld().spawnEntity(dropLoc, EntityType.EXPERIENCE_ORB);
orb.setExperience(config.fallingStarsExperience);
if (celeste.getConfig().getBoolean("debug")) {
celeste.getLogger().info("Dropping experience orbs with value " + config.fallingStarsExperience);
celeste.getLogger()
.info("Dropping experience orbs with value " + config.fallingStarsExperience);
}
}
lootDropped = true;
}
if (y % (step * 5) == 0) {
location.getWorld().spawnParticle(Particle.LAVA, dropLoc,
0, 0, new Random().nextDouble(), 0,
1, null, true);
location.getWorld()
.spawnParticle(Particle.LAVA, dropLoc, 0, 0, new Random().nextDouble(), 0, 1, null, true);
}
sparkTimer--;
if (sparkTimer <= 0) {
@@ -100,5 +132,4 @@ public class FallingStar extends BukkitRunnable {
}
y -= step;
}
}
@@ -1,11 +1,10 @@
package net.trueog.celeste.commands;
import net.trueog.celeste.Celeste;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import net.trueog.celeste.Celeste;
public class CommandCeleste implements CommandExecutor {
Celeste celeste;
@@ -27,9 +26,12 @@ public class CommandCeleste implements CommandExecutor {
String version = "1.0";
if (sender.hasPermission("celeste.info")) {
sender.sendMessage("Celeste-OG" + version);
sender.sendMessage("Shooting stars: " + (celeste.getConfig().getBoolean("shooting-stars-enabled") ? "Enabled" : "Disabled"));
sender.sendMessage("Falling stars: " + (celeste.getConfig().getBoolean("falling-stars-enabled") ? "Enabled" : "Disabled"));
sender.sendMessage("Meteor showers: " + (celeste.getConfig().getBoolean("new-moon-meteor-shower") ? "Enabled" : "Disabled"));
sender.sendMessage("Shooting stars: "
+ (celeste.getConfig().getBoolean("shooting-stars-enabled") ? "Enabled" : "Disabled"));
sender.sendMessage("Falling stars: "
+ (celeste.getConfig().getBoolean("falling-stars-enabled") ? "Enabled" : "Disabled"));
sender.sendMessage("Meteor showers: "
+ (celeste.getConfig().getBoolean("new-moon-meteor-shower") ? "Enabled" : "Disabled"));
} else {
sender.sendMessage("You do not have permission to use this command");
}
@@ -37,5 +39,4 @@ public class CommandCeleste implements CommandExecutor {
}
return false;
}
}
@@ -1,14 +1,13 @@
package net.trueog.celeste.commands;
import net.trueog.celeste.Celeste;
import net.trueog.celeste.CelestialSphere;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.trueog.celeste.Celeste;
import net.trueog.celeste.CelestialSphere;
public class CommandFallingStar implements CommandExecutor {
Celeste celeste;
@@ -38,5 +37,4 @@ public class CommandFallingStar implements CommandExecutor {
}
return true;
}
}
@@ -1,14 +1,13 @@
package net.trueog.celeste.commands;
import net.trueog.celeste.Celeste;
import net.trueog.celeste.CelestialSphere;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.trueog.celeste.Celeste;
import net.trueog.celeste.CelestialSphere;
public class CommandShootingStar implements CommandExecutor {
Celeste celeste;
@@ -38,5 +37,4 @@ public class CommandShootingStar implements CommandExecutor {
}
return true;
}
}
@@ -1,10 +1,9 @@
package net.trueog.celeste.config;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import net.trueog.celeste.Celeste;
import net.trueog.celeste.utilities.WeightedRandomBag;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
public class CelesteConfig {
public boolean newMoonMeteorShower;
@@ -71,15 +70,18 @@ public class CelesteConfig {
shootingStarsEnabled = section.getBoolean("shooting-stars-enabled", globalConfig.shootingStarsEnabled);
shootingStarsPerMinute = section.getDouble("shooting-stars-per-minute", globalConfig.shootingStarsPerMinute);
shootingStarsPerMinuteMeteorShower = section.getDouble("shooting-stars-per-minute-during-meteor-showers", globalConfig.shootingStarsPerMinuteMeteorShower);
shootingStarsPerMinuteMeteorShower = section.getDouble(
"shooting-stars-per-minute-during-meteor-showers", globalConfig.shootingStarsPerMinuteMeteorShower);
shootingStarsMinHeight = section.getInt("shooting-stars-min-height", globalConfig.shootingStarsMinHeight);
shootingStarsMaxHeight = section.getInt("shooting-stars-max-height", globalConfig.shootingStarsMaxHeight);
fallingStarsEnabled = section.getBoolean("falling-stars-enabled", globalConfig.fallingStarsEnabled);
fallingStarsPerMinute = section.getDouble("falling-stars-per-minute", globalConfig.fallingStarsPerMinute);
fallingStarsPerMinuteMeteorShower = section.getDouble("falling-stars-per-minute-during-meteor-showers", globalConfig.fallingStarsPerMinuteMeteorShower);
fallingStarsPerMinuteMeteorShower = section.getDouble(
"falling-stars-per-minute-during-meteor-showers", globalConfig.fallingStarsPerMinuteMeteorShower);
fallingStarsRadius = section.getInt("falling-stars-radius", globalConfig.fallingStarsRadius);
fallingStarsSoundEnabled = section.getBoolean("falling-stars-sound-enabled", globalConfig.fallingStarsSoundEnabled);
fallingStarsSoundEnabled =
section.getBoolean("falling-stars-sound-enabled", globalConfig.fallingStarsSoundEnabled);
fallingStarsVolume = section.getDouble("falling-stars-volume", globalConfig.fallingStarsVolume);
fallingStarsSparkTime = section.getInt("falling-stars-spark-time", globalConfig.fallingStarsSparkTime);
fallingStarsExperience = section.getInt("falling-stars-experience", globalConfig.fallingStarsExperience);
@@ -2,12 +2,10 @@ package net.trueog.celeste.config;
import java.util.HashMap;
import java.util.Map;
import net.trueog.celeste.Celeste;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import net.trueog.celeste.Celeste;
public class CelesteConfigManager {
private final Celeste celeste;
@@ -27,7 +25,11 @@ public class CelesteConfigManager {
for (String world : worlds.getKeys(false)) {
ConfigurationSection worldSettings = worlds.getConfigurationSection(world);
if (worldSettings == null) {
this.celeste.getLogger().severe("Your world override config for world '" + world + "' is malformed, please review example configs at https://github.com/IdreesInc/Celeste");
this.celeste
.getLogger()
.severe(
"Your world override config for world '" + world
+ "' is malformed, please review example configs at https://github.com/IdreesInc/Celeste");
continue;
}
CelesteConfig worldConfig = new CelesteConfig(worldSettings, globalConfig);