Update gradle to 8.14.2, add formatting
This commit is contained in:
1 parent
e440982eaf
commit
0f145cac81
10 files changed
+59
-84
No files matched your search
+22
-21
@@ -1,8 +1,8 @@
|
||||
plugins {
|
||||
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.
|
||||
id("com.diffplug.spotless") version "7.0.4" // Import auto-formatter.
|
||||
id("com.gradleup.shadow") version "8.3.6" // Import shadow API.
|
||||
eclipse // Import eclipse plugin for IDE integration.
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -11,20 +11,17 @@ java {
|
||||
}
|
||||
|
||||
group = "net.trueog.buffrates-og" // Declare bundle identifier.
|
||||
|
||||
version = "2.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("/")
|
||||
}
|
||||
@@ -33,15 +30,14 @@ tasks.named<ProcessResources>("processResources") {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
url = uri("https://repo.purpurmc.org/snapshots")
|
||||
}
|
||||
maven { url = uri("https://repo.purpurmc.org/snapshots") }
|
||||
}
|
||||
|
||||
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.
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
|
||||
compileOnly(project(":libs:Utilities-OG"))
|
||||
}
|
||||
|
||||
@@ -51,18 +47,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")
|
||||
@@ -71,9 +66,7 @@ tasks.withType<JavaCompile>().configureEach {
|
||||
options.isFork = true
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
kotlin { jvmToolchain(17) }
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
@@ -81,3 +74,11 @@ java {
|
||||
vendor = JvmVendorSpec.GRAAL_VM
|
||||
}
|
||||
}
|
||||
|
||||
spotless {
|
||||
kotlin { ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } }
|
||||
kotlinGradle {
|
||||
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) }
|
||||
target("build.gradle.kts", "settings.gradle.kts")
|
||||
}
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -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
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
+1
-1
Submodule libs/Utilities-OG updated: 6151b2de7f...e68d3fec7a.
+2
-4
@@ -1,14 +1,12 @@
|
||||
rootProject.name = "BuffRates-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")
|
||||
|
||||
@@ -1,32 +1,19 @@
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// Author: Sekalol15
|
||||
package plugin
|
||||
import org.bukkit.configuration.file.FileConfiguration
|
||||
import org.bukkit.configuration.file.YamlConfiguration
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin
|
||||
import java.io.File
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.attribute.Attribute
|
||||
|
||||
|
||||
// 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.
|
||||
class BuffRatesOG : JavaPlugin() {
|
||||
companion object {
|
||||
lateinit var plugin: JavaPlugin
|
||||
}
|
||||
|
||||
|
||||
override fun onEnable() {
|
||||
plugin = this
|
||||
server.pluginManager.registerEvents(Listeners(), this)
|
||||
Config.load()
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -2,9 +2,10 @@
|
||||
// Author: Sekalol15
|
||||
package plugin
|
||||
|
||||
import java.io.File
|
||||
import org.bukkit.configuration.file.FileConfiguration
|
||||
import org.bukkit.configuration.file.YamlConfiguration
|
||||
import java.io.File
|
||||
|
||||
object Config {
|
||||
private lateinit var config: FileConfiguration
|
||||
private lateinit var file: File
|
||||
@@ -24,15 +25,15 @@ object Config {
|
||||
config.save(file)
|
||||
}
|
||||
|
||||
|
||||
fun getSlimeChanceEnabled() : Boolean {
|
||||
fun getSlimeChanceEnabled(): Boolean {
|
||||
return config.get("slimeChanceEnabled") as Boolean
|
||||
}
|
||||
|
||||
fun getSlimeChance(): Double {
|
||||
return config.get("slimeChance") as Double
|
||||
}
|
||||
|
||||
fun getRaiderQuantity() : Int {
|
||||
fun getRaiderQuantity(): Int {
|
||||
return config.get("raiderQuantity") as Int
|
||||
}
|
||||
|
||||
@@ -44,9 +45,10 @@ object Config {
|
||||
return config.get("zombieIron") as Double
|
||||
}
|
||||
|
||||
fun getWardenChanceEnabled() : Boolean {
|
||||
fun getWardenChanceEnabled(): Boolean {
|
||||
return config.get("wardenChanceEnabled") as Boolean
|
||||
}
|
||||
|
||||
fun getWardenChance(): Double {
|
||||
return config.get("wardenChance") as Double
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Author: Sekalol15
|
||||
package plugin
|
||||
|
||||
import kotlin.random.Random
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.entity.EntityType
|
||||
import org.bukkit.event.EventHandler
|
||||
@@ -10,8 +11,6 @@ import org.bukkit.event.entity.CreatureSpawnEvent
|
||||
import org.bukkit.event.entity.EntityDeathEvent
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
import kotlin.random.Random
|
||||
|
||||
class Listeners : Listener {
|
||||
@EventHandler
|
||||
fun CreatureSpawnEvent(event: CreatureSpawnEvent) {
|
||||
@@ -25,43 +24,41 @@ class Listeners : Listener {
|
||||
val entityPos = event.entity.location
|
||||
val entityType = event.getEntityType()
|
||||
|
||||
|
||||
//check the conditions and spawn the slime if correct
|
||||
if (event.entity.entitySpawnReason != CreatureSpawnEvent.SpawnReason.CUSTOM && Random.nextDouble() <= SlimeChance && SlimeChanceEnabled == true) {
|
||||
// check the conditions and spawn the slime if correct
|
||||
if (
|
||||
event.entity.entitySpawnReason != CreatureSpawnEvent.SpawnReason.CUSTOM &&
|
||||
Random.nextDouble() <= SlimeChance &&
|
||||
SlimeChanceEnabled == true
|
||||
) {
|
||||
|
||||
event.entity.world.spawnEntity(entityPos, EntityType.SLIME, CreatureSpawnEvent.SpawnReason.CUSTOM)
|
||||
}
|
||||
|
||||
if (event.entity.entitySpawnReason == CreatureSpawnEvent.SpawnReason.RAID && raiderQuantity != 0) {
|
||||
|
||||
|
||||
for(i in 1..raiderQuantity) {
|
||||
for (i in 1..raiderQuantity) {
|
||||
event.entity.world.spawnEntity(entityPos, entityType, CreatureSpawnEvent.SpawnReason.CUSTOM)
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//check the conditions and spawn the slime if correct
|
||||
if (event.entity.entitySpawnReason != CreatureSpawnEvent.SpawnReason.CUSTOM && Random.nextDouble() <= WardenChance && WardenChanceEnabled == true) {
|
||||
// check the conditions and spawn the slime if correct
|
||||
if (
|
||||
event.entity.entitySpawnReason != CreatureSpawnEvent.SpawnReason.CUSTOM &&
|
||||
Random.nextDouble() <= WardenChance &&
|
||||
WardenChanceEnabled == true
|
||||
) {
|
||||
|
||||
event.entity.world.spawnEntity(entityPos, EntityType.WARDEN, CreatureSpawnEvent.SpawnReason.CUSTOM)
|
||||
}
|
||||
|
||||
if (event.entity.entitySpawnReason == CreatureSpawnEvent.SpawnReason.RAID && raiderQuantity != 0) {
|
||||
|
||||
|
||||
for(i in 1..raiderQuantity) {
|
||||
for (i in 1..raiderQuantity) {
|
||||
event.entity.world.spawnEntity(entityPos, entityType, CreatureSpawnEvent.SpawnReason.CUSTOM)
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun EntityDeathEvent(event: EntityDeathEvent) {
|
||||
|
||||
@@ -72,15 +69,6 @@ class Listeners : Listener {
|
||||
val entityPos = event.entity.location
|
||||
val iron = ItemStack(Material.IRON_INGOT)
|
||||
event.entity.world.dropItemNaturally(entityPos, iron)
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user