From 8294492cf05339fa4a62e5d443a36970036e7184 Mon Sep 17 00:00:00 2001 From: OllieJW <71931263+OllieJW@users.noreply.github.com> Date: Sat, 10 Jul 2021 16:17:18 +0100 Subject: [PATCH] Delete src/main directory --- .../olliejw/oremarket/Commands/Reload.java | 17 ----- .../java/com/olliejw/oremarket/OreMarket.java | 52 -------------- .../olliejw/oremarket/Utils/MarketGUI.java | 70 ------------------- src/main/resources/config.yml | 29 -------- src/main/resources/plugin.yml | 15 ---- 5 files changed, 183 deletions(-) delete mode 100644 src/main/java/com/olliejw/oremarket/Commands/Reload.java delete mode 100644 src/main/java/com/olliejw/oremarket/OreMarket.java delete mode 100644 src/main/java/com/olliejw/oremarket/Utils/MarketGUI.java delete mode 100644 src/main/resources/config.yml delete mode 100644 src/main/resources/plugin.yml diff --git a/src/main/java/com/olliejw/oremarket/Commands/Reload.java b/src/main/java/com/olliejw/oremarket/Commands/Reload.java deleted file mode 100644 index ef85c98..0000000 --- a/src/main/java/com/olliejw/oremarket/Commands/Reload.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.olliejw.oremarket.Commands; - -import com.olliejw.oremarket.OreMarket; -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; - -public class Reload implements CommandExecutor { - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - OreMarket.main().reloadConfig(); - sender.sendMessage(ChatColor.GREEN + "Reloaded successfully"); - return true; - } -} diff --git a/src/main/java/com/olliejw/oremarket/OreMarket.java b/src/main/java/com/olliejw/oremarket/OreMarket.java deleted file mode 100644 index 04ff2b9..0000000 --- a/src/main/java/com/olliejw/oremarket/OreMarket.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.olliejw.oremarket; - -import com.olliejw.oremarket.Commands.Reload; -import com.olliejw.oremarket.Utils.MarketGUI; -import net.milkbowl.vault.economy.Economy; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.java.JavaPlugin; - -import java.util.logging.Logger; - -public final class OreMarket extends JavaPlugin { - - private static OreMarket instance; - private static final Logger log = Logger.getLogger("Minecraft"); - private static Economy econ = null; - - public void onEnable() { - instance = this; - - saveDefaultConfig(); - this.getServer().getPluginManager().registerEvents(new MarketGUI(), this); - this.getCommand("openmarket").setExecutor(new MarketGUI()); - this.getCommand("om-reload").setExecutor(new Reload()); - - if (!setupEconomy() ) { - log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName())); - getServer().getPluginManager().disablePlugin(this); - return; - } - } - - public static OreMarket main(){ - return instance; - } - - private boolean setupEconomy() { - if (getServer().getPluginManager().getPlugin("Vault") == null) { - return false; - } - RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Economy.class); - if (rsp == null) { - return false; - } - econ = rsp.getProvider(); - return econ != null; - } - - public static Economy getEconomy() { - return econ; - } -} - diff --git a/src/main/java/com/olliejw/oremarket/Utils/MarketGUI.java b/src/main/java/com/olliejw/oremarket/Utils/MarketGUI.java deleted file mode 100644 index c9702e2..0000000 --- a/src/main/java/com/olliejw/oremarket/Utils/MarketGUI.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.olliejw.oremarket.Utils; - -import com.olliejw.oremarket.OreMarket; -import net.milkbowl.vault.economy.EconomyResponse; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryDragEvent; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; - -import java.util.Objects; - -public class MarketGUI implements Listener, CommandExecutor { - Inventory inv = Bukkit.createInventory(null, 27, "OreMarket Coming soon!"); - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (command.getName().equalsIgnoreCase("openmarket")) { - Player player = (Player) sender; - - for (String key : OreMarket.main().getConfig().getConfigurationSection("items").getKeys(false)) { - ConfigurationSection keySection = OreMarket.main().getConfig().getConfigurationSection("items").getConfigurationSection(key); - assert keySection != null; - - ItemStack item = new ItemStack(Material.matchMaterial(keySection.getString("item"))); - ItemMeta meta = item.getItemMeta(); - meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', keySection.getString("name"))); - item.setItemMeta(meta); - - inv.setItem(Integer.parseInt(key), item); - player.openInventory(inv); - } - } - return true; - } - - @EventHandler - public void dragEvent (InventoryDragEvent event) { - if (event.getInventory() == inv) { - event.setCancelled(true); - } - } - @EventHandler - public void clickEvent (InventoryClickEvent event) { - Player player = (Player) event.getWhoClicked(); - - int pay = OreMarket.main().getConfig().getInt("items." + event.getSlot() + ".value"); - EconomyResponse r = OreMarket.getEconomy().depositPlayer(event.getWhoClicked().getName(), pay); - - if(r.transactionSuccess()) { - event.getWhoClicked().sendMessage(String.format("You were given %s and now have %s", OreMarket.getEconomy().format(r.amount), OreMarket.getEconomy().format(r.balance))); - } else { - event.getWhoClicked().sendMessage(String.format("An error occured: %s", r.errorMessage)); - } - - event.setCancelled(true); - - } -} - diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml deleted file mode 100644 index 9ab1e58..0000000 --- a/src/main/resources/config.yml +++ /dev/null @@ -1,29 +0,0 @@ -# Cost = Initial cost of ore. (0% change) -# Value = Current cost of ore. (With % change) -# When adding a new ore make the cost and value to same - -items: - 0: - item: DIAMOND - name: '&bDiamond Ore' - lore: - - '&a$1000' - cost: 1000 - value: 1000 - - 1: - item: GOLD_INGOT - name: '&6Gold Ingot' - lore: - - '&a$500' - cost: 500 - value: 500 - - 2: - item: IRON_INGOT - name: '&7Iron Ore' - lore: - - '&a$250' - cost: 250 - value: 250 - diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml deleted file mode 100644 index 53e1eb6..0000000 --- a/src/main/resources/plugin.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: OreMarket -version: ${project.version} -main: com.olliejw.oremarket.OreMarket -api-version: 1.16 -depend: [ Vault ] -authors: [ OllieJW ] -description: Realistic stock market for ores - -commands: - openmarket: - description: Opens OreMarket GUI - usage: / - om-reload: - description: Reloads OreMarket - usage: / \ No newline at end of file