From 4ea09a4f49709007a764657ff8948f5510517286 Mon Sep 17 00:00:00 2001 From: Ryder Belserion Date: Sat, 7 Sep 2024 23:48:42 -0400 Subject: [PATCH] update vital api --- paper/build.gradle.kts | 6 ++--- .../crazyauctions/CrazyAuctions.java | 27 +++++++------------ .../api/builders/ItemBuilder.java | 2 +- .../crazyauctions/api/enums/Messages.java | 2 +- .../crazyauctions/api/enums/misc/Files.java | 15 ++++++----- .../api/support/MetricsWrapper.java | 2 +- .../commands/AuctionCommand.java | 2 +- 7 files changed, 25 insertions(+), 31 deletions(-) diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts index 4f1535d..32ad145 100644 --- a/paper/build.gradle.kts +++ b/paper/build.gradle.kts @@ -23,7 +23,7 @@ dependencies { } paperweight { - reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.REOBF_PRODUCTION + reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION } tasks { @@ -44,11 +44,11 @@ tasks { } assemble { - dependsOn(reobfJar) + dependsOn(shadowJar) doLast { copy { - from(reobfJar.get()) + from(shadowJar.get()) into(rootProject.projectDir.resolve("jars")) } } diff --git a/paper/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java b/paper/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java index 356a973..94f1acb 100644 --- a/paper/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java +++ b/paper/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java @@ -9,8 +9,8 @@ import com.badbones69.crazyauctions.commands.AuctionTab; import com.badbones69.crazyauctions.controllers.GuiListener; import com.badbones69.crazyauctions.controllers.MarcoListener; import com.badbones69.crazyauctions.currency.VaultSupport; -import com.ryderbelserion.vital.paper.VitalPaper; -import com.ryderbelserion.vital.paper.files.config.FileManager; +import com.ryderbelserion.vital.paper.Vital; +import com.ryderbelserion.vital.paper.api.files.FileManager; import com.ryderbelserion.vital.paper.util.scheduler.FoliaRunnable; import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandExecutor; @@ -20,15 +20,16 @@ import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; + +import java.io.File; import java.util.Base64; -public class CrazyAuctions extends JavaPlugin { +public class CrazyAuctions extends Vital { public @NotNull static CrazyAuctions getPlugin() { return JavaPlugin.getPlugin(CrazyAuctions.class); } - private FileManager fileManager; private CrazyManager crazyManager; private VaultSupport support; @@ -43,17 +44,13 @@ public class CrazyAuctions extends JavaPlugin { return; } - new VitalPaper(this).setLogging(false); - - this.fileManager = new FileManager(); - this.crazyManager = new CrazyManager(); - - this.fileManager.addFile("config.yml") - .addFile("data.yml") - .addFile("messages.yml") - //.addFile("test-file.yml") + getFileManager().addFile(new File(getDataFolder(), "config.yml")) + .addFile(new File(getDataFolder(), "data.yml")) + .addFile(new File(getDataFolder(), "messages.yml")) .init(); + this.crazyManager = new CrazyManager(); + FileConfiguration configuration = Files.data.getConfiguration(); if (configuration.contains("OutOfTime/Cancelled")) { @@ -156,8 +153,4 @@ public class CrazyAuctions extends JavaPlugin { public final CrazyManager getCrazyManager() { return this.crazyManager; } - - public final FileManager getFileManager() { - return this.fileManager; - } } \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazyauctions/api/builders/ItemBuilder.java b/paper/src/main/java/com/badbones69/crazyauctions/api/builders/ItemBuilder.java index e704932..27be06e 100644 --- a/paper/src/main/java/com/badbones69/crazyauctions/api/builders/ItemBuilder.java +++ b/paper/src/main/java/com/badbones69/crazyauctions/api/builders/ItemBuilder.java @@ -3,7 +3,7 @@ package com.badbones69.crazyauctions.api.builders; import com.badbones69.crazyauctions.CrazyAuctions; import com.badbones69.crazyauctions.Methods; import com.badbones69.crazyauctions.api.support.SkullCreator; -import com.ryderbelserion.vital.paper.enums.Support; +import com.ryderbelserion.vital.paper.api.enums.Support; import io.th0rgal.oraxen.api.OraxenItems; import me.clip.placeholderapi.PlaceholderAPI; import org.bukkit.*; diff --git a/paper/src/main/java/com/badbones69/crazyauctions/api/enums/Messages.java b/paper/src/main/java/com/badbones69/crazyauctions/api/enums/Messages.java index a10126c..7e78222 100644 --- a/paper/src/main/java/com/badbones69/crazyauctions/api/enums/Messages.java +++ b/paper/src/main/java/com/badbones69/crazyauctions/api/enums/Messages.java @@ -2,7 +2,7 @@ package com.badbones69.crazyauctions.api.enums; import com.badbones69.crazyauctions.Methods; import com.badbones69.crazyauctions.api.enums.misc.Files; -import com.ryderbelserion.vital.paper.enums.Support; +import com.ryderbelserion.vital.paper.api.enums.Support; import me.clip.placeholderapi.PlaceholderAPI; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.FileConfiguration; diff --git a/paper/src/main/java/com/badbones69/crazyauctions/api/enums/misc/Files.java b/paper/src/main/java/com/badbones69/crazyauctions/api/enums/misc/Files.java index 315989e..2c5d64e 100644 --- a/paper/src/main/java/com/badbones69/crazyauctions/api/enums/misc/Files.java +++ b/paper/src/main/java/com/badbones69/crazyauctions/api/enums/misc/Files.java @@ -1,11 +1,12 @@ package com.badbones69.crazyauctions.api.enums.misc; import com.badbones69.crazyauctions.CrazyAuctions; -import com.ryderbelserion.vital.paper.files.config.FileManager; +import com.ryderbelserion.vital.paper.api.files.FileManager; import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; +import java.io.File; + public enum Files { config("config.yml"), @@ -31,7 +32,7 @@ public enum Files { } public final YamlConfiguration getConfiguration() { - return this.fileManager.getFile(this.fileName); + return this.fileManager.getFile(this.fileName).getConfiguration(); } public final String getStrippedName() { @@ -42,11 +43,11 @@ public enum Files { return this.fileName; } + public void reload() { + this.fileManager.addFile(new File(this.plugin.getDataFolder(), this.fileName)); + } + public void save() { this.fileManager.saveFile(this.fileName); } - - public void reload() { - this.fileManager.reloadFile(this.fileName); - } } \ No newline at end of file diff --git a/paper/src/main/java/com/badbones69/crazyauctions/api/support/MetricsWrapper.java b/paper/src/main/java/com/badbones69/crazyauctions/api/support/MetricsWrapper.java index 28f03e3..8132ffd 100644 --- a/paper/src/main/java/com/badbones69/crazyauctions/api/support/MetricsWrapper.java +++ b/paper/src/main/java/com/badbones69/crazyauctions/api/support/MetricsWrapper.java @@ -1,7 +1,7 @@ package com.badbones69.crazyauctions.api.support; import com.badbones69.crazyauctions.CrazyAuctions; -import com.ryderbelserion.vital.paper.bStats; +import com.ryderbelserion.vital.paper.api.bStats; public class MetricsWrapper extends bStats { diff --git a/paper/src/main/java/com/badbones69/crazyauctions/commands/AuctionCommand.java b/paper/src/main/java/com/badbones69/crazyauctions/commands/AuctionCommand.java index 648980a..63ebeff 100644 --- a/paper/src/main/java/com/badbones69/crazyauctions/commands/AuctionCommand.java +++ b/paper/src/main/java/com/badbones69/crazyauctions/commands/AuctionCommand.java @@ -9,7 +9,7 @@ import com.badbones69.crazyauctions.api.enums.Messages; import com.badbones69.crazyauctions.api.enums.ShopType; import com.badbones69.crazyauctions.api.events.AuctionListEvent; import com.badbones69.crazyauctions.controllers.GuiListener; -import com.ryderbelserion.vital.paper.files.config.FileManager; +import com.ryderbelserion.vital.paper.api.files.FileManager; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor;