mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2025-02-08 00:21:41 +01:00
Remove old code
This commit is contained in:
parent
a6282a9d16
commit
13f7374d0f
@ -1,72 +0,0 @@
|
||||
package com.badbones69.crazyauctions;
|
||||
|
||||
import com.badbones69.crazyauctions.api.CrazyManager;
|
||||
import com.badbones69.crazyauctions.api.FileManager;
|
||||
import com.badbones69.crazyauctions.api.FileManager.Files;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class CrazyAuctions extends JavaPlugin implements Listener {
|
||||
|
||||
private static CrazyAuctions plugin;
|
||||
|
||||
private Starter starter;
|
||||
|
||||
private final FileManager fileManager = getStarter().getFileManager();
|
||||
|
||||
private final CrazyManager crazyManager = getStarter().getCrazyManager();
|
||||
|
||||
private final Methods methods = getStarter().getMethods();
|
||||
|
||||
private boolean isEnabled = false;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
try {
|
||||
plugin = this;
|
||||
|
||||
starter = new Starter();
|
||||
|
||||
starter.run();
|
||||
|
||||
fileManager.setup();
|
||||
|
||||
crazyManager.load();
|
||||
|
||||
// methods.updateAuction();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
isEnabled = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
isEnabled = true;
|
||||
|
||||
enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (!isEnabled) return;
|
||||
|
||||
disable();
|
||||
}
|
||||
|
||||
private void enable() {
|
||||
|
||||
}
|
||||
|
||||
private void disable() {
|
||||
Files.DATA.saveFile();
|
||||
}
|
||||
|
||||
public static CrazyAuctions getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public Starter getStarter() {
|
||||
return starter;
|
||||
}
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
package com.badbones69.crazyauctions;
|
||||
|
||||
import com.badbones69.crazyauctions.api.FileManager.Files;
|
||||
import com.badbones69.crazyauctions.api.enums.Messages;
|
||||
import com.badbones69.crazyauctions.utils.ItemBuilder;
|
||||
import com.badbones69.crazyauctions.utils.func.ServerProtocol;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Methods {
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
public final Pattern HEX_PATTERN = Pattern.compile("#[a-fA-F0-9]{6}");
|
||||
|
||||
public String color(String message) {
|
||||
if (ServerProtocol.isNewer(ServerProtocol.v1_15_R1)) {
|
||||
Matcher matcher = HEX_PATTERN.matcher(message);
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
while (matcher.find()) {
|
||||
matcher.appendReplacement(buffer, net.md_5.bungee.api.ChatColor.of(matcher.group()).toString());
|
||||
}
|
||||
|
||||
return ChatColor.translateAlternateColorCodes('&', matcher.appendTail(buffer).toString());
|
||||
}
|
||||
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return color(Files.CONFIG.getFile().getString("Settings.Prefix", ""));
|
||||
}
|
||||
|
||||
public String getPrefix(String msg) {
|
||||
return color(Files.CONFIG.getFile().getString("Settings.Prefix", "") + msg);
|
||||
}
|
||||
|
||||
public String sanitizeColor(String msg) {
|
||||
return sanitizeFormat(color(msg));
|
||||
}
|
||||
|
||||
public String removeColor(String msg) {
|
||||
return ChatColor.stripColor(msg);
|
||||
}
|
||||
|
||||
public static String sanitizeFormat(String string) {
|
||||
return TextComponent.toLegacyText(TextComponent.fromLegacyText(string));
|
||||
}
|
||||
|
||||
public ItemStack makeItem(Material material, int amount, String name, List<String> lore, HashMap<Enchantment, Integer> enchants) {
|
||||
ItemBuilder newItem = new ItemBuilder().setMaterial(material).setAmount(amount).setName(name).setLore(lore).setEnchantments(enchants);
|
||||
return newItem.build();
|
||||
}
|
||||
|
||||
public ItemStack getItemInHand(Player player) {
|
||||
return player.getInventory().getItemInMainHand();
|
||||
}
|
||||
|
||||
public void setItemInHand(Player player, ItemStack item) {
|
||||
player.getInventory().setItemInMainHand(item);
|
||||
}
|
||||
|
||||
public Player getPlayer(String name) {
|
||||
try {
|
||||
return plugin.getServer().getPlayer(name);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public OfflinePlayer getOfflinePlayer(String name) {
|
||||
return plugin.getServer().getOfflinePlayer(name);
|
||||
}
|
||||
|
||||
public boolean isOnline(String name) {
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
if (player.getName().equalsIgnoreCase(name)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOnline(String name, CommandSender commandSender) {
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
if (player.getName().equalsIgnoreCase(name)) return true;
|
||||
}
|
||||
|
||||
commandSender.sendMessage(Messages.NOT_ONLINE.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasPermission(Player player, String perm) {
|
||||
if (!player.hasPermission("crazyauctions." + perm)) {
|
||||
player.sendMessage(Messages.NO_PERMISSION.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasPermission(CommandSender sender, String perm) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!player.hasPermission("crazyauctions." + perm)) {
|
||||
player.sendMessage(Messages.NO_PERMISSION.getMessage());
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInvFull(Player player) {
|
||||
return player.getInventory().firstEmpty() == -1;
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package com.badbones69.crazyauctions;
|
||||
|
||||
import com.badbones69.crazyauctions.api.CrazyManager;
|
||||
import com.badbones69.crazyauctions.api.FileManager;
|
||||
import com.badbones69.crazyauctions.api.economy.vault.VaultSupport;
|
||||
import com.badbones69.crazyauctions.utils.SkullCreator;
|
||||
|
||||
public class Starter {
|
||||
|
||||
private FileManager fileManager;
|
||||
|
||||
private CrazyManager crazyManager;
|
||||
|
||||
private VaultSupport vaultSupport;
|
||||
|
||||
private Methods methods;
|
||||
|
||||
private SkullCreator skullCreator;
|
||||
|
||||
public void run() {
|
||||
fileManager = new FileManager();
|
||||
crazyManager = new CrazyManager();
|
||||
|
||||
vaultSupport = new VaultSupport();
|
||||
|
||||
methods = new Methods();
|
||||
|
||||
skullCreator = new SkullCreator();
|
||||
}
|
||||
|
||||
public FileManager getFileManager() {
|
||||
return fileManager;
|
||||
}
|
||||
|
||||
public CrazyManager getCrazyManager() {
|
||||
return crazyManager;
|
||||
}
|
||||
|
||||
public VaultSupport getVaultSupport() {
|
||||
return vaultSupport;
|
||||
}
|
||||
|
||||
public Methods getMethods() {
|
||||
return methods;
|
||||
}
|
||||
|
||||
public SkullCreator getSkullCreator() {
|
||||
return skullCreator;
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api;
|
||||
|
||||
import com.badbones69.crazyauctions.api.FileManager.Files;
|
||||
import com.badbones69.crazyauctions.api.enums.ShopCategories;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CrazyManager {
|
||||
|
||||
private Boolean sellingEnabled;
|
||||
private Boolean biddingEnabled;
|
||||
|
||||
public void load() {
|
||||
if (Files.CONFIG.getFile().contains("Settings.Feature-Toggle.Selling")) {
|
||||
this.sellingEnabled = Files.CONFIG.getFile().getBoolean("Settings.Feature-Toggle.Selling");
|
||||
} else {
|
||||
this.sellingEnabled = true;
|
||||
}
|
||||
|
||||
if (Files.CONFIG.getFile().contains("Settings.Feature-Toggle.Bidding")) {
|
||||
this.biddingEnabled = Files.CONFIG.getFile().getBoolean("Settings.Feature-Toggle.Bidding");
|
||||
} else {
|
||||
this.biddingEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean isSellingEnabled() {
|
||||
return sellingEnabled;
|
||||
}
|
||||
|
||||
public Boolean isBiddingEnabled() {
|
||||
return biddingEnabled;
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> getItems(Player player) {
|
||||
FileConfiguration data = Files.DATA.getFile();
|
||||
ArrayList<ItemStack> items = new ArrayList<>();
|
||||
|
||||
if (data.contains("Items")) {
|
||||
for (String i : data.getConfigurationSection("Items").getKeys(false)) {
|
||||
if (data.getString("Items." + i + ".Seller").equalsIgnoreCase(player.getName())) items.add(data.getItemStack("Items." + i + ".Item").clone());
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> getItems(Player player, ShopCategories type) {
|
||||
FileConfiguration data = Files.DATA.getFile();
|
||||
ArrayList<ItemStack> items = new ArrayList<>();
|
||||
|
||||
if (data.contains("Items")) {
|
||||
for (String i : data.getConfigurationSection("Items").getKeys(false)) {
|
||||
if (data.getString("Items." + i + ".Seller").equalsIgnoreCase(player.getName())) {
|
||||
if (data.getBoolean("Items." + i + ".Biddable")) {
|
||||
if (type == ShopCategories.BID) items.add(data.getItemStack("Items." + i + ".Item").clone());
|
||||
} else {
|
||||
if (type == ShopCategories.SELL) items.add(data.getItemStack("Items." + i + ".Item").clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
@ -1,502 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api;
|
||||
|
||||
import com.badbones69.crazyauctions.CrazyAuctions;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author BadBones69
|
||||
* @version v1.0
|
||||
*/
|
||||
public class FileManager {
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
private boolean log = false;
|
||||
|
||||
private final HashMap<Files, File> files = new HashMap<>();
|
||||
private final ArrayList<String> homeFolders = new ArrayList<>();
|
||||
private final ArrayList<CustomFile> customFiles = new ArrayList<>();
|
||||
private final HashMap<String, String> jarHomeFolders = new HashMap<>();
|
||||
private final HashMap<String, String> autoGenerateFiles = new HashMap<>();
|
||||
private final HashMap<Files, FileConfiguration> configurations = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Loads all necessary files.
|
||||
*/
|
||||
public FileManager setup() {
|
||||
if (!plugin.getDataFolder().exists()) plugin.getDataFolder().mkdirs();
|
||||
|
||||
files.clear();
|
||||
customFiles.clear();
|
||||
|
||||
// Loads all the normal static files.
|
||||
for (Files file : Files.values()) {
|
||||
File newFile = new File(plugin.getDataFolder(), file.getFileLocation());
|
||||
|
||||
if (isLogging()) plugin.getLogger().info("Loading the " + file.getFileName());
|
||||
|
||||
if (!newFile.exists()) {
|
||||
try {
|
||||
File serverFile = new File(plugin.getDataFolder(), "/" + file.getFileLocation());
|
||||
InputStream jarFile = getClass().getResourceAsStream("/" + file.getFileJar());
|
||||
copyFile(jarFile, serverFile);
|
||||
} catch (Exception e) {
|
||||
if (isLogging()) plugin.getLogger().info("Failed to load " + file.getFileName());
|
||||
|
||||
e.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
files.put(file, newFile);
|
||||
configurations.put(file, YamlConfiguration.loadConfiguration(newFile));
|
||||
|
||||
if (isLogging()) plugin.getLogger().info("Successfully loaded " + file.getFileName());
|
||||
}
|
||||
|
||||
// Starts to load all the custom files.
|
||||
if (homeFolders.size() > 0) {
|
||||
if (isLogging()) plugin.getLogger().info("Loading custom files.");
|
||||
|
||||
for (String homeFolder : homeFolders) {
|
||||
File homeFile = new File(plugin.getDataFolder(), "/" + homeFolder);
|
||||
|
||||
if (homeFile.exists()) {
|
||||
String[] list = homeFile.list();
|
||||
|
||||
if (list != null) {
|
||||
for (String name : list) {
|
||||
if (name.endsWith(".yml")) {
|
||||
CustomFile file = new CustomFile(name, homeFolder);
|
||||
|
||||
if (file.exists()) {
|
||||
customFiles.add(file);
|
||||
|
||||
if (isLogging()) plugin.getLogger().info("Loaded new custom file: " + homeFolder + "/" + name + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
homeFile.mkdir();
|
||||
if (isLogging()) plugin.getLogger().info("The folder " + homeFolder + "/ was not found so it was created.");
|
||||
|
||||
for (String fileName : autoGenerateFiles.keySet()) {
|
||||
if (autoGenerateFiles.get(fileName).equalsIgnoreCase(homeFolder)) {
|
||||
homeFolder = autoGenerateFiles.get(fileName);
|
||||
|
||||
try {
|
||||
File serverFile = new File(plugin.getDataFolder(), homeFolder + "/" + fileName);
|
||||
InputStream jarFile = getClass().getResourceAsStream(homeFolder + "/" + fileName);
|
||||
copyFile(jarFile, serverFile);
|
||||
|
||||
if (fileName.toLowerCase().endsWith(".yml")) customFiles.add(new CustomFile(fileName, homeFolder));
|
||||
|
||||
if (isLogging()) plugin.getLogger().info("Created new default file: " + homeFolder + "/" + fileName + ".");
|
||||
} catch (Exception e) {
|
||||
if (isLogging()) plugin.getLogger().info("Failed to create new default file: " + homeFolder + "/" + fileName + "!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isLogging()) plugin.getLogger().info("Finished loading custom files.");
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn on the logger system for the FileManager.
|
||||
* @param log True to turn it on and false for it to be off.
|
||||
*/
|
||||
public FileManager setLog(boolean log) {
|
||||
this.log = log;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the logger is logging in console.
|
||||
* @return True if it is and false if it isn't.
|
||||
*/
|
||||
public boolean isLogging() {
|
||||
return log;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a folder that has custom files in it. Make sure to have a "/" in front of the folder name.
|
||||
* @param homeFolder The folder that has custom files in it.
|
||||
*/
|
||||
public FileManager registerCustomFilesFolder(String homeFolder) {
|
||||
homeFolders.add(homeFolder);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister a folder that has custom files in it. Make sure to have a "/" in front of the folder name.
|
||||
* @param homeFolder The folder with custom files in it.
|
||||
*/
|
||||
public FileManager unregisterCustomFilesFolder(String homeFolder) {
|
||||
homeFolders.remove(homeFolder);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a file that needs to be generated when it's home folder doesn't exist. Make sure to have a "/" in front of the home folder's name.
|
||||
* @param fileName The name of the file you want to auto-generate when the folder doesn't exist.
|
||||
* @param homeFolder The folder that has custom files in it.
|
||||
*/
|
||||
public FileManager registerDefaultGenerateFiles(String fileName, String homeFolder) {
|
||||
autoGenerateFiles.put(fileName, homeFolder);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister a file that doesn't need to be generated when it's home folder doesn't exist. Make sure to have a "/" in front of the home folder's name.
|
||||
* @param fileName The file that you want to remove from auto-generating.
|
||||
*/
|
||||
public FileManager unregisterDefaultGenerateFiles(String fileName) {
|
||||
autoGenerateFiles.remove(fileName);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file from the system.
|
||||
* @return The file from the system.
|
||||
*/
|
||||
public FileConfiguration getFile(Files file) {
|
||||
return configurations.get(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a custom file from the loaded custom files instead of a hardcoded one.
|
||||
* This allows you to get custom files like Per player data files.
|
||||
* @param name Name of the crate you want. (Without the .yml)
|
||||
* @return The custom file you wanted otherwise if not found will return null.
|
||||
*/
|
||||
public CustomFile getFile(String name) {
|
||||
for (CustomFile file : customFiles) {
|
||||
if (file.getName().equalsIgnoreCase(name)) return file;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the file from the loaded state to the file system.
|
||||
*/
|
||||
public void saveFile(Files file) {
|
||||
try {
|
||||
configurations.get(file).save(files.get(file));
|
||||
} catch (IOException e) {
|
||||
plugin.getLogger().warning("Could not save " + file.getFileName() + "!");
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a custom file.
|
||||
* @param name The name of the custom file.
|
||||
*/
|
||||
public void saveFile(String name) {
|
||||
CustomFile file = getFile(name);
|
||||
|
||||
if (file != null) {
|
||||
try {
|
||||
file.getFile().save(new File(plugin.getDataFolder(), file.getHomeFolder() + "/" + file.getFileName()));
|
||||
|
||||
if (isLogging()) plugin.getLogger().info("Successfully saved the " + file.getFileName() + ".");
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warning("Could not save " + file.getFileName() + "!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if (isLogging()) plugin.getLogger().warning("The file " + name + ".yml could not be found!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a custom file.
|
||||
* @param file The custom file you are saving.
|
||||
* @return True if the file saved correct and false if there was an error.
|
||||
*/
|
||||
public boolean saveFile(CustomFile file) {
|
||||
return file.saveFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the loaded state file and loads the file systems file.
|
||||
*/
|
||||
public void reloadFile(Files file) {
|
||||
configurations.put(file, YamlConfiguration.loadConfiguration(files.get(file)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the loaded state file and loads the file systems file.
|
||||
*/
|
||||
public void reloadFile(String name) {
|
||||
CustomFile file = getFile(name);
|
||||
|
||||
if (file != null) {
|
||||
try {
|
||||
file.file = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "/" + file.getHomeFolder() + "/" + file.getFileName()));
|
||||
|
||||
if (isLogging()) plugin.getLogger().info("Successfully reloaded the " + file.getFileName() + ".");
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warning("Could not reload the " + file.getFileName() + "!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if (isLogging()) plugin.getLogger().warning("The file " + name + ".yml could not be found!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the loaded state file and loads the filesystems file.
|
||||
* @return True if it reloaded correct and false if the file wasn't found.
|
||||
*/
|
||||
public boolean reloadFile(CustomFile file) {
|
||||
return file.reloadFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Was found here: <a href="https://bukkit.org/threads/extracting-file-from-jar.16962">...</a>
|
||||
*/
|
||||
private void copyFile(InputStream in, File out) throws Exception {
|
||||
try (InputStream fis = in; FileOutputStream fos = new FileOutputStream(out)) {
|
||||
byte[] buf = new byte[1024];
|
||||
int i;
|
||||
|
||||
while ((i = fis.read(buf)) != -1) {
|
||||
fos.write(buf, 0, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void reloadAllFiles() {
|
||||
for (Files file : Files.values()) {
|
||||
file.reloadFile();
|
||||
}
|
||||
|
||||
for (CustomFile file : customFiles) {
|
||||
file.reloadFile();
|
||||
}
|
||||
}
|
||||
|
||||
public enum Files {
|
||||
|
||||
// ENUM_NAME("fileName.yml", "fileLocation.yml"),
|
||||
// ENUM_NAME("fileName.yml", "newFileLocation.yml", "oldFileLocation.yml"),
|
||||
CONFIG("config.yml", "config.yml"),
|
||||
DATA("data.yml", "data.yml"),
|
||||
MESSAGES("messages.yml", "messages.yml"),
|
||||
TEST_FILE("test-file.yml", "test-file.yml");
|
||||
|
||||
private final String fileName;
|
||||
private final String fileJar;
|
||||
private final String fileLocation;
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
private final FileManager fileManager = plugin.getStarter().getFileManager();
|
||||
|
||||
/**
|
||||
* The files that the server will try and load.
|
||||
* @param fileName The file name that will be in the plugin's folder.
|
||||
* @param fileLocation The location the file in the plugin's folder.
|
||||
*/
|
||||
Files(String fileName, String fileLocation) {
|
||||
this(fileName, fileLocation, fileLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* The files that the server will try and load.
|
||||
* @param fileName The file name that will be in the plugin's folder.
|
||||
* @param fileLocation The location of the file will be in the plugin's folder.
|
||||
* @param fileJar The location of the file in the jar.
|
||||
*/
|
||||
Files(String fileName, String fileLocation, String fileJar) {
|
||||
this.fileName = fileName;
|
||||
this.fileLocation = fileLocation;
|
||||
this.fileJar = fileJar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the file.
|
||||
* @return The name of the file.
|
||||
*/
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* The location the jar it is at.
|
||||
* @return The location in the jar the file is in.
|
||||
*/
|
||||
public String getFileLocation() {
|
||||
return fileLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the location of the file in the jar.
|
||||
* @return The location of the file in the jar.
|
||||
*/
|
||||
public String getFileJar() {
|
||||
return fileJar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file from the system.
|
||||
* @return The file from the system.
|
||||
*/
|
||||
public FileConfiguration getFile() {
|
||||
return fileManager.getFile(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the file from the loaded state to the file system.
|
||||
*/
|
||||
public void saveFile() {
|
||||
fileManager.saveFile(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the loaded state file and loads the file systems file.
|
||||
*/
|
||||
public void reloadFile() {
|
||||
fileManager.reloadFile(this);
|
||||
}
|
||||
}
|
||||
|
||||
public class CustomFile {
|
||||
|
||||
private final String name;
|
||||
private final String fileName;
|
||||
private final String homeFolder;
|
||||
private FileConfiguration file;
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
/**
|
||||
* A custom file that is being made.
|
||||
* @param name Name of the file.
|
||||
* @param homeFolder The home folder of the file.
|
||||
*/
|
||||
public CustomFile(String name, String homeFolder) {
|
||||
this.name = name.replace(".yml", "");
|
||||
this.fileName = name;
|
||||
this.homeFolder = homeFolder;
|
||||
|
||||
if (new File(plugin.getDataFolder(), "/" + homeFolder).exists()) {
|
||||
if (new File(plugin.getDataFolder(), "/" + homeFolder + "/" + name).exists()) {
|
||||
file = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "/" + homeFolder + "/" + name));
|
||||
} else {
|
||||
file = null;
|
||||
}
|
||||
} else {
|
||||
new File(plugin.getDataFolder(), "/" + homeFolder).mkdir();
|
||||
|
||||
if (isLogging()) plugin.getLogger().info("The folder " + homeFolder + "/ was not found so it was created.");
|
||||
|
||||
file = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the file without the .yml part.
|
||||
* @return The name of the file without the .yml.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full name of the file.
|
||||
* @return Full name of the file.
|
||||
*/
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the home folder of the file.
|
||||
* @return The name of the home folder the files are in.
|
||||
*/
|
||||
public String getHomeFolder() {
|
||||
return homeFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ConfigurationFile.
|
||||
* @return The ConfigurationFile of this file.
|
||||
*/
|
||||
public FileConfiguration getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the file actually exists in the file system.
|
||||
* @return True if it does and false if it doesn't.
|
||||
*/
|
||||
public Boolean exists() {
|
||||
return file != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the custom file.
|
||||
* @return True if it saved correct and false if something went wrong.
|
||||
*/
|
||||
public Boolean saveFile() {
|
||||
if (file != null) {
|
||||
try {
|
||||
file.save(new File(plugin.getDataFolder(), homeFolder + "/" + fileName));
|
||||
|
||||
if (isLogging()) plugin.getLogger().info("Successfully saved the " + fileName + ".");
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warning("Could not save " + fileName + "!");
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (isLogging()) plugin.getLogger().warning("There was a null custom file that could not be found!");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the loaded state file and loads the filesystems file.
|
||||
* @return True if it reloaded correct and false if the file wasn't found or error.
|
||||
*/
|
||||
public Boolean reloadFile() {
|
||||
if (file != null) {
|
||||
try {
|
||||
file = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "/" + homeFolder + "/" + fileName));
|
||||
|
||||
if (isLogging()) plugin.getLogger().info("Successfully reloaded the " + fileName + ".");
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warning("Could not reload the " + fileName + "!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if (isLogging()) plugin.getLogger().warning("There was a null custom file that was not found!");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.economy;
|
||||
|
||||
public enum Currency {
|
||||
|
||||
VAULT("Vault"),
|
||||
XP_LEVEL("XP_Level"),
|
||||
XP_TOTAL("XP_Total");
|
||||
|
||||
private final String name;
|
||||
|
||||
Currency(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if it is a compatible currency.
|
||||
* @param currency The currency name you are checking.
|
||||
* @return True if it is supported and false if not.
|
||||
*/
|
||||
public static boolean isCurrency(String currency) {
|
||||
for (Currency value : Currency.values()) {
|
||||
if (currency.equalsIgnoreCase(value.getName())) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a currency enum.
|
||||
* @param currency The currency you want.
|
||||
* @return The currency enum.
|
||||
*/
|
||||
public static Currency getCurrency(String currency) {
|
||||
for (Currency value : Currency.values()) {
|
||||
if (currency.equalsIgnoreCase(value.getName())) return value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the currency.
|
||||
* @return The name of the currency.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
@ -1,158 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.economy;
|
||||
|
||||
import com.badbones69.crazyauctions.CrazyAuctions;
|
||||
import com.badbones69.crazyauctions.api.economy.vault.VaultSupport;
|
||||
import com.badbones69.crazyauctions.api.enums.ShopCategories;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CurrencyAPI {
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
private final VaultSupport vaultSupport = plugin.getStarter().getVaultSupport();
|
||||
|
||||
/**
|
||||
* Get the amount that a player has from a specific currency.
|
||||
* @param player The player you wish to get the amount from.
|
||||
* @param currency The currency you wish to get from.
|
||||
* @return The amount that the player has of that currency.
|
||||
*/
|
||||
public int getCurrency(Player player, Currency currency) {
|
||||
try {
|
||||
switch (currency) {
|
||||
case VAULT:
|
||||
vaultSupport.getVault().getBalance(player);
|
||||
break;
|
||||
case XP_LEVEL:
|
||||
player.getLevel();
|
||||
break;
|
||||
case XP_TOTAL:
|
||||
getTotalExperience(player);
|
||||
break;
|
||||
}
|
||||
} catch (Exception | NoClassDefFoundError ignored) {}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Take an amount from a player's currency.
|
||||
* @param player The player you wish to take from.
|
||||
* @param option The ShopOption you wish to use.
|
||||
*/
|
||||
public void takeCurrency(Player player, ShopCategories option) {
|
||||
// takeCurrency(player, option.getCurrency(), option.getCost());
|
||||
}
|
||||
|
||||
/**
|
||||
* Take an amount from a player's currency.
|
||||
* @param player The player you wish to take from.
|
||||
* @param currency The currency you wish to use.
|
||||
* @param amount The amount you want to take.
|
||||
*/
|
||||
public void takeCurrency(Player player, Currency currency, int amount) {
|
||||
try {
|
||||
switch (currency) {
|
||||
case VAULT:
|
||||
vaultSupport.getVault().withdrawPlayer(player, amount);
|
||||
break;
|
||||
case XP_LEVEL:
|
||||
player.setLevel(player.getLevel() - amount);
|
||||
break;
|
||||
case XP_TOTAL:
|
||||
takeTotalExperience(player, amount);
|
||||
break;
|
||||
}
|
||||
} catch (Exception | NoClassDefFoundError ignored) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Give an amount to a player's currency.
|
||||
* @param player The player you are giving to.
|
||||
* @param currency The currency you want to use.
|
||||
* @param amount The amount you are giving to the player.
|
||||
*/
|
||||
public void giveCurrency(Player player, Currency currency, int amount) {
|
||||
try {
|
||||
switch (currency) {
|
||||
case VAULT:
|
||||
vaultSupport.getVault().depositPlayer(player, amount);
|
||||
break;
|
||||
case XP_LEVEL:
|
||||
player.setLevel(player.getLevel() + amount);
|
||||
break;
|
||||
case XP_TOTAL:
|
||||
takeTotalExperience(player, -amount);
|
||||
break;
|
||||
}
|
||||
} catch (Exception | NoClassDefFoundError ignored) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has enough of a currency.
|
||||
* @param player The player you are checking.
|
||||
* @param option The ShopOption you wish to check.
|
||||
* @return True if they have enough to buy it or false if they don't.
|
||||
*/
|
||||
public boolean canBuy(Player player, ShopCategories option) {
|
||||
return canBuy(player, option.getCurrency(), option.getCost());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has enough of a currency.
|
||||
* @param player The player you are checking.
|
||||
* @param currency The currency you wish to check.
|
||||
* @param cost The cost of the item you are checking.
|
||||
* @return True if they have enough to buy it or false if they don't.
|
||||
*/
|
||||
public boolean canBuy(Player player, Currency currency, int cost) {
|
||||
return getCurrency(player, currency) >= cost;
|
||||
}
|
||||
|
||||
private void takeTotalExperience(Player player, int amount) {
|
||||
int total = getTotalExperience(player) - amount;
|
||||
player.setTotalExperience(0);
|
||||
player.setTotalExperience(total);
|
||||
player.setLevel(0);
|
||||
player.setExp(0);
|
||||
|
||||
while (total > player.getExpToLevel()) {
|
||||
total -= player.getExpToLevel();
|
||||
player.setLevel(player.getLevel() + 1);
|
||||
}
|
||||
|
||||
float xp = (float) total / (float) player.getExpToLevel();
|
||||
player.setExp(xp);
|
||||
}
|
||||
|
||||
private int getTotalExperience(Player player) { // https://www.spigotmc.org/threads/72804
|
||||
int experience;
|
||||
int level = player.getLevel();
|
||||
|
||||
if (level >= 0 && level <= 15) {
|
||||
experience = (int) Math.ceil(Math.pow(level, 2) + (6 * level));
|
||||
int requiredExperience = 2 * level + 7;
|
||||
double currentExp = Double.parseDouble(Float.toString(player.getExp()));
|
||||
experience += Math.ceil(currentExp * requiredExperience);
|
||||
return experience;
|
||||
} else if (level > 15 && level <= 30) {
|
||||
experience = (int) Math.ceil((2.5 * Math.pow(level, 2) - (40.5 * level) + 360));
|
||||
int requiredExperience = 5 * level - 38;
|
||||
double currentExp = Double.parseDouble(Float.toString(player.getExp()));
|
||||
experience += Math.ceil(currentExp * requiredExperience);
|
||||
return experience;
|
||||
} else {
|
||||
experience = (int) Math.ceil((4.5 * Math.pow(level, 2) - (162.5 * level) + 2220));
|
||||
int requiredExperience = 9 * level - 158;
|
||||
double currentExp = Double.parseDouble(Float.toString(player.getExp()));
|
||||
experience += Math.ceil(currentExp * requiredExperience);
|
||||
return experience;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the vault currency if it is on the server.
|
||||
*/
|
||||
public void loadCurrency() {
|
||||
vaultSupport.loadVault();
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.economy.vault;
|
||||
|
||||
import com.badbones69.crazyauctions.CrazyAuctions;
|
||||
import com.badbones69.crazyauctions.utils.func.PluginSupport;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class VaultSupport {
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
private Economy vault = null;
|
||||
|
||||
public Economy getVault() {
|
||||
return vault;
|
||||
}
|
||||
|
||||
public void loadVault() {
|
||||
if (PluginSupport.VAULT.isPluginLoaded()) {
|
||||
RegisteredServiceProvider<Economy> rsp = plugin.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
|
||||
if (rsp != null) vault = rsp.getProvider();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,207 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.enums;
|
||||
|
||||
import com.badbones69.crazyauctions.utils.func.ServerProtocol;
|
||||
import org.bukkit.Material;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public enum AuctionCategories {
|
||||
|
||||
NONE("None", new ArrayList<>()),
|
||||
OTHER("Other", getOthers()),
|
||||
ARMOR("Armor", getArmor()),
|
||||
WEAPONS("Weapons", getWeapons()),
|
||||
TOOLS("Tools", getTools()),
|
||||
FOOD("Food", getFood()),
|
||||
POTIONS("Potions", getPotions()),
|
||||
BLOCKS("Blocks", getBlocks());
|
||||
|
||||
private final String name;
|
||||
private final ArrayList<Material> items;
|
||||
|
||||
/**
|
||||
* @param name Name of the Shop Type.
|
||||
*/
|
||||
AuctionCategories(String name, ArrayList<Material> items) {
|
||||
this.name = name;
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name Name of the Type you want.
|
||||
* @return Returns the Type as an Enum.
|
||||
*/
|
||||
public static AuctionCategories getFromName(String name) {
|
||||
for (AuctionCategories type : AuctionCategories.values()) {
|
||||
if (type.getName().equalsIgnoreCase(name)) return type;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static ArrayList<Material> getArmor() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
ma.add(Material.LEATHER_HELMET);
|
||||
ma.add(Material.LEATHER_CHESTPLATE);
|
||||
ma.add(Material.LEATHER_LEGGINGS);
|
||||
ma.add(Material.LEATHER_BOOTS);
|
||||
|
||||
ma.add(Material.GOLDEN_HELMET);
|
||||
ma.add(Material.GOLDEN_CHESTPLATE);
|
||||
ma.add(Material.GOLDEN_LEGGINGS);
|
||||
ma.add(Material.GOLDEN_BOOTS);
|
||||
|
||||
ma.add(Material.CHAINMAIL_HELMET);
|
||||
ma.add(Material.CHAINMAIL_CHESTPLATE);
|
||||
ma.add(Material.CHAINMAIL_LEGGINGS);
|
||||
ma.add(Material.CHAINMAIL_BOOTS);
|
||||
|
||||
ma.add(Material.IRON_HELMET);
|
||||
ma.add(Material.IRON_CHESTPLATE);
|
||||
ma.add(Material.IRON_LEGGINGS);
|
||||
ma.add(Material.IRON_BOOTS);
|
||||
|
||||
ma.add(Material.DIAMOND_HELMET);
|
||||
ma.add(Material.DIAMOND_CHESTPLATE);
|
||||
ma.add(Material.DIAMOND_LEGGINGS);
|
||||
ma.add(Material.DIAMOND_BOOTS);
|
||||
|
||||
ma.add(Material.TURTLE_HELMET);
|
||||
|
||||
if (ServerProtocol.isNewer(ServerProtocol.v1_15_R1)) {
|
||||
ma.add(Material.NETHERITE_HELMET);
|
||||
ma.add(Material.NETHERITE_CHESTPLATE);
|
||||
ma.add(Material.NETHERITE_LEGGINGS);
|
||||
ma.add(Material.NETHERITE_BOOTS);
|
||||
}
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
private static ArrayList<Material> getTools() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
ma.add(Material.WOODEN_PICKAXE);
|
||||
ma.add(Material.WOODEN_AXE);
|
||||
ma.add(Material.WOODEN_SHOVEL);
|
||||
ma.add(Material.WOODEN_HOE);
|
||||
|
||||
ma.add(Material.STONE_PICKAXE);
|
||||
ma.add(Material.STONE_AXE);
|
||||
ma.add(Material.STONE_SHOVEL);
|
||||
ma.add(Material.STONE_HOE);
|
||||
|
||||
ma.add(Material.GOLDEN_PICKAXE);
|
||||
ma.add(Material.GOLDEN_AXE);
|
||||
ma.add(Material.GOLDEN_SHOVEL);
|
||||
ma.add(Material.GOLDEN_HOE);
|
||||
|
||||
ma.add(Material.IRON_PICKAXE);
|
||||
ma.add(Material.IRON_AXE);
|
||||
ma.add(Material.IRON_SHOVEL);
|
||||
ma.add(Material.IRON_HOE);
|
||||
|
||||
ma.add(Material.DIAMOND_PICKAXE);
|
||||
ma.add(Material.DIAMOND_AXE);
|
||||
ma.add(Material.DIAMOND_SHOVEL);
|
||||
ma.add(Material.DIAMOND_HOE);
|
||||
|
||||
ma.add(Material.SHEARS);
|
||||
ma.add(Material.FISHING_ROD);
|
||||
ma.add(Material.FLINT_AND_STEEL);
|
||||
ma.add(Material.SPYGLASS);
|
||||
|
||||
if (ServerProtocol.isNewer(ServerProtocol.v1_15_R1)) {
|
||||
ma.add(Material.NETHERITE_PICKAXE);
|
||||
ma.add(Material.NETHERITE_AXE);
|
||||
ma.add(Material.NETHERITE_HOE);
|
||||
ma.add(Material.NETHERITE_SHOVEL);
|
||||
}
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
private static ArrayList<Material> getWeapons() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
ma.add(Material.WOODEN_SWORD);
|
||||
ma.add(Material.WOODEN_AXE);
|
||||
|
||||
ma.add(Material.STONE_SWORD);
|
||||
ma.add(Material.STONE_AXE);
|
||||
|
||||
ma.add(Material.GOLDEN_SWORD);
|
||||
ma.add(Material.GOLDEN_AXE);
|
||||
|
||||
ma.add(Material.IRON_SWORD);
|
||||
ma.add(Material.IRON_AXE);
|
||||
|
||||
ma.add(Material.DIAMOND_SWORD);
|
||||
ma.add(Material.DIAMOND_AXE);
|
||||
|
||||
ma.add(Material.BOW);
|
||||
ma.add(Material.CROSSBOW);
|
||||
ma.add(Material.TRIDENT);
|
||||
|
||||
if (ServerProtocol.isNewer(ServerProtocol.v1_15_R1)) {
|
||||
ma.add(Material.NETHERITE_SWORD);
|
||||
ma.add(Material.NETHERITE_AXE);
|
||||
}
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
private static ArrayList<Material> getFood() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
for (Material m : Material.values()) {
|
||||
if (m.isEdible()) {
|
||||
if (m != Material.POTION) ma.add(m);
|
||||
}
|
||||
}
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
private static ArrayList<Material> getPotions() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
ma.add(Material.POTION);
|
||||
|
||||
if (Material.matchMaterial("SPLASH_POTION") != null) ma.add(Material.matchMaterial("SPLASH_POTION"));
|
||||
|
||||
if (Material.matchMaterial("LINGERING_POTION") != null) ma.add(Material.matchMaterial("LINGERING_POTION"));
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
private static ArrayList<Material> getBlocks() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
for (Material m : Material.values()) {
|
||||
if (m.isBlock()) ma.add(m);
|
||||
}
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
private static ArrayList<Material> getOthers() {
|
||||
ArrayList<Material> ma = new ArrayList<>();
|
||||
|
||||
for (Material m : Material.values()) {
|
||||
if (!(getArmor().contains(m) || getTools().contains(m) || getWeapons().contains(m) || getFood().contains(m) || getPotions().contains(m) || getBlocks().contains(m))) ma.add(m);
|
||||
}
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the type name as a string.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ArrayList<Material> getItems() {
|
||||
return items;
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.enums;
|
||||
|
||||
public enum CancelledReason {
|
||||
|
||||
/**
|
||||
* Cancelled by an administrator.
|
||||
*/
|
||||
ADMIN_FORCE_CANCEL(),
|
||||
/**
|
||||
* Cancelled by the player them self.
|
||||
*/
|
||||
PLAYER_FORCE_CANCEL()
|
||||
}
|
@ -1,215 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.enums;
|
||||
|
||||
import com.badbones69.crazyauctions.CrazyAuctions;
|
||||
import com.badbones69.crazyauctions.Methods;
|
||||
import com.badbones69.crazyauctions.api.FileManager;
|
||||
import com.badbones69.crazyauctions.api.FileManager.Files;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public enum Messages {
|
||||
|
||||
PLAYERS_ONLY("Players-Only", "&cOnly players can use this command."),
|
||||
RELOAD("Reload", "&7You have just reloaded the Crazy Auctions Files."),
|
||||
NEED_MORE_MONEY("Need-More-Money", "&cYou are in need of &a$%money_needed%&c."),
|
||||
INVENTORY_FULL("Inventory-Full", "&cYour inventory is too full. Please open up some space to buy that."),
|
||||
NO_PERMISSION("No-Permission", "&cYou do not have permission to use that command!"),
|
||||
NOT_ONLINE("Not-Online", "&cThat player is not online at this time."),
|
||||
DOSENT_HAVE_ITEM_IN_HAND("Doesnt-Have-Item-In-Hand", "&cYou must have an item in your hand."),
|
||||
NOT_A_NUMBER("Not-A-Number", "&c%arg% is not a number."),
|
||||
GOT_ITEM_BACK("Got-Item-Back", "&7Your item has been returned."),
|
||||
CANCELLED_ITEM("Cancelled-Item", "&7You have cancelled an item on the auction list, return your items with /ah expired."),
|
||||
ITEM_HAS_EXPIRED("Item-Has-Expired", "&7An item you have in the Crazy Auctions has just expired."),
|
||||
ADMIN_FORCE_CENCELLED("Admin-Force-Cancelled", "&7You have just force cancelled a sale."),
|
||||
ADMIN_FORCE_CANCELLED_TO_PLAYER("Admin-Force-Cancelled-To-Player", "&cOne of your items was just force cancelled by an Admin."),
|
||||
ITEM_DOESNT_EXIST("Item-Doesnt-Exist", "&cThat item isnt in the crazy auctions any more."),
|
||||
MAX_ITEMS("Max-Items", "&cYou cant list any more items to the Crazy Auctions."),
|
||||
ITEM_BLACKLISTED("Item-BlackListed", "&cThat item is not allowed to be sold here."),
|
||||
ITEM_DAMAGED("Item-Damaged", "&cThat item is damaged and is not allowed to be sold here."),
|
||||
SOLD_MESSAGE("Sold-Msg", "&7Thank you for buying this item."),
|
||||
BID_MORE_MONEY("Bid-More-Money", "&cYour bid is to low, please bid more."),
|
||||
NOT_A_CURRENCY("Not-A-Currency", "&cThat is not a currency. Please use Money or Tokens ."),
|
||||
SELL_PRICE_TO_LOW("Sell-Price-To-Low", "&cYour sell price is to low the minimum is &a$10&c."),
|
||||
SELL_PRICE_TO_HIGH("Sell-Price-To-High", "&cYour sell price is to high the maximum is &a$1000000&c."),
|
||||
BID_PRICE_TO_LOW("Bid-Price-To-Low", "&cYour starting bid price is to low the minimum is &a$100&c."),
|
||||
BID_PRICE_TO_HIGH("Bid-Price-To-High", "&cYour starting bid price is to high the maximum is &a$1000000&c."),
|
||||
BOUGHT_ITEM("Bought-Item", "&7You have just bought a item for &a$%price%&7."),
|
||||
WIN_BIDDING("Win-Bidding", "&7You have just won a bid for &a$%price%&7. Do /Ah Collect to collect your winnings."),
|
||||
PLAYER_BOUGHT_ITEM("Player-Bought-Item", "&7%player% has bought your item for &a$%price%."),
|
||||
SOMEONE_WON_PLAYERS_BID("Someone-Won-Players-Bid", "&7%player% has won your item you from a bid for &a$%price%."),
|
||||
ADDED_ITEM_TO_AUCTION("Added-Item-To-Auction", "&7You have just added a item to the crazy auctions for &a$%price%&7."),
|
||||
BID_MESSAGE("Bid-Msg", "&7You have just bid &a$%Bid% &7on that item."),
|
||||
SELLING_DISABLED("Selling-Disabled", "&cThe selling option is disabled."),
|
||||
BIDDING_DISABLED("Bidding-Disabled", "&cThe bidding option is disabled."),
|
||||
CRAZYAUCTIONS_HELP("CrazyAuctions-Help", "&c/ah help"),
|
||||
CRAZYAUCTIONS_VIEW("CrazyAuctions-View", "&c/ah view <player>"),
|
||||
CRAZYAUCTIONS_SELL_BID("CrazyAuctions-Sell-Bid", "&c/ah sell/bid <price> [amount of items]"),
|
||||
BOOK_NOT_ALLOWED("Book-Not-Allowed", "&cThat book is not able to be sold in this auction house!"),
|
||||
HELP("Help-Menu", Arrays.asList(
|
||||
"&e-- &6Crazy Auctions Help &e--",
|
||||
"&9/Ah - &eOpens the crazy auction.",
|
||||
"&9/Ah View <Player> - &eSee what a player is selling.",
|
||||
"&9/Ah Sell/Bid <Price> [Amount of items] - &eList the item you are holding on the crazy auction.",
|
||||
"&9/Ah Expired/Collect - &eView and manage your cancelled and expired items.",
|
||||
"&9/Ah Listed - &eView and manage the items you are selling.",
|
||||
"&9/Ah Help - &eView this help menu."));
|
||||
private final String path;
|
||||
private String defaultMessage;
|
||||
private List<String> defaultListMessage;
|
||||
|
||||
private static final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
private static final Methods methods = plugin.getStarter().getMethods();
|
||||
|
||||
Messages(String path, String defaultMessage) {
|
||||
this.path = path;
|
||||
this.defaultMessage = defaultMessage;
|
||||
}
|
||||
|
||||
Messages(String path, List<String> defaultListMessage) {
|
||||
this.path = path;
|
||||
this.defaultListMessage = defaultListMessage;
|
||||
}
|
||||
|
||||
public static String convertList(List<String> list) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
|
||||
for (String m : list) {
|
||||
message.append(methods.color(m)).append("\n");
|
||||
}
|
||||
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
public static String convertList(List<String> list, HashMap<String, String> placeholders) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
for (String m : list) {
|
||||
message.append(methods.color(m)).append("\n");
|
||||
}
|
||||
|
||||
for (String ph : placeholders.keySet()) {
|
||||
message = new StringBuilder(methods.color(message.toString().replace(ph, placeholders.get(ph))).replace(ph, placeholders.get(ph).toLowerCase()));
|
||||
}
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
public static void addMissingMessages() {
|
||||
FileConfiguration messages = Files.MESSAGES.getFile();
|
||||
boolean saveFile = false;
|
||||
|
||||
for (Messages message : values()) {
|
||||
if (!messages.contains("Messages." + message.getPath())) {
|
||||
saveFile = true;
|
||||
|
||||
if (message.getDefaultMessage() != null) {
|
||||
messages.set("Messages." + message.getPath(), message.getDefaultMessage());
|
||||
} else {
|
||||
messages.set("Messages." + message.getPath(), message.getDefaultListMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (saveFile) Files.MESSAGES.saveFile();
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
if (isList()) {
|
||||
if (exists()) {
|
||||
return methods.color(convertList(Files.MESSAGES.getFile().getStringList("Messages." + path)));
|
||||
} else {
|
||||
return methods.color(convertList(getDefaultListMessage()));
|
||||
}
|
||||
} else {
|
||||
if (exists()) {
|
||||
return methods.getPrefix(Files.MESSAGES.getFile().getString("Messages." + path));
|
||||
} else {
|
||||
return methods.getPrefix(getDefaultMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessage(HashMap<String, String> placeholders) {
|
||||
String message;
|
||||
if (isList()) {
|
||||
if (exists()) {
|
||||
message = methods.color(convertList(Files.MESSAGES.getFile().getStringList("Messages." + path), placeholders));
|
||||
} else {
|
||||
message = methods.color(convertList(getDefaultListMessage(), placeholders));
|
||||
}
|
||||
} else {
|
||||
if (exists()) {
|
||||
message = methods.getPrefix(Files.MESSAGES.getFile().getString("Messages." + path));
|
||||
} else {
|
||||
message = methods.getPrefix(getDefaultMessage());
|
||||
}
|
||||
for (String ph : placeholders.keySet()) {
|
||||
if (message.contains(ph)) message = message.replace(ph, placeholders.get(ph)).replace(ph, placeholders.get(ph).toLowerCase());
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
public String getMessageNoPrefix() {
|
||||
if (isList()) {
|
||||
if (exists()) {
|
||||
return methods.color(convertList(Files.MESSAGES.getFile().getStringList("Messages." + path)));
|
||||
} else {
|
||||
return methods.color(convertList(getDefaultListMessage()));
|
||||
}
|
||||
} else {
|
||||
if (exists()) {
|
||||
return methods.color(Files.MESSAGES.getFile().getString("Messages." + path));
|
||||
} else {
|
||||
return methods.color(getDefaultMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessageNoPrefix(HashMap<String, String> placeholders) {
|
||||
String message;
|
||||
if (isList()) {
|
||||
if (exists()) {
|
||||
message = methods.color(convertList(Files.MESSAGES.getFile().getStringList("Messages." + path), placeholders));
|
||||
} else {
|
||||
message = methods.color(convertList(getDefaultListMessage(), placeholders));
|
||||
}
|
||||
} else {
|
||||
if (exists()) {
|
||||
message = methods.color(Files.MESSAGES.getFile().getString("Messages." + path));
|
||||
} else {
|
||||
message = methods.color(getDefaultMessage());
|
||||
}
|
||||
for (String ph : placeholders.keySet()) {
|
||||
if (message.contains(ph)) message = message.replace(ph, placeholders.get(ph)).replace(ph, placeholders.get(ph).toLowerCase());
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
private Boolean exists() {
|
||||
return Files.MESSAGES.getFile().contains("Messages." + path);
|
||||
}
|
||||
|
||||
private Boolean isList() {
|
||||
if (Files.MESSAGES.getFile().contains("Messages." + path)) {
|
||||
return !Files.MESSAGES.getFile().getStringList("Messages." + path).isEmpty();
|
||||
} else {
|
||||
return defaultMessage == null;
|
||||
}
|
||||
}
|
||||
|
||||
private String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
private String getDefaultMessage() {
|
||||
return defaultMessage;
|
||||
}
|
||||
|
||||
private List<String> getDefaultListMessage() {
|
||||
return defaultListMessage;
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.enums;
|
||||
|
||||
import com.badbones69.crazyauctions.api.economy.Currency;
|
||||
import com.badbones69.crazyauctions.utils.ItemBuilder;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public enum ShopCategories {
|
||||
|
||||
SELL("Sell"),
|
||||
BID("Bid");
|
||||
|
||||
private final String name;
|
||||
|
||||
private final HashMap<ShopCategories, Options> shopCategories = new HashMap<>();
|
||||
|
||||
/**
|
||||
* @param name name of the Shop Type.
|
||||
*/
|
||||
ShopCategories(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name name of the Type you want.
|
||||
* @return Returns the Type as an Enum.
|
||||
*/
|
||||
public static ShopCategories getFromName(String name) {
|
||||
for (ShopCategories type : ShopCategories.values()) {
|
||||
if (type.getName().equalsIgnoreCase(name)) return type;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Currency getCurrency() {
|
||||
return shopCategories.get(this).currency;
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return shopCategories.get(this).cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the type name as a string.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
private static class Options {
|
||||
|
||||
private final ItemBuilder itemBuilder;
|
||||
|
||||
private final int slot;
|
||||
private final boolean inMenu;
|
||||
private int cost;
|
||||
private final Currency currency;
|
||||
|
||||
public Options(ItemBuilder itemBuilder, int slot, boolean inMenu, int cost, Currency currency) {
|
||||
this.itemBuilder = itemBuilder;
|
||||
this.slot = slot;
|
||||
this.inMenu = inMenu;
|
||||
this.cost = cost;
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
public ItemBuilder getItemBuilder() {
|
||||
return itemBuilder;
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public Currency getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
public boolean isInMenu() {
|
||||
return inMenu;
|
||||
}
|
||||
|
||||
public void setCost(int cost) {
|
||||
this.cost = cost;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author BadBones69
|
||||
*
|
||||
* This event is fired when a player buys something from the selling auction house.
|
||||
*/
|
||||
public class AuctionBuyEvent extends Event {
|
||||
|
||||
private final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
private final long price;
|
||||
private final ItemStack item;
|
||||
|
||||
/**
|
||||
* @param player The player who bought the item.
|
||||
* @param item The item that was bought.
|
||||
* @param price The price of the item.
|
||||
*/
|
||||
public AuctionBuyEvent(Player player, ItemStack item, long price) {
|
||||
this.player = player;
|
||||
this.item = item;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public long getPrice() {
|
||||
return price;
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.events;
|
||||
|
||||
import com.badbones69.crazyauctions.api.enums.CancelledReason;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author BadBones69
|
||||
*
|
||||
* This event is fired when a player's item is cancelled.
|
||||
*/
|
||||
public class AuctionCancelledEvent extends Event {
|
||||
|
||||
private final HandlerList handlers = new HandlerList();
|
||||
private OfflinePlayer offlinePlayer;
|
||||
private Player onlinePlayer;
|
||||
private final boolean isOnline;
|
||||
private final ItemStack item;
|
||||
private final CancelledReason reason;
|
||||
|
||||
/**
|
||||
* @param offlinePlayer The player whose item is cancelled.
|
||||
* @param item The item that is cancelled.
|
||||
*/
|
||||
public AuctionCancelledEvent(OfflinePlayer offlinePlayer, ItemStack item, CancelledReason reason) {
|
||||
this.offlinePlayer = offlinePlayer;
|
||||
this.item = item;
|
||||
this.isOnline = false;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param onlinePlayer The player whose item is cancelled.
|
||||
* @param item The item that is cancelled.
|
||||
*/
|
||||
public AuctionCancelledEvent(Player onlinePlayer, ItemStack item, CancelledReason reason) {
|
||||
this.onlinePlayer = onlinePlayer;
|
||||
this.item = item;
|
||||
this.isOnline = true;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public OfflinePlayer getOfflinePlayer() {
|
||||
return offlinePlayer;
|
||||
}
|
||||
|
||||
public Player getOnlinePlayer() {
|
||||
return onlinePlayer;
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
return isOnline;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public CancelledReason getReason() {
|
||||
return reason;
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.events;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author BadBones69
|
||||
*
|
||||
* This event is fired when a player item expires.
|
||||
*/
|
||||
public class AuctionExpireEvent extends Event {
|
||||
|
||||
private final HandlerList handlers = new HandlerList();
|
||||
private OfflinePlayer offlinePlayer;
|
||||
private Player onlinePlayer;
|
||||
private final boolean isOnline;
|
||||
private final ItemStack item;
|
||||
|
||||
/**
|
||||
* @param offlinePlayer The player whose item is expiring.
|
||||
* @param item The item that is expiring.
|
||||
*/
|
||||
public AuctionExpireEvent(OfflinePlayer offlinePlayer, ItemStack item) {
|
||||
this.offlinePlayer = offlinePlayer;
|
||||
this.item = item;
|
||||
this.isOnline = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param onlinePlayer The player whose item is expiring.
|
||||
* @param item The item that is expiring.
|
||||
*/
|
||||
public AuctionExpireEvent(Player onlinePlayer, ItemStack item) {
|
||||
this.onlinePlayer = onlinePlayer;
|
||||
this.item = item;
|
||||
this.isOnline = true;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public OfflinePlayer getOfflinePlayer() {
|
||||
return offlinePlayer;
|
||||
}
|
||||
|
||||
public Player getOnlinePlayer() {
|
||||
return onlinePlayer;
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
return isOnline;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.events;
|
||||
|
||||
import com.badbones69.crazyauctions.api.enums.ShopCategories;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author BadBones69
|
||||
*
|
||||
* This event is fired when a new item is listed onto the auction house.
|
||||
*/
|
||||
public class AuctionListEvent extends Event {
|
||||
|
||||
private final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
private final long price;
|
||||
private final ShopCategories shop;
|
||||
private final ItemStack item;
|
||||
|
||||
/**
|
||||
* @param player The player who is listing the item.
|
||||
* @param shop The shop type the item is being listed to.
|
||||
* @param item The item being listed.
|
||||
* @param price The price the item is being listed for.
|
||||
*/
|
||||
public AuctionListEvent(Player player, ShopCategories shop, ItemStack item, long price) {
|
||||
this.player = player;
|
||||
this.shop = shop;
|
||||
this.item = item;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public ShopCategories getShopType() {
|
||||
return shop;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public long getPrice() {
|
||||
return price;
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* This event is fired when a player places a new bid onto an item in the auction house.
|
||||
*/
|
||||
public class AuctionNewBidEvent extends Event {
|
||||
|
||||
private final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
private final long bid;
|
||||
private final ItemStack item;
|
||||
|
||||
/**
|
||||
* @param player The player who placed the bid.
|
||||
* @param item The item that was bid on.
|
||||
* @param bid The amount of money that was bid.
|
||||
*/
|
||||
public AuctionNewBidEvent(Player player, ItemStack item, long bid) {
|
||||
this.player = player;
|
||||
this.item = item;
|
||||
this.bid = bid;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public long getBid() {
|
||||
return bid;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package com.badbones69.crazyauctions.api.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author BadBones69
|
||||
*
|
||||
* This event is fired when a bidding item's time has run out and so a player wins the item.
|
||||
*/
|
||||
public class AuctionWinBidEvent extends Event {
|
||||
|
||||
private final HandlerList handlers = new HandlerList();
|
||||
private final Player player;
|
||||
private final long bid;
|
||||
private final ItemStack item;
|
||||
|
||||
/**
|
||||
* @param player The player who won the item.
|
||||
* @param item The item that was won.
|
||||
* @param bid The bid that was placed on the item.
|
||||
*/
|
||||
public AuctionWinBidEvent(Player player, ItemStack item, long bid) {
|
||||
this.player = player;
|
||||
this.item = item;
|
||||
this.bid = bid;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public long getBid() {
|
||||
return bid;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,275 +0,0 @@
|
||||
package com.badbones69.crazyauctions.utils;
|
||||
|
||||
import com.badbones69.crazyauctions.CrazyAuctions;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Base64;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A library for the Bukkit API to create player skulls
|
||||
* from names, base64 strings, and texture URLs.
|
||||
* Does not use any NMS code, and should work across all versions.
|
||||
*
|
||||
* @author Dean B on 12/28/2016.
|
||||
*/
|
||||
public class SkullCreator {
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
/**
|
||||
* Creates a player skull based on a player's name.
|
||||
*
|
||||
* @param name The Player's name
|
||||
* @return The head of the Player
|
||||
*
|
||||
* @deprecated names don't make for good identifiers
|
||||
*/
|
||||
@Deprecated
|
||||
public ItemStack itemFromName(String name) {
|
||||
ItemStack item = getPlayerSkullItem();
|
||||
|
||||
return itemWithName(item, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a player skull based on a player's name.
|
||||
*
|
||||
* @param item The item to apply the name to
|
||||
* @param name The Player's name
|
||||
* @return The head of the Player
|
||||
*
|
||||
* @deprecated names don't make for good identifiers
|
||||
*/
|
||||
@Deprecated
|
||||
public ItemStack itemWithName(ItemStack item, String name) {
|
||||
notNull(item, "item");
|
||||
notNull(name, "name");
|
||||
|
||||
return plugin.getServer().getUnsafe().modifyItemStack(item, "{SkullOwner:\"" + name + "\"}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a player skull with a UUID. 1.13 only.
|
||||
*
|
||||
* @param id The Player's UUID
|
||||
* @return The head of the Player
|
||||
*/
|
||||
public ItemStack itemFromUuid(UUID id) {
|
||||
ItemStack item = getPlayerSkullItem();
|
||||
|
||||
return itemWithUuid(item, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a player skull based on a UUID. 1.13 only.
|
||||
*
|
||||
* @param item The item to apply the name to
|
||||
* @param id The Player's UUID
|
||||
* @return The head of the Player
|
||||
*/
|
||||
public ItemStack itemWithUuid(ItemStack item, UUID id) {
|
||||
notNull(item, "item");
|
||||
notNull(id, "id");
|
||||
|
||||
SkullMeta meta = (SkullMeta) item.getItemMeta();
|
||||
meta.setOwningPlayer(plugin.getServer().getOfflinePlayer(id));
|
||||
item.setItemMeta(meta);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a player skull based on a Mojang server URL.
|
||||
*
|
||||
* @param url The URL of the Mojang skin
|
||||
* @return The head associated with the URL
|
||||
*/
|
||||
public ItemStack itemFromUrl(String url) {
|
||||
ItemStack item = getPlayerSkullItem();
|
||||
|
||||
return itemWithUrl(item, url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a player skull based on a Mojang server URL.
|
||||
*
|
||||
* @param item The item to apply the skin to
|
||||
* @param url The URL of the Mojang skin
|
||||
* @return The head associated with the URL
|
||||
*/
|
||||
public ItemStack itemWithUrl(ItemStack item, String url) {
|
||||
notNull(item, "item");
|
||||
notNull(url, "url");
|
||||
|
||||
return itemWithBase64(item, urlToBase64(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a player skull based on a base64 string containing the link to the skin.
|
||||
*
|
||||
* @param base64 The base64 string containing the texture
|
||||
* @return The head with a custom texture
|
||||
*/
|
||||
public ItemStack itemFromBase64(String base64) {
|
||||
ItemStack item = getPlayerSkullItem();
|
||||
|
||||
return itemWithBase64(item, base64);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the base64 string to the ItemStack.
|
||||
*
|
||||
* @param item The ItemStack to put the base64 onto
|
||||
* @param base64 The base64 string containing the texture
|
||||
* @return The head with a custom texture
|
||||
*/
|
||||
public ItemStack itemWithBase64(ItemStack item, String base64) {
|
||||
notNull(item, "item");
|
||||
notNull(base64, "base64");
|
||||
|
||||
UUID hashAsId = new UUID(base64.hashCode(), base64.hashCode());
|
||||
return plugin.getServer().getUnsafe().modifyItemStack(item,
|
||||
"{SkullOwner:{Id:\"" + hashAsId + "\",Properties:{textures:[{Value:\"" + base64 + "\"}]}}}"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the block to a skull with the given name.
|
||||
*
|
||||
* @param block The block to set
|
||||
* @param name The player to set it to
|
||||
*
|
||||
* @deprecated names don't make for good identifiers
|
||||
*/
|
||||
@Deprecated
|
||||
public void blockWithName(Block block, String name) {
|
||||
notNull(block, "block");
|
||||
notNull(name, "name");
|
||||
|
||||
setBlockType(block);
|
||||
((Skull) block.getState()).setOwningPlayer(Bukkit.getOfflinePlayer(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the block to a skull with the given UUID.
|
||||
*
|
||||
* @param block The block to set
|
||||
* @param id The player to set it to
|
||||
*/
|
||||
public void blockWithUuid(Block block, UUID id) {
|
||||
notNull(block, "block");
|
||||
notNull(id, "id");
|
||||
|
||||
setBlockType(block);
|
||||
((Skull) block.getState()).setOwningPlayer(Bukkit.getOfflinePlayer(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the block to a skull with the given UUID.
|
||||
*
|
||||
* @param block The block to set
|
||||
* @param url The mojang URL to set it to use
|
||||
*/
|
||||
public void blockWithUrl(Block block, String url) {
|
||||
notNull(block, "block");
|
||||
notNull(url, "url");
|
||||
|
||||
blockWithBase64(block, urlToBase64(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the block to a skull with the given UUID.
|
||||
*
|
||||
* @param block The block to set
|
||||
* @param base64 The base64 to set it to use
|
||||
*/
|
||||
public void blockWithBase64(Block block, String base64) {
|
||||
notNull(block, "block");
|
||||
notNull(base64, "base64");
|
||||
|
||||
UUID hashAsId = new UUID(base64.hashCode(), base64.hashCode());
|
||||
|
||||
String args = String.format(
|
||||
"%d %d %d %s",
|
||||
block.getX(),
|
||||
block.getY(),
|
||||
block.getZ(),
|
||||
"{Owner:{Id:\"" + hashAsId + "\",Properties:{textures:[{Value:\"" + base64 + "\"}]}}}"
|
||||
);
|
||||
|
||||
if (newerApi()) {
|
||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "data merge block " + args);
|
||||
} else {
|
||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "blockdata " + args);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean newerApi() {
|
||||
try {
|
||||
Material.valueOf("PLAYER_HEAD");
|
||||
return true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getPlayerSkullItem() {
|
||||
if (newerApi()) {
|
||||
return new ItemStack(Material.valueOf("PLAYER_HEAD"));
|
||||
} else {
|
||||
return new ItemStack(Material.valueOf("SKULL_ITEM"), 1, (byte) 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void setBlockType(Block block) {
|
||||
try {
|
||||
block.setType(Material.valueOf("PLAYER_HEAD"), false);
|
||||
} catch (IllegalArgumentException e) {
|
||||
block.setType(Material.valueOf("SKULL"), false);
|
||||
}
|
||||
}
|
||||
|
||||
private void notNull(Object o, String name) {
|
||||
if (o == null) {
|
||||
throw new NullPointerException(name + " should not be null!");
|
||||
}
|
||||
}
|
||||
|
||||
private String urlToBase64(String url) {
|
||||
|
||||
URI actualUrl;
|
||||
|
||||
try {
|
||||
actualUrl = new URI(url);
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
String toEncode = "{\"textures\":{\"SKIN\":{\"url\":\"" + actualUrl + "\"}}}";
|
||||
return Base64.getEncoder().encodeToString(toEncode.getBytes());
|
||||
}
|
||||
}
|
||||
|
||||
/* Format for skull
|
||||
{
|
||||
display:{
|
||||
Name:"Cheese"
|
||||
},
|
||||
SkullOwner:{
|
||||
Id:"9c919b83-f3fe-456f-a824-7d1d08cc8bd2",
|
||||
Properties:{
|
||||
textures:[
|
||||
{
|
||||
Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTU1ZDYxMWE4NzhlODIxMjMxNzQ5YjI5NjU3MDhjYWQ5NDI2NTA2NzJkYjA5ZTI2ODQ3YTg4ZTJmYWMyOTQ2In19fQ=="
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}*/
|
@ -1,27 +0,0 @@
|
||||
package com.badbones69.crazyauctions.utils.func;
|
||||
|
||||
import com.badbones69.crazyauctions.CrazyAuctions;
|
||||
|
||||
public enum PluginSupport {
|
||||
|
||||
PLACEHOLDERAPI("PlaceholderAPI"),
|
||||
HOLOGRAPHIC_DISPLAYS("HolographicDisplays"),
|
||||
DECENT_HOLOGRAMS("DecentHolograms"),
|
||||
VAULT("Vault");
|
||||
|
||||
private final String name;
|
||||
|
||||
private final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
PluginSupport(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean isPluginLoaded() {
|
||||
return plugin.getServer().getPluginManager().getPlugin(name) != null;
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
package com.badbones69.crazyauctions.utils.func;
|
||||
|
||||
import com.badbones69.crazyauctions.CrazyAuctions;
|
||||
|
||||
/**
|
||||
* @author Badbones69
|
||||
*/
|
||||
public enum ServerProtocol {
|
||||
|
||||
TOO_OLD(-1),
|
||||
v1_7_R1(171), v1_7_R2(172), v1_7_R3(173), v1_7_R4(174),
|
||||
v1_8_R1(181), v1_8_R2(182), v1_8_R3(183),
|
||||
v1_9_R1(191), v1_9_R2(192),
|
||||
v1_10_R1(1101),
|
||||
v1_11_R1(1111),
|
||||
v1_12_R1(1121),
|
||||
v1_13_R2(1132),
|
||||
v1_14_R1(1141),
|
||||
v1_15_R1(1151),
|
||||
v1_16_R1(1161), v1_16_R2(1162), v1_16_R3(1163),
|
||||
v1_17_R1(1171),
|
||||
v1_18_R1(1181),
|
||||
v1_18_R2(1182),
|
||||
v1_19(1191),
|
||||
TOO_NEW(-2);
|
||||
|
||||
private static ServerProtocol currentProtocol;
|
||||
private static ServerProtocol latest;
|
||||
|
||||
private final int versionProtocol;
|
||||
|
||||
private static final CrazyAuctions plugin = CrazyAuctions.getPlugin();
|
||||
|
||||
ServerProtocol(int versionProtocol) {
|
||||
this.versionProtocol = versionProtocol;
|
||||
}
|
||||
|
||||
public static ServerProtocol getCurrentProtocol() {
|
||||
|
||||
String serVer = plugin.getServer().getClass().getPackage().getName();
|
||||
|
||||
int serProt = Integer.parseInt(
|
||||
serVer.substring(
|
||||
serVer.lastIndexOf('.') + 1
|
||||
).replace("_", "").replace("R", "").replace("v", "")
|
||||
);
|
||||
|
||||
for (ServerProtocol protocol : values()) {
|
||||
if (protocol.versionProtocol == serProt) {
|
||||
currentProtocol = protocol;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentProtocol == null) currentProtocol = ServerProtocol.TOO_NEW;
|
||||
|
||||
return currentProtocol;
|
||||
}
|
||||
|
||||
public static boolean isLegacy() {
|
||||
return isOlder(ServerProtocol.v1_18_R1);
|
||||
}
|
||||
|
||||
public static ServerProtocol getLatestProtocol() {
|
||||
|
||||
if (latest != null) return latest;
|
||||
|
||||
ServerProtocol old = ServerProtocol.TOO_OLD;
|
||||
|
||||
for (ServerProtocol protocol : values()) {
|
||||
if (protocol.compare(old) == 1) {
|
||||
old = protocol;
|
||||
}
|
||||
}
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
public static boolean isAtLeast(ServerProtocol protocol) {
|
||||
if (currentProtocol == null) getCurrentProtocol();
|
||||
|
||||
int proto = currentProtocol.versionProtocol;
|
||||
|
||||
return proto >= protocol.versionProtocol || proto == -2;
|
||||
}
|
||||
|
||||
public static boolean isNewer(ServerProtocol protocol) {
|
||||
if (currentProtocol == null) getCurrentProtocol();
|
||||
|
||||
return currentProtocol.versionProtocol > protocol.versionProtocol || currentProtocol.versionProtocol == -2;
|
||||
}
|
||||
|
||||
public static boolean isSame(ServerProtocol protocol) {
|
||||
if (currentProtocol == null) getCurrentProtocol();
|
||||
|
||||
return currentProtocol.versionProtocol == protocol.versionProtocol;
|
||||
}
|
||||
|
||||
public static boolean isOlder(ServerProtocol protocol) {
|
||||
if (currentProtocol == null) getCurrentProtocol();
|
||||
|
||||
int proto = currentProtocol.versionProtocol;
|
||||
|
||||
return proto < protocol.versionProtocol || proto == -1;
|
||||
}
|
||||
|
||||
public int compare(ServerProtocol protocol) {
|
||||
int result = -1;
|
||||
int current = versionProtocol;
|
||||
int check = protocol.versionProtocol;
|
||||
|
||||
if (current > check || check == -2) {
|
||||
result = 1;
|
||||
} else if (current == check) {
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
@ -1,303 +0,0 @@
|
||||
Settings:
|
||||
Prefix: '&7[&4Crazy &bAuctions&7]: ' #Prefix of when you get Crazy Auctions Messages.
|
||||
GUIName: '&4Crazy &bAuctions&8' #Name of the Main GUI.
|
||||
Players-Current-Items: '&8Your Current Listings' #The Name of the Player Current Items GUI.
|
||||
Cancelled/Expired-Items: '&8Canceled/Expired Listings' #Name of the Cancelled/Expired GUI.
|
||||
Buying-Item: '&8Purchase Item: Are You Sure?' #Name of the Buying GUI.
|
||||
Bidding-On-Item: '&8You Are Bidding On This Item.' #Name of the Bidding GUI.
|
||||
Categories: '&8Categories' #Name of the Category GUI.
|
||||
Sell-Time: 2d #The time that each item will sell for.
|
||||
Bid-Time: 2m 30s #Time for each item that is biddable.
|
||||
Full-Expire-Time: 10d #The full time the item is in the crazy auctions.
|
||||
Bid-Winner-Time: 20d #The time the winner of a bid has to claim their prize.
|
||||
Minimum-Sell-Price: 10 #Minimum amount you can sell an item for.
|
||||
Max-Beginning-Sell-Price: 1000000 #Max amount you can sell an item for.
|
||||
Minimum-Bid-Price: 100 #Minimum starting bid.
|
||||
Max-Beginning-Bid-Price: 1000000 #Maximum starting bid.
|
||||
Allow-Damaged-Items: false #Allow items that have been damaged.
|
||||
Category-Page-Opens-First: false #If set to true the categories' page will open when they do /CA.
|
||||
Feature-Toggle: #Toggle if a feature is on or off.
|
||||
Selling: true #Able to use the selling part of the auction house.
|
||||
Bidding: true #Able to use the bidding part of the auction house.
|
||||
Sounds:
|
||||
Toggle: false #Disable the clicking sound.
|
||||
Sound: 'CLICK' #Make sure if you use 1.8 or lower you use the 1.8 sound and 1.9 and up use 1.9 sounds. The default sound is 1.8.
|
||||
#Sounds are found here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
|
||||
GUISettings: #Settings for things in the gui.
|
||||
SellingItemLore: #The lore on items that are being sold.
|
||||
- '&7-------------------------'
|
||||
- '&aClick here to purchase.'
|
||||
- ''
|
||||
- '&9Price: &e$%price%'
|
||||
- '&9Seller: &e%seller%'
|
||||
- '&7-------------------------'
|
||||
CurrentLore: #Lore on items that are in your current items GUI.
|
||||
- '&7-------------------------'
|
||||
- '&aClick here to cancel.'
|
||||
- ''
|
||||
- '&9Price: &e$%price%'
|
||||
- '&9Expire: &e%time%'
|
||||
- '&7-------------------------'
|
||||
Cancelled/ExpiredLore: #Lore on items that are in your canceled/expired GUI.
|
||||
- '&7-------------------------'
|
||||
- '&aClick here to return to you.'
|
||||
- ''
|
||||
- '&9Full Expire: &e%time%'
|
||||
- '&7-------------------------'
|
||||
Bidding: #Lore on Bidding Items.
|
||||
- '&7-------------------------'
|
||||
- '&aClick here to bid.'
|
||||
- ''
|
||||
- '&9Seller: &e%seller%'
|
||||
- '&9Current Bid: &e$%topbid%'
|
||||
- '&9Top Bidder: &e%topbidder%'
|
||||
- '&9Time Left: &e%time%'
|
||||
- '&7-------------------------'
|
||||
Category-Settings:
|
||||
Armor:
|
||||
Item: 'GOLDEN_CHESTPLATE'
|
||||
Toggle: true
|
||||
Slot: 11
|
||||
Name: '&6&lArmor'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7armor that is currently being sold.'
|
||||
Weapons:
|
||||
Item: 'GOLDEN_SWORD'
|
||||
Toggle: true
|
||||
Slot: 12
|
||||
Name: '&6&lWeapons'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7weapons that are currently being sold.'
|
||||
Tools:
|
||||
Item: 'GOLDEN_PICKAXE'
|
||||
Toggle: true
|
||||
Slot: 13
|
||||
Name: '&6&lTools'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7tools that are currently being sold.'
|
||||
Food:
|
||||
Item: 'GOLDEN_APPLE'
|
||||
Toggle: true
|
||||
Slot: 14
|
||||
Name: '&6&lFood'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7food that is currently being sold.'
|
||||
Potions:
|
||||
Item: 'POTION'
|
||||
Toggle: true
|
||||
Slot: 15
|
||||
Name: '&6&lPotions'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7potions that are currently being sold.'
|
||||
Blocks:
|
||||
Item: 'GRASS_BLOCK'
|
||||
Toggle: true
|
||||
Slot: 16
|
||||
Name: '&6&lBlocks'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7blocks that are currently being sold.'
|
||||
Other:
|
||||
Item: 'GOLD_NUGGET'
|
||||
Toggle: true
|
||||
Slot: 17
|
||||
Name: '&6&lOthers'
|
||||
Lore:
|
||||
- '&7This category contains all the'
|
||||
- '&7other items currently being sold.'
|
||||
None:
|
||||
Item: 'BARRIER'
|
||||
Toggle: true
|
||||
Slot: 23
|
||||
Name: '&6&lNone'
|
||||
Lore:
|
||||
- '&7This category contains all'
|
||||
- '&7items currently being sold.'
|
||||
OtherSettings: #Other Settings for the GUIs.
|
||||
SellingItems: #The button for your current items.
|
||||
Item: 'DIAMOND' #The item that this button is.
|
||||
Toggle: true #If the item is in the gui or not.
|
||||
Slot: 46 #The slot it is in. I recommend not changing these. If you do make sure they are still in the bottom row.
|
||||
Name: '&6Items You are Selling' #Name of the item.
|
||||
Lore: #Lore of the item.
|
||||
- '&aClick here to view all the items you'
|
||||
- '&aare currently selling on the auction.'
|
||||
Cancelled/ExpiredItems: #The button for Cancelled/Expired Items.
|
||||
Item: 'POISONOUS_POTATO'
|
||||
Toggle: true
|
||||
Slot: 47
|
||||
Name: '&6Collect Expired / Canceled Items'
|
||||
Lore:
|
||||
- '&aClick here to view and collect all of the'
|
||||
- '&aitems you have canceled or has expired.'
|
||||
PreviousPage: #The button for Previous Page.
|
||||
Item: 'PAPER'
|
||||
Toggle: true
|
||||
Slot: 49
|
||||
Name: '&6Previous Page'
|
||||
Lore: { }
|
||||
Refesh: #The button for Refresh Page.
|
||||
Item: 'SUNFLOWER'
|
||||
Toggle: true
|
||||
Slot: 50
|
||||
Name: '&6Refresh Page'
|
||||
Lore: { }
|
||||
NextPage: #The button for Next Page.
|
||||
Item: 'PAPER'
|
||||
Toggle: true
|
||||
Slot: 51
|
||||
Name: '&6Next Page'
|
||||
Lore: { }
|
||||
Category1: #The button for Next Page.
|
||||
Item: 'CHEST'
|
||||
Toggle: true
|
||||
Slot: 52
|
||||
Name: '&6Categories'
|
||||
Lore:
|
||||
- '&bCurrent Category: &6%category%'
|
||||
- '&aWant to see items in specific categories?'
|
||||
- '&aClick here to see all categories of items.'
|
||||
Category2: #The button for Next Page.
|
||||
Item: 'CHEST'
|
||||
Toggle: true
|
||||
Slot: 48
|
||||
Name: '&6Categories'
|
||||
Lore:
|
||||
- '&bCurrent Category: &6%category%'
|
||||
- '&aWant to see items in specific categories?'
|
||||
- '&aClick here to see all categories of items.'
|
||||
Bidding/Selling: #Switch between Bidding and Selling.
|
||||
Selling:
|
||||
Item: 'SLIME_BALL'
|
||||
Toggle: true
|
||||
Slot: 53
|
||||
Name: '&6Currently looking at items being sold.'
|
||||
Lore:
|
||||
- '&7&l(&6&l!&7&l) &7Click here to see items'
|
||||
- '&7that you can bid on.'
|
||||
Bidding:
|
||||
Item: 'MAGMA_CREAM'
|
||||
Toggle: true
|
||||
Slot: 53
|
||||
Name: '&6Currently looking at items that can be bid on.'
|
||||
Lore:
|
||||
- '&7&l(&6&l!&7&l) &7Click here to see items'
|
||||
- '&7that you can buy at a price.'
|
||||
WhatIsThis: #The info on all the Books buttons.
|
||||
SellingShop: #The Book in the main shop.
|
||||
Item: 'BOOK'
|
||||
Toggle: true
|
||||
Slot: 54
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThis is the crazy auctions, here you can'
|
||||
- '&aput items for sale, and buy items'
|
||||
- '&athat others have put for sale.'
|
||||
- ''
|
||||
- '&aThe auction is also a great place to make'
|
||||
- '&amoney by selling items that others'
|
||||
- '&amay be interested in buying.'
|
||||
BiddingShop: #The Book in the main shop.
|
||||
Item: 'BOOK'
|
||||
Toggle: true
|
||||
Slot: 54
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThis is the crazy auctions, here you can'
|
||||
- '&aput items for sale, and bid on items'
|
||||
- '&athat others have put for sale.'
|
||||
- ''
|
||||
- '&aThe bidding auction is also a great place to'
|
||||
- '&amake money by bidding off items that others'
|
||||
- '&amay be interested in bidding on.'
|
||||
CurrentItems: #The Book in the Current items GUI.
|
||||
Item: 'BOOK'
|
||||
Toggle: true
|
||||
Slot: 54
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThese are your current listings, all of'
|
||||
- '&athe items you currently have listed on'
|
||||
- '&acrazy auctions are displayed here.'
|
||||
- ''
|
||||
- '&aYou can cancel and view your listings'
|
||||
- '&aexpire time here.'
|
||||
Cancelled/ExpiredItems: #The Book in the Canceled/Expired Items GUI.
|
||||
Item: 'BOOK'
|
||||
Toggle: true
|
||||
Slot: 54
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThis page houses all of your cancelled and'
|
||||
- '&aexpired items, when a listings is cancelled'
|
||||
- '&aor expires you will be able to return that'
|
||||
- '&aitem back to you from this menu.'
|
||||
- ''
|
||||
- '&aJust click on the item and if you have enough'
|
||||
- '&ainventory space you will receive that item.'
|
||||
Viewing: #The Book in the Viewing Items GUI.
|
||||
Item: 'BOOK'
|
||||
Toggle: true
|
||||
Slot: 50
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThis page shows all the items that'
|
||||
- '&aa player has currently on the bidding'
|
||||
- '&aand selling market. You can quickly see'
|
||||
- '&awhat a specific player is selling.'
|
||||
Categories: #The Book in the Viewing Items GUI.
|
||||
Item: 'BOOK'
|
||||
Toggle: true
|
||||
Slot: 54
|
||||
Name: '&6What Is This Page?'
|
||||
Lore:
|
||||
- '&aThis page shows all the categories'
|
||||
- '&athat you can choose from. When you click'
|
||||
- '&aa category it will open the gui with only'
|
||||
- '&aitems that belong to that category.'
|
||||
Back: #The Back Buttons.
|
||||
Item: 'PAPER'
|
||||
Slot: 46
|
||||
Name: '&6Back'
|
||||
Return: #The Return Buttons.
|
||||
Item: 'FLOWER_POT'
|
||||
Slot: 50
|
||||
Name: '&6Return All'
|
||||
Lore:
|
||||
- '&aClick here to return all cancelled'
|
||||
- '&aand expired items to your inventory.'
|
||||
Confirm: #The Confirm Buttons.
|
||||
Item: 'LIME_STAINED_GLASS_PANE'
|
||||
Name: '&aConfirm'
|
||||
Cancel: #The Cancel Buttons.
|
||||
Item: 'RED_STAINED_GLASS_PANE'
|
||||
Name: '&cCancel'
|
||||
Your-Item: #The item that shows when you try to buy/bid on your item.
|
||||
Item: 'BARRIER'
|
||||
Name: '&cYou Can''t Purchase Your Own Item.'
|
||||
Cant-Afford: #The item that shows when you can't afford this item.
|
||||
Item: 'BARRIER'
|
||||
Name: '&cYou Can''t Afford This Item.'
|
||||
Top-Bidder: #The item for when a player is already the top bidder.
|
||||
Item: 'BARRIER'
|
||||
Name: '&cYou are already the top bidder.'
|
||||
Bidding: #The item in the middle when bidding on an item.
|
||||
Item: 'BLACK_STAINED_GLASS_PANE'
|
||||
Name: '&7Bidding'
|
||||
Lore:
|
||||
- '&7<--&aAdd &cRemove&7-->'
|
||||
- '&9Your Current Bid: &e$%Bid%'
|
||||
- '&9Current Top Bid: &e$%topbid%'
|
||||
Bid: #The button for when you want to confirm your bid.
|
||||
Item: 'LIGHT_BLUE_STAINED_GLASS_PANE'
|
||||
Name: '&bBid Now'
|
||||
Lore:
|
||||
- '&7Click here to Bid Now.'
|
||||
BlackList:
|
||||
- 'BEDROCK'
|
||||
- 'END_PORTAL_FRAME'
|
@ -1,2 +0,0 @@
|
||||
Items: {}
|
||||
OutOfTime/Cancelled: {}
|
@ -1,45 +0,0 @@
|
||||
Messages:
|
||||
Players-Only: '&cOnly players can use this command.'
|
||||
Reload: '&7You have just reloaded the Crazy Auctions Files.'
|
||||
Need-More-Money: '&cYou are in need of &a$%money_needed%&c.'
|
||||
Inventory-Full: '&cYour inventory is too full. Please open up some space to buy that.'
|
||||
No-Permission: '&cYou do not have permission to use that command!'
|
||||
Not-Online: '&cThat player is not online.'
|
||||
Doesnt-Have-Item-In-Hand: '&cYou must have an item in your hand.'
|
||||
Not-A-Number: '&c%arg% is not a number.'
|
||||
Got-Item-Back: '&7Your item has been returned.'
|
||||
Cancelled-Item: '&7You have canceled an item on the auction list, return your items with /ah expired.'
|
||||
Item-Has-Expired: '&7An item you have in the Crazy Auctions has expired.'
|
||||
Admin-Force-Cancelled: '&7You have force canceled a sale.'
|
||||
Admin-Force-Cancelled-To-Player: '&cOne of your items was force canceled by an Admin.'
|
||||
Item-Doesnt-Exist: '&cThat item isn''t in the crazy auctions any more.'
|
||||
Max-Items: '&cYou can''t list any more items to the Crazy Auctions.'
|
||||
Item-BlackListed: '&cThat item is not allowed to be sold here.'
|
||||
Item-Damaged: '&cThat item is damaged and is not allowed to be sold here.'
|
||||
Sold-Msg: '&7Thank you for buying this item.'
|
||||
Bid-More-Money: '&cYour bid is too low, please bid more.'
|
||||
Not-A-Currency: '&cThat is not a currency. Please use Money or Tokens.' #Remove Tokens if you do not have TokenManager.
|
||||
Sell-Price-To-Low: '&cYour sell price is too low the minimum is &a$10&c.'
|
||||
Sell-Price-To-High: '&cYour sell price is too high the maximum is &a$1000000&c.'
|
||||
Bid-Price-To-Low: '&cYour starting bid price is too low the minimum is &a$100&c.'
|
||||
Bid-Price-To-High: '&cYour starting bid price is too high the maximum is &a$1000000&c.'
|
||||
Bought-Item: '&7You have just bought an item for &a$%price%&7.'
|
||||
Win-Bidding: '&7You have just won a bid for &a$%price%&7. Do /Ah Collect to collect your winnings.'
|
||||
Player-Bought-Item: '&7%player% has bought your item for &a$%price%.'
|
||||
Someone-Won-Players-Bid: '&7%player% has won your item with a bid of &a$%price%.'
|
||||
Added-Item-To-Auction: '&7You have just added an item to the crazy auctions for &a$%price%&7.'
|
||||
Bid-Msg: '&7You have just bid &a$%Bid% &7on that item.'
|
||||
Selling-Disabled: '&cThe selling option is disabled.'
|
||||
Bidding-Disabled: '&cThe bidding option is disabled.'
|
||||
CrazyAuctions-Help: '&c/ah help'
|
||||
CrazyAuctions-View: '&c/ah view <player>'
|
||||
CrazyAuctions-Sell-Bid: '&c/ah sell/bid <price> [amount of items]'
|
||||
Book-Not-Allowed: '&cThat book is not able to be sold in this auction house!'
|
||||
Help-Menu:
|
||||
- '&e-- &6Crazy Auctions Help &e--'
|
||||
- '&9/Ah - &eOpens the crazy auction.'
|
||||
- '&9/Ah View <Player> - &eSee what a player is selling.'
|
||||
- '&9/Ah Sell/Bid <Price> [Amount of items] - &eList the item you are holding on the crazy auction.'
|
||||
- '&9/Ah Expired/Collect - &eView and manage your canceled and expired items.'
|
||||
- '&9/Ah Listed - &eView and manage the items you are selling.'
|
||||
- '&9/Ah Help - &eView this help menu.'
|
@ -4,7 +4,7 @@ main: "${group}.CrazyAuctions"
|
||||
authors: [BadBones69, RyderBelserion]
|
||||
|
||||
version: ${version}
|
||||
api-version: "1.13"
|
||||
api-version: "1.19"
|
||||
description: ${description}
|
||||
|
||||
softdepend: [Vault]
|
||||
|
@ -1,2 +0,0 @@
|
||||
#!!DO NOT DELETE!!
|
||||
#Used for unicode checking in books.
|
Loading…
Reference in New Issue
Block a user