Experimental formatting
This commit is contained in:
1 parent
9a5509c1a1
commit
e62281682f
7 files changed
+46
-49
No files matched your search
+20
-19
@@ -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 {
|
||||
@@ -15,16 +16,11 @@ 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("/")
|
||||
}
|
||||
@@ -42,10 +38,9 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Import Purpur API.
|
||||
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(project(":libs:Utilities-OG"))
|
||||
compileOnlyApi(project(":libs:Utilities-OG"))
|
||||
}
|
||||
|
||||
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
|
||||
@@ -60,12 +55,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,13 +68,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")
|
||||
}
|
||||
}
|
||||
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.
@@ -6,15 +6,13 @@ package plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
|
||||
// Extends bukkit class to run commands.
|
||||
public class CommandManager implements CommandExecutor {
|
||||
|
||||
@@ -26,7 +24,6 @@ public class CommandManager implements CommandExecutor {
|
||||
|
||||
// Pass the instance of this class as an object.
|
||||
return instance;
|
||||
|
||||
}
|
||||
|
||||
// Command execution event handler extending bukkit's CommandManager
|
||||
@@ -47,12 +44,13 @@ public class CommandManager implements CommandExecutor {
|
||||
// Run the function to toggle death coordinates, since all qualifications have been met.
|
||||
doDeathCoordinateToggle(player);
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
// Advertise OG Master to players who don't have it.
|
||||
UtilitiesOG.trueogMessage(player, ToggleDeathCoordinatesOG.getPrefix() + "&cERROR: &6Only" + " &4&lOG Master &6and above can toggle death coordinates being shown in chat with &e/tdc&6. You can upgrade with &B&l/buy&6.");
|
||||
|
||||
UtilitiesOG.trueogMessage(
|
||||
player,
|
||||
ToggleDeathCoordinatesOG.getPrefix() + "&cERROR: &6Only"
|
||||
+ " &4&lOG Master &6and above can toggle death coordinates being shown in chat with &e/tdc&6. You can upgrade with &B&l/buy&6.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -60,15 +58,13 @@ public class CommandManager implements CommandExecutor {
|
||||
else {
|
||||
|
||||
// Send error message to console.
|
||||
UtilitiesOG.logToConsole(ToggleDeathCoordinatesOG.getPrefix(), "ERROR: The console cannot execute that command!");
|
||||
|
||||
UtilitiesOG.logToConsole(
|
||||
ToggleDeathCoordinatesOG.getPrefix(), "ERROR: The console cannot execute that command!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Healthy exit status.
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
// Declare a function to hold the logic for toggling death coordinates.
|
||||
@@ -84,7 +80,7 @@ public class CommandManager implements CommandExecutor {
|
||||
boolean toggleState = playerCache.getBoolean((player).getUniqueId().toString());
|
||||
|
||||
// Flip the true/false value to the opposite of what it currently is.
|
||||
playerCache.set((player).getUniqueId().toString(), ! toggleState);
|
||||
playerCache.set((player).getUniqueId().toString(), !toggleState);
|
||||
|
||||
// Attempt to run code that throws an error.
|
||||
try {
|
||||
@@ -97,25 +93,26 @@ public class CommandManager implements CommandExecutor {
|
||||
catch (IOException e) {
|
||||
|
||||
// Send an error message to the player who tried to toggle their death coordinates.
|
||||
UtilitiesOG.trueogMessage(player, ToggleDeathCoordinatesOG.getPrefix() + "&cERROR: ToggleDeathCoordinates encountered a problem. Please report this issue to staff.");
|
||||
|
||||
UtilitiesOG.trueogMessage(
|
||||
player,
|
||||
ToggleDeathCoordinatesOG.getPrefix()
|
||||
+ "&cERROR: ToggleDeathCoordinates encountered a problem. Please report this issue to staff.");
|
||||
}
|
||||
|
||||
// If the player's death coordinates are toggled off, do this...
|
||||
if(! toggleState) {
|
||||
if (!toggleState) {
|
||||
|
||||
// Send the player a message affirming that their death coordinates have been toggled OFF.
|
||||
UtilitiesOG.trueogMessage(player, ToggleDeathCoordinatesOG.getPrefix() + "&6Death Coordinates turned &cOFF&6.");
|
||||
UtilitiesOG.trueogMessage(
|
||||
player, ToggleDeathCoordinatesOG.getPrefix() + "&6Death Coordinates turned &cOFF&6.");
|
||||
|
||||
}
|
||||
// If the player's death coordinates are toggled on, do this...
|
||||
else {
|
||||
|
||||
// Send the player a message affirming that their death coordinates have been toggled ON.
|
||||
UtilitiesOG.trueogMessage(player, ToggleDeathCoordinatesOG.getPrefix() + "&aDeath Coordinates turned &2ON&a.");
|
||||
|
||||
UtilitiesOG.trueogMessage(
|
||||
player, ToggleDeathCoordinatesOG.getPrefix() + "&aDeath Coordinates turned &2ON&a.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user