Push my shit

This commit is contained in:
Ryder Belserion 2023-02-19 03:26:19 -05:00
parent 7b988d3028
commit fd186f7034
No known key found for this signature in database
GPG Key ID: 8FC2E6C54BBF05FE
5 changed files with 62 additions and 6 deletions

View File

@ -2,9 +2,10 @@ package com.badbones69.crazyauctions;
import com.badbones69.crazyauctions.api.economy.vault.VaultSupport;
import com.badbones69.crazyauctions.api.enums.PluginSupport;
import com.badbones69.crazyauctions.commands.AuctionCommand;
import com.badbones69.crazyauctions.configs.Config;
import com.badbones69.crazyauctions.configs.Locale;
import net.dehya.ruby.PaperRuby;
import com.badbones69.crazyauctions.configs.data.AuctionData;
import net.dehya.ruby.RubyCore;
import net.dehya.ruby.SpigotRuby;
import net.dehya.ruby.command.cloud.RubyCommand;
@ -13,7 +14,6 @@ import net.dehya.ruby.player.RubyPlayerRegistry;
import net.dehya.ruby.registry.senders.types.Console;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Field;
import java.nio.file.Path;
import java.util.Collections;
@ -55,11 +55,15 @@ public class CrazyAuctions extends JavaPlugin implements RubyCore {
public void onEnable() {
Config.reload(this);
Locale.reload(this);
AuctionData.load(this);
getCommand("ah").setExecutor(new AuctionCommand());
}
@Override
public void onDisable() {
AuctionData.save(this);
}
@Override
@ -135,5 +139,4 @@ public class CrazyAuctions extends JavaPlugin implements RubyCore {
public VaultSupport getVaultSupport() {
return this.starter.getVaultSupport();
}
}

View File

@ -0,0 +1,27 @@
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;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
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) {
Player player = (Player) sender;
AuctionData.auctionData.putIfAbsent(player.getUniqueId(), UUID.randomUUID().toString());
AuctionData.save(this.plugin);
return false;
}
}

View File

@ -11,7 +11,7 @@ import net.dehya.ruby.files.FileManager;
import org.simpleyaml.configuration.file.YamlFile;
import java.io.IOException;
@FileBuilder(isLogging = true, isAsync = true, isData = false, fileType = FileType.YAML)
@FileBuilder(isLogging = true, isAsync = false, isData = false, fileType = FileType.YAML)
public class Config extends FileExtension {
@Key("settings.prefix")

View File

@ -0,0 +1,26 @@
package com.badbones69.crazyauctions.configs.data;
import com.badbones69.crazyauctions.CrazyAuctions;
import net.dehya.ruby.common.annotations.FileBuilder;
import net.dehya.ruby.common.enums.FileType;
import net.dehya.ruby.files.FileExtension;
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 static ConcurrentHashMap<UUID, String> auctionData = new ConcurrentHashMap<>();
public AuctionData() {
super("auction-data.json");
}
public static void load(CrazyAuctions plugin) {
plugin.getSpigotFileManager().addFile(new AuctionData());
}
public static void save(CrazyAuctions plugin) {
plugin.getSpigotFileManager().saveFile(new AuctionData());
}
}

View File

@ -1,4 +1,4 @@
name: "CrazyCrates"
name: "CrazyAuctions"
main: "${group}.CrazyAuctions"
authors: [BadBones69, RyderBelserion]