mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-09-21 03:21:02 +02:00
Remove spigot module
This commit is contained in:
parent
9085d6dda4
commit
8bce928446
@ -1,141 +0,0 @@
|
||||
package us.crazycrew.crazyauctions;
|
||||
|
||||
import us.crazycrew.crazyauctions.api.economy.vault.VaultSupport;
|
||||
import us.crazycrew.crazyauctions.api.enums.PluginSupport;
|
||||
import us.crazycrew.crazyauctions.commands.AuctionCommand;
|
||||
import us.crazycrew.crazyauctions.configs.Config;
|
||||
import us.crazycrew.crazyauctions.configs.Locale;
|
||||
import us.crazycrew.crazyauctions.configs.data.AuctionData;
|
||||
import net.dehya.ruby.RubyCore;
|
||||
import net.dehya.ruby.SpigotRuby;
|
||||
import net.dehya.ruby.command.cloud.RubyCommand;
|
||||
import net.dehya.ruby.files.SpigotFileManager;
|
||||
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;
|
||||
import java.util.List;
|
||||
|
||||
public class CrazyAuctions extends JavaPlugin implements RubyCore {
|
||||
|
||||
private static CrazyAuctions plugin;
|
||||
|
||||
private final SpigotRuby spigotRuby = new SpigotRuby(this);
|
||||
|
||||
private final PluginSupport pluginSupport;
|
||||
|
||||
private final Starter starter;
|
||||
|
||||
public CrazyAuctions() {
|
||||
super();
|
||||
|
||||
try {
|
||||
Field api = Provider.class.getDeclaredField("api");
|
||||
api.setAccessible(true);
|
||||
api.set(null, this);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
}
|
||||
|
||||
plugin = this;
|
||||
|
||||
this.pluginSupport = new PluginSupport();
|
||||
|
||||
this.starter = new Starter();
|
||||
|
||||
this.pluginSupport.loadCurrency();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
Config.reload();
|
||||
Locale.reload();
|
||||
|
||||
AuctionData.load();
|
||||
|
||||
getCommand("ah").setExecutor(new AuctionCommand());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
AuctionData.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Path getDirectory() {
|
||||
return getDataFolder().toPath();
|
||||
}
|
||||
|
||||
// ===================================================
|
||||
|
||||
/**
|
||||
* These all can be null as we don't use them here.
|
||||
*/
|
||||
@Override
|
||||
public @NotNull Console getConsole() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull RubyPlayerRegistry getPlayerRegistry() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<RubyCommand> getCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// ===================================================
|
||||
|
||||
@Override
|
||||
public @NotNull String getPrefix() {
|
||||
return Config.PREFIX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the plugin instance
|
||||
*/
|
||||
public static CrazyAuctions getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the spigot manager
|
||||
*/
|
||||
public SpigotRuby getSpigotManager() {
|
||||
return this.spigotRuby;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the spigot file manager
|
||||
*/
|
||||
public SpigotFileManager getSpigotFileManager() {
|
||||
return this.spigotRuby.getSpigotFileManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the plugin support class
|
||||
*/
|
||||
public PluginSupport getPluginSupport() {
|
||||
return this.pluginSupport;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the starter class
|
||||
*/
|
||||
public Starter getStarter() {
|
||||
return this.starter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return vault support
|
||||
*/
|
||||
public VaultSupport getVaultSupport() {
|
||||
return this.starter.getVaultSupport();
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package us.crazycrew.crazyauctions;
|
||||
|
||||
import us.crazycrew.crazyauctions.api.CrazyManager;
|
||||
import us.crazycrew.crazyauctions.api.economy.vault.VaultSupport;
|
||||
import us.crazycrew.crazyauctions.api.enums.PluginSupport;
|
||||
|
||||
public class Starter {
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
private CrazyManager crazyManager = new CrazyManager();
|
||||
|
||||
private VaultSupport vaultSupport;
|
||||
|
||||
public void init() {
|
||||
if (getVaultSupport() != null && PluginSupport.SupportedPlugins.VAULT.isPluginLoaded()) plugin.getLogger().warning("Vault support is now enabled.");
|
||||
crazyManager = new CrazyManager();
|
||||
}
|
||||
|
||||
public CrazyManager getCrazyManager() {
|
||||
return crazyManager;
|
||||
}
|
||||
|
||||
public Starter setVaultSupport(VaultSupport vaultSupport) {
|
||||
this.vaultSupport = vaultSupport;
|
||||
|
||||
this.vaultSupport.loadVault();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public VaultSupport getVaultSupport() {
|
||||
return this.vaultSupport;
|
||||
}
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package us.crazycrew.crazyauctions.commands;
|
||||
|
||||
import us.crazycrew.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 {
|
||||
|
||||
@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();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
package us.crazycrew.crazyauctions.configs;
|
||||
|
||||
import us.crazycrew.crazyauctions.api.interfaces.Universal;
|
||||
import net.dehya.ruby.common.annotations.FileBuilder;
|
||||
import net.dehya.ruby.common.annotations.yaml.BlockType;
|
||||
import net.dehya.ruby.common.annotations.yaml.Comment;
|
||||
import net.dehya.ruby.common.annotations.yaml.Key;
|
||||
import net.dehya.ruby.common.enums.FileType;
|
||||
import net.dehya.ruby.files.FileExtension;
|
||||
import net.dehya.ruby.files.FileManager;
|
||||
import org.simpleyaml.configuration.file.YamlFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@FileBuilder(isLogging = true, isAsync = false, isData = false, fileType = FileType.YAML)
|
||||
public class Config extends FileExtension implements Universal {
|
||||
|
||||
@Key("settings.prefix")
|
||||
@Comment("The prefix used in front of messages.")
|
||||
public static String PREFIX = "&8[&bCrazyAuctions&8]: ";
|
||||
|
||||
@Key("settings.locale-file")
|
||||
@Comment("The language file to use from the locale folder. Supported languages are English(en).")
|
||||
@BlockType
|
||||
public static String LOCALE_FILE = "locale-en.yml";
|
||||
|
||||
@Key("settings.update-checker")
|
||||
@Comment("Whether you want to be notified when an update is published to Modrinth.")
|
||||
public static boolean UPDATE_CHECKER = true;
|
||||
|
||||
@Key("settings.toggle-metrics")
|
||||
@Comment("Whether you want your server statistics to be sent to https://bstats.org/ ( Requires a restart! )")
|
||||
public static boolean TOGGLE_METRICS = true;
|
||||
|
||||
@Key("settings.config-version")
|
||||
@Comment("DO NOT TOUCH THIS: We use this to identify if your configs are outdated.")
|
||||
public static double CONFIG_VERSION = 1.0;
|
||||
|
||||
@Key("settings.data-storage.storage-method")
|
||||
@Comment("The only available type at the moment is JSON")
|
||||
public static String STORAGE_TYPE = "JSON";
|
||||
|
||||
public Config() {
|
||||
super("config.yml");
|
||||
}
|
||||
|
||||
public static void reload() {
|
||||
plugin.getSpigotFileManager().addFile(new Config());
|
||||
}
|
||||
|
||||
public static YamlFile getConfiguration(FileManager fileManager) {
|
||||
try {
|
||||
return fileManager.getFileConfiguration(new Config());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package us.crazycrew.crazyauctions.configs;
|
||||
|
||||
import us.crazycrew.crazyauctions.api.interfaces.Universal;
|
||||
import net.dehya.ruby.common.annotations.FileBuilder;
|
||||
import net.dehya.ruby.common.enums.FileType;
|
||||
import net.dehya.ruby.files.FileExtension;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
@FileBuilder(isLogging = true, isAsync = false, isData = false, fileType = FileType.YAML)
|
||||
public class Locale extends FileExtension implements Universal {
|
||||
|
||||
public Locale(Path path) {
|
||||
super(Config.LOCALE_FILE, path.resolve("locale"));
|
||||
}
|
||||
|
||||
public static void reload() {
|
||||
plugin.getSpigotFileManager().extract("/locale", plugin.getDirectory());
|
||||
|
||||
plugin.getSpigotFileManager().addFile(new Locale(plugin.getDirectory()));
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package us.crazycrew.crazyauctions.configs.data;
|
||||
|
||||
import us.crazycrew.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;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@FileBuilder(isLogging = true, isAsync = false, isData = false, fileType = FileType.JSON)
|
||||
public class AuctionData extends FileExtension implements Universal {
|
||||
|
||||
@Expose
|
||||
public static ConcurrentHashMap<UUID, String> auctionData = new ConcurrentHashMap<>();
|
||||
|
||||
public AuctionData() {
|
||||
super("auction-data.json");
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
plugin.getSpigotFileManager().addFile(new AuctionData());
|
||||
}
|
||||
|
||||
public static void save() {
|
||||
plugin.getSpigotFileManager().saveFile(new AuctionData());
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
settings:
|
||||
prefix: "&8[&bCrazyAuctions&8]: " # The prefix used in front of messages.
|
||||
|
||||
verbose-logging: false # Whether you want to have extra logging enabled... Currently does nothing!
|
||||
|
||||
update-checker: true # Whether you want to be notified when an update is published to Modrinth.
|
||||
toggle-metrics: true # Whether you want your server statistics to be sent to https://bstats.org/ ( Requires a restart! )
|
||||
config-version: 1.0 # DO NOT TOUCH THIS: We use this to identify if configs are outdated.
|
||||
|
||||
data-storage:
|
||||
# How the plugin should store data
|
||||
#
|
||||
# - Your Options
|
||||
# | Remote Database Types - You need to supply connection information.
|
||||
# |» MySQL *NOT IMPLEMENTED*
|
||||
# |» MariaDB ( Recommended over MySQL ) *NOT IMPLEMENTED*
|
||||
#
|
||||
# | Local Database Types
|
||||
# |» H2 *NOT IMPLEMENTED*
|
||||
#
|
||||
# | Text File Based Storage
|
||||
# |» JSON (.json files) *DEFAULT
|
||||
storage-method: JSON
|
@ -1,16 +0,0 @@
|
||||
name: CrazyAuctions
|
||||
main: {group}.CrazyAuctions
|
||||
|
||||
authors: [BadBones69, RyderBelserion]
|
||||
|
||||
version: ${version}
|
||||
api-version: '1.13'
|
||||
description: ${description}
|
||||
website: ${website}
|
||||
|
||||
softdepend: [CMI, HolographicDisplays, DecentHolograms, PlaceholderAPI]
|
||||
|
||||
commands:
|
||||
crazyauctions:
|
||||
description: The base command for Crazy Auctions
|
||||
aliases: [ca, ah, crazyauction]
|
Loading…
Reference in New Issue
Block a user