From 1bfc8490c60d2557c5b2e73c745283e1a1693646 Mon Sep 17 00:00:00 2001 From: Ryder Belserion Date: Sun, 19 Feb 2023 03:29:05 -0500 Subject: [PATCH] Push this shit here --- .../com/badbones69/crazyauctions/CrazyAuctions.java | 4 ++-- .../crazyauctions/api/interfaces/Universal.java | 9 +++++++++ .../crazyauctions/commands/AuctionCommand.java | 5 +---- .../crazyauctions/configs/data/AuctionData.java | 10 ++++++---- 4 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 platforms/spigot/src/main/java/com/badbones69/crazyauctions/api/interfaces/Universal.java diff --git a/platforms/spigot/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java b/platforms/spigot/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java index 576fc11..4175f13 100644 --- a/platforms/spigot/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java +++ b/platforms/spigot/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java @@ -56,14 +56,14 @@ public class CrazyAuctions extends JavaPlugin implements RubyCore { Config.reload(this); Locale.reload(this); - AuctionData.load(this); + AuctionData.load(); getCommand("ah").setExecutor(new AuctionCommand()); } @Override public void onDisable() { - AuctionData.save(this); + AuctionData.save(); } @Override diff --git a/platforms/spigot/src/main/java/com/badbones69/crazyauctions/api/interfaces/Universal.java b/platforms/spigot/src/main/java/com/badbones69/crazyauctions/api/interfaces/Universal.java new file mode 100644 index 0000000..ee7f7eb --- /dev/null +++ b/platforms/spigot/src/main/java/com/badbones69/crazyauctions/api/interfaces/Universal.java @@ -0,0 +1,9 @@ +package com.badbones69.crazyauctions.api.interfaces; + +import com.badbones69.crazyauctions.CrazyAuctions; + +public interface Universal { + + CrazyAuctions plugin = CrazyAuctions.getPlugin(); + +} \ No newline at end of file diff --git a/platforms/spigot/src/main/java/com/badbones69/crazyauctions/commands/AuctionCommand.java b/platforms/spigot/src/main/java/com/badbones69/crazyauctions/commands/AuctionCommand.java index 3c539f2..5337e3b 100644 --- a/platforms/spigot/src/main/java/com/badbones69/crazyauctions/commands/AuctionCommand.java +++ b/platforms/spigot/src/main/java/com/badbones69/crazyauctions/commands/AuctionCommand.java @@ -1,6 +1,5 @@ package com.badbones69.crazyauctions.commands; -import com.badbones69.crazyauctions.CrazyAuctions; import com.badbones69.crazyauctions.configs.data.AuctionData; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -11,8 +10,6 @@ import java.util.UUID; public class AuctionCommand implements CommandExecutor { - private final CrazyAuctions plugin = CrazyAuctions.getPlugin(); - @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { @@ -20,7 +17,7 @@ public class AuctionCommand implements CommandExecutor { AuctionData.auctionData.putIfAbsent(player.getUniqueId(), UUID.randomUUID().toString()); - AuctionData.save(this.plugin); + AuctionData.save(); return false; } diff --git a/platforms/spigot/src/main/java/com/badbones69/crazyauctions/configs/data/AuctionData.java b/platforms/spigot/src/main/java/com/badbones69/crazyauctions/configs/data/AuctionData.java index e62dae8..5eb5e49 100644 --- a/platforms/spigot/src/main/java/com/badbones69/crazyauctions/configs/data/AuctionData.java +++ b/platforms/spigot/src/main/java/com/badbones69/crazyauctions/configs/data/AuctionData.java @@ -1,6 +1,7 @@ package com.badbones69.crazyauctions.configs.data; -import com.badbones69.crazyauctions.CrazyAuctions; +import com.badbones69.crazyauctions.api.interfaces.Universal; +import com.google.gson.annotations.Expose; import net.dehya.ruby.common.annotations.FileBuilder; import net.dehya.ruby.common.enums.FileType; import net.dehya.ruby.files.FileExtension; @@ -8,19 +9,20 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @FileBuilder(isLogging = true, isAsync = false, isData = false, fileType = FileType.JSON) -public class AuctionData extends FileExtension { +public class AuctionData extends FileExtension implements Universal { + @Expose public static ConcurrentHashMap auctionData = new ConcurrentHashMap<>(); public AuctionData() { super("auction-data.json"); } - public static void load(CrazyAuctions plugin) { + public static void load() { plugin.getSpigotFileManager().addFile(new AuctionData()); } - public static void save(CrazyAuctions plugin) { + public static void save() { plugin.getSpigotFileManager().saveFile(new AuctionData()); } } \ No newline at end of file