From 24350a5690c5a3ee2c93a2442f53620142637a4a Mon Sep 17 00:00:00 2001 From: ybw0014 Date: Fri, 22 Mar 2024 14:39:12 -0400 Subject: [PATCH] refactor: change things a bit --- .github/workflows/gradle.yml | 4 +- build.gradle | 47 ++++++++++--------- .../bump/api/appraise/AppraiseAttribute.java | 14 +++--- .../bump/api/appraise/AppraiseResult.java | 17 +++---- .../bump/api/appraise/AppraiseType.java | 27 ++++++----- src/main/resources/plugin.yml | 15 ------ 6 files changed, 56 insertions(+), 68 deletions(-) delete mode 100644 src/main/resources/plugin.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index e23be00b..1d2f8f14 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -23,10 +23,10 @@ jobs: distribution: temurin - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1.1.0 + uses: gradle/wrapper-validation-action@v2 - name: Build with Gradle - uses: gradle/gradle-build-action@v2.11.1 + uses: gradle/gradle-build-action@v3 with: arguments: build diff --git a/build.gradle b/build.gradle index 9c56673f..3c2a5873 100644 --- a/build.gradle +++ b/build.gradle @@ -2,14 +2,26 @@ plugins { id 'java' id 'com.github.johnrengelman.shadow' version '8.1.1' id 'org.sonarqube' version '4.4.1.3373' + id 'io.freefair.lombok' version '8.6' + id 'net.minecrell.plugin-yml.bukkit' version '0.6.0' } group = 'io.github.slimefunguguproject' +version = 'UNOFFICIAL' description = 'Bump' -java.sourceCompatibility = JavaVersion.VERSION_16 + +java { + sourceCompatibility = JavaVersion.VERSION_16 +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} repositories { + mavenLocal() mavenCentral() + maven { url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/') } @@ -24,33 +36,28 @@ repositories { } dependencies { - implementation 'net.guizhanss:GuizhanLib-api:1.7.0' + implementation 'net.guizhanss:GuizhanLib-api:1.7.6' implementation 'dev.sefiraat:SefiLib:0.2.6' implementation 'org.bstats:bstats-bukkit:3.0.2' - compileOnly 'org.spigotmc:spigot-api:1.19.2-R0.1-SNAPSHOT' - compileOnly 'io.github.Slimefun:Slimefun4:RC-32' + compileOnly 'org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT' + compileOnly 'io.github.Slimefun:Slimefun4:RC-37' compileOnly 'com.google.code.findbugs:jsr305:3.0.2' - compileOnly 'org.projectlombok:lombok:1.18.30' - - annotationProcessor 'org.projectlombok:lombok:1.18.30' } shadowJar { - // relocate 'net.guizhanss.guizhanlib', 'io.github.slimefunguguproject.bump.guizhanlib' - relocate 'dev.sefiraat.sefilib', 'io.github.slimefunguguproject.bump.sefilib' - relocate 'org.bstats', 'io.github.slimefunguguproject.bump.bstats' + relocate 'net.guizhanss.guizhanlib', 'io.github.slimefunguguproject.bump.libs.guizhanlib' + relocate 'dev.sefiraat.sefilib', 'io.github.slimefunguguproject.bump.libs.sefilib' + relocate 'org.bstats', 'io.github.slimefunguguproject.bump.libs.bstats' minimize() } -processResources { - expand project.properties - def props = [version: version] - inputs.properties props - filteringCharset 'UTF-8' - filesMatching('plugin.yml') { - expand props - } +bukkit { + main = 'io.github.slimefunguguproject.bump.implementation.Bump' + apiVersion = '1.16' + authors = ['bxx2004', 'LobbyTech-MC', 'zimzaza4', 'haiman233', 'ybw0014'] + depend = ['Slimefun'] + softDepend = ['GuizhanLibPlugin'] } sonar { @@ -60,7 +67,3 @@ sonar { property "sonar.host.url", "https://sonarcloud.io" } } - -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} diff --git a/src/main/java/io/github/slimefunguguproject/bump/api/appraise/AppraiseAttribute.java b/src/main/java/io/github/slimefunguguproject/bump/api/appraise/AppraiseAttribute.java index 4f0b2b3f..2f650fba 100644 --- a/src/main/java/io/github/slimefunguguproject/bump/api/appraise/AppraiseAttribute.java +++ b/src/main/java/io/github/slimefunguguproject/bump/api/appraise/AppraiseAttribute.java @@ -85,15 +85,15 @@ public int hashCode() { } /** - * Get the percentile of result value within range. + * Get the percentage of result value within range. *
* Return range from 0 to 100.
*
* @param value The result value.
*
- * @return The percentile of the result value.
+ * @return The percentage of the result value.
*/
- public double getPercentile(double value) {
+ public double getPercentage(double value) {
if (value <= min) {
return 0;
} else if (value >= max) {
@@ -104,13 +104,13 @@ public double getPercentile(double value) {
}
/**
- * Get the weighted percentile of result value.
+ * Get the weighted percentage of result value.
*
* @param value The result value.
*
- * @return The weighted percentile of the result value.
+ * @return The weighted percentage of the result value.
*/
- public double getWeightedPercentile(double value) {
- return getPercentile(value) * weight / 100.D;
+ public double getWeightedPercentage(double value) {
+ return getPercentage(value) * weight / 100.D;
}
}
diff --git a/src/main/java/io/github/slimefunguguproject/bump/api/appraise/AppraiseResult.java b/src/main/java/io/github/slimefunguguproject/bump/api/appraise/AppraiseResult.java
index 0c10366d..57f99ca3 100644
--- a/src/main/java/io/github/slimefunguguproject/bump/api/appraise/AppraiseResult.java
+++ b/src/main/java/io/github/slimefunguguproject/bump/api/appraise/AppraiseResult.java
@@ -30,7 +30,7 @@
import lombok.Getter;
/**
- * An {@link AppraiseResult} contains results of attributes and
+ * An {@link AppraiseResult} contains results of attributes and the weights.
*
* @author ybw0014
*/
@@ -40,20 +40,17 @@ public final class AppraiseResult {
/**
* This is a reference to the {@link AppraiseType} that generates this {@link AppraiseResult}.
*/
- @Getter
private final AppraiseType appraiseType;
/**
* This unmodifiable map stores the {@link AppraiseAttribute} and result.
*/
- @Getter
private final Map