diff --git a/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java index 6463815..1f41022 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java +++ b/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java @@ -1,7 +1,6 @@ package ca.tweetzy.auctionhouse; import ca.tweetzy.auctionhouse.api.UpdateChecker; -import ca.tweetzy.auctionhouse.api.hook.CityBuildStuffAPIHook; import ca.tweetzy.auctionhouse.api.hook.PlaceholderAPIHook; import ca.tweetzy.auctionhouse.api.hook.UltraEconomyHook; import ca.tweetzy.auctionhouse.auction.AuctionPlayer; @@ -137,7 +136,6 @@ public class AuctionHouse extends TweetyPlugin { } this.ultraEconomyHook = PluginHook.addHook(Economy.class, "UltraEconomy", UltraEconomyHook.class); - this.cityBuildStuff = PluginHook.addHook(Economy.class, "CityBuildStuff", CityBuildStuffAPIHook.class); // Load Economy EconomyManager.load(); @@ -152,8 +150,6 @@ public class AuctionHouse extends TweetyPlugin { if (ECO_PLUGIN.startsWith("UltraEconomy")) { EconomyManager.getManager().setPreferredHook(this.ultraEconomyHook); - } else if (ECO_PLUGIN.equalsIgnoreCase("CityBuildStuff")) { - EconomyManager.getManager().setPreferredHook(this.cityBuildStuff); } else { EconomyManager.getManager().setPreferredHook(ECO_PLUGIN); } @@ -193,7 +189,8 @@ public class AuctionHouse extends TweetyPlugin { new _11_AdminLogMigration(), new _12_SerializeFormatDropMigration(), new _13_MinItemPriceMigration(), - new _14_PartialQtyBuyMigration() + new _14_PartialQtyBuyMigration(), + new _15_AuctionPlayerMigration() ); dataMigrationManager.runMigrations(); diff --git a/src/main/java/ca/tweetzy/auctionhouse/api/hook/CityBuildStuffAPIHook.java b/src/main/java/ca/tweetzy/auctionhouse/api/hook/CityBuildStuffAPIHook.java deleted file mode 100644 index 8d2fbea..0000000 --- a/src/main/java/ca/tweetzy/auctionhouse/api/hook/CityBuildStuffAPIHook.java +++ /dev/null @@ -1,64 +0,0 @@ -package ca.tweetzy.auctionhouse.api.hook; - -import at.blank.coinapi.Api.CoinAPI; -import ca.tweetzy.core.hooks.economies.Economy; -import ca.tweetzy.core.utils.TextUtils; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; - -/** - * The current file has been created by Kiran Hart - * Date Created: October 05 2021 - * Time Created: 9:18 p.m. - * Usage of any code found within this class is prohibited unless given explicit permission otherwise - */ -public final class CityBuildStuffAPIHook extends Economy { - - public CityBuildStuffAPIHook() { - if (!isEnabled()) { - Bukkit.getConsoleSender().sendMessage(TextUtils.formatText("&bCityBuildStuff &7hook cannot be created&f: &cCityBuildStuff not installed")); - return; - } - } - - @Override - public double getBalance(OfflinePlayer player) { - return new CoinAPI(player.getUniqueId()).getCoins(); - } - - @Override - public boolean hasBalance(OfflinePlayer player, double cost) { - final CoinAPI api = new CoinAPI(player.getUniqueId()); - return api.getCoins() >= cost; - } - - @Override - public boolean withdrawBalance(OfflinePlayer player, double cost) { - final CoinAPI api = new CoinAPI(player.getUniqueId()); - if (!api.hasAccount()) return false; - - if (!hasBalance(player, cost)) return false; - api.setCoins(api.getCoins() - cost); - - return true; - } - - @Override - public boolean deposit(OfflinePlayer player, double amount) { - final CoinAPI api = new CoinAPI(player.getUniqueId()); - if (!api.hasAccount()) return false; - - api.setCoins(api.getCoins() + amount); - return true; - } - - @Override - public String getName() { - return "CoinsAI"; - } - - @Override - public boolean isEnabled() { - return Bukkit.getPluginManager().getPlugin("CityBuildStuff") != null; - } -} diff --git a/src/main/java/ca/tweetzy/auctionhouse/database/migrations/_15_AuctionPlayerMigration.java b/src/main/java/ca/tweetzy/auctionhouse/database/migrations/_15_AuctionPlayerMigration.java new file mode 100644 index 0000000..bea6d15 --- /dev/null +++ b/src/main/java/ca/tweetzy/auctionhouse/database/migrations/_15_AuctionPlayerMigration.java @@ -0,0 +1,34 @@ +package ca.tweetzy.auctionhouse.database.migrations; + +import ca.tweetzy.core.database.DataMigration; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; + +/** + * The current file has been created by Kiran Hart + * Date Created: August 12 2021 + * Time Created: 11:58 a.m. + * Usage of any code found within this class is prohibited unless given explicit permission otherwise + */ +public class _15_AuctionPlayerMigration extends DataMigration { + + public _15_AuctionPlayerMigration() { + super(15); + } + + @Override + public void migrate(Connection connection, String tablePrefix) throws SQLException { + try (Statement statement = connection.createStatement()) { + statement.execute("CREATE TABLE " + tablePrefix + "player (" + + "uuid VARCHAR(36) PRIMARY KEY, " + + "filter_sale_type VARCHAR(32) NOT NULL, " + + "filter_item_category VARCHAR(16) NOT NULL, " + + "filter_sort_type VARCHAR(12) NOT NULL, " + + "last_listed_item LONG NOT NULL" + + ")"); + + } + } +}