mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-11-25 12:25:20 +01:00
Commited
This commit is contained in:
parent
e8b64bf928
commit
023be7ea5e
@ -3,6 +3,8 @@ package com.badbones69.crazyauctions;
|
||||
import com.badbones69.crazyauctions.api.economy.vault.VaultSupport;
|
||||
import com.badbones69.crazyauctions.api.enums.PluginSupport;
|
||||
import com.badbones69.crazyauctions.configs.Config;
|
||||
import com.badbones69.crazyauctions.configs.Locale;
|
||||
import net.dehya.ruby.PaperRuby;
|
||||
import net.dehya.ruby.RubyCore;
|
||||
import net.dehya.ruby.SpigotRuby;
|
||||
import net.dehya.ruby.command.cloud.RubyCommand;
|
||||
@ -11,6 +13,7 @@ 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;
|
||||
@ -51,6 +54,7 @@ public class CrazyAuctions extends JavaPlugin implements RubyCore {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
Config.reload(this);
|
||||
Locale.reload(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -131,4 +135,5 @@ public class CrazyAuctions extends JavaPlugin implements RubyCore {
|
||||
public VaultSupport getVaultSupport() {
|
||||
return this.starter.getVaultSupport();
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,23 @@
|
||||
package com.badbones69.crazyauctions;
|
||||
|
||||
import com.badbones69.crazyauctions.api.CrazyManager;
|
||||
import com.badbones69.crazyauctions.api.economy.vault.VaultSupport;
|
||||
import com.badbones69.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) {
|
||||
@ -24,4 +31,5 @@ public class Starter {
|
||||
public VaultSupport getVaultSupport() {
|
||||
return this.vaultSupport;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.badbones69.crazyauctions.api;
|
||||
|
||||
import com.badbones69.crazyauctions.CrazyAuctions;
|
||||
|
||||
public class CrazyManager {
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
public void load() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package com.badbones69.crazyauctions.api.enums.eco;
|
||||
package com.badbones69.crazyauctions.api.auctionhouse.enums;
|
||||
|
||||
public enum AuctionType {
|
||||
|
||||
SELL_TYPE(""),
|
||||
BID_TYPE("");
|
||||
BID("Bid"),
|
||||
SELL("Sell");
|
||||
|
||||
private final String name;
|
||||
|
||||
@ -22,4 +22,5 @@ public enum AuctionType {
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.badbones69.crazyauctions.api.auctionhouse.interfaces;
|
||||
|
||||
import com.badbones69.crazyauctions.api.auctionhouse.enums.AuctionType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface AuctionItem {
|
||||
|
||||
UUID auctionID = UUID.randomUUID();
|
||||
|
||||
default UUID getAuctionID() {
|
||||
return auctionID;
|
||||
}
|
||||
|
||||
AuctionType getAuctionType();
|
||||
|
||||
UUID getSeller();
|
||||
|
||||
long getPrice();
|
||||
|
||||
long getExpireTime();
|
||||
|
||||
ItemStack getSellingItem();
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.badbones69.crazyauctions.api.auctionhouse.objects;
|
||||
|
||||
import com.badbones69.crazyauctions.api.auctionhouse.enums.AuctionType;
|
||||
import com.badbones69.crazyauctions.api.auctionhouse.interfaces.AuctionItem;
|
||||
import org.simpleyaml.configuration.file.YamlFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class AuctionHouse {
|
||||
|
||||
private String name;
|
||||
private InventorySettings inventorySettings;
|
||||
private List<AuctionItem> auctionItems = new ArrayList<>();
|
||||
|
||||
public AuctionHouse(String name, YamlFile file) {
|
||||
this.name = name;
|
||||
this.inventorySettings = new InventorySettings();
|
||||
inventorySettings.setTitle("Set Title Here with Color");
|
||||
for (String auctionID : file.getConfigurationSection("auction-house.item-on-auction").getKeys(false)) {
|
||||
String path = "auction-house.item-on-auction" + auctionID + ".";
|
||||
AuctionType auctionType = AuctionType.getTypeFromName(file.getString(path + "auction-type"));
|
||||
if (auctionType == AuctionType.SELL) {
|
||||
auctionItems.add(new BuyingAuction(
|
||||
UUID.fromString(file.getString(path + "UUID")),
|
||||
file.getLong(path + "price"),
|
||||
file.getLong(path + "expire-time"),
|
||||
file.getI(path + "")
|
||||
));
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.badbones69.crazyauctions.api.auctionhouse.objects;
|
||||
|
||||
import com.badbones69.crazyauctions.api.auctionhouse.enums.AuctionType;
|
||||
import com.badbones69.crazyauctions.api.auctionhouse.interfaces.AuctionItem;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BuyingAuction implements AuctionItem {
|
||||
|
||||
AuctionType auctionType = AuctionType.SELL;
|
||||
UUID seller;
|
||||
long price;
|
||||
long expireTime;
|
||||
ItemStack sellingItem;
|
||||
|
||||
public BuyingAuction(UUID seller, long price, long expireTime, ItemStack sellingItem) {
|
||||
this.seller = seller;
|
||||
this.price = price;
|
||||
this.expireTime = expireTime;
|
||||
this.sellingItem = sellingItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuctionType getAuctionType() {
|
||||
return auctionType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getSeller() {
|
||||
return seller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSellingItem() {
|
||||
return sellingItem;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.badbones69.crazyauctions.api.auctionhouse.objects;
|
||||
|
||||
public class InventorySettings {
|
||||
|
||||
private String title;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.badbones69.crazyauctions.api.auctionhouse.objects;
|
||||
|
||||
import com.badbones69.crazyauctions.api.auctionhouse.enums.AuctionType;
|
||||
import com.badbones69.crazyauctions.api.auctionhouse.interfaces.AuctionItem;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class SellingAuction implements AuctionItem {
|
||||
|
||||
AuctionType auctionType = AuctionType.BID;
|
||||
UUID seller;
|
||||
UUID highestBidder;
|
||||
long price;
|
||||
long currentBid;
|
||||
long expireTime;
|
||||
ItemStack sellingItem;
|
||||
|
||||
public SellingAuction(UUID seller, long price, long expireTime, ItemStack sellingItem) {
|
||||
this.seller = seller;
|
||||
this.highestBidder = null;
|
||||
this.price = price;
|
||||
this.currentBid = 0;
|
||||
this.expireTime = expireTime;
|
||||
this.sellingItem = sellingItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuctionType getAuctionType() {
|
||||
return auctionType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getSeller() {
|
||||
return seller;
|
||||
}
|
||||
|
||||
public UUID getHighestBidder() {
|
||||
return highestBidder;
|
||||
}
|
||||
|
||||
public void setHighestBidder(UUID highestBidder) {
|
||||
this.highestBidder = highestBidder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public long getCurrentBid() {
|
||||
return currentBid;
|
||||
}
|
||||
|
||||
public void setCurrentBid(long currentBid) {
|
||||
this.currentBid = currentBid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSellingItem() {
|
||||
return sellingItem;
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.enums.eco;
|
||||
|
||||
public enum AuctionCategory {
|
||||
|
||||
}
|
@ -7,6 +7,10 @@ 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 = true, isData = false, fileType = FileType.YAML)
|
||||
/*@Header("""
|
||||
@ -39,6 +43,10 @@ public class Config extends FileExtension {
|
||||
@Comment("DO NOT TOUCH THIS: We use this to identify if your configs are outdated.")
|
||||
public static double CONFIG_VERSION = 1.0;
|
||||
|
||||
@Key("settings.storage-type")
|
||||
@Comment("Choose what type of storage option for the data to use. FLAT/MYSQL/<TBD>")
|
||||
public static String STORAGE_TYPE = "FLAT";
|
||||
|
||||
public Config() {
|
||||
super("config.yml");
|
||||
}
|
||||
@ -46,4 +54,15 @@ public class Config extends FileExtension {
|
||||
public static void reload(CrazyAuctions plugin) {
|
||||
plugin.getSpigotFileManager().addFile(new Config());
|
||||
}
|
||||
|
||||
public static YamlFile getConfiguration(FileManager fileManager) {
|
||||
try {
|
||||
return fileManager.getFileConfiguration(new Config());
|
||||
} catch (IOException e) {
|
||||
//Error Message goes here
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -5,4 +5,5 @@ settings:
|
||||
|
||||
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.
|
||||
config-version: 1.0 # DO NOT TOUCH THIS: We use this to identify if configs are outdated.
|
||||
storage-type: 'FLAT' #Choose what type of storage option for the data to use. FLAT/MYSQL/<TBD>
|
Loading…
Reference in New Issue
Block a user