mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-03-12 13:19:20 +01:00
2.16.1 - added missing check for garbage bin in pre-purchase state
This commit is contained in:
parent
2993212258
commit
ede7afccc4
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ca.tweetzy</groupId>
|
||||
<artifactId>auctionhouse</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -131,7 +131,10 @@ public class AuctionHouse extends TweetyPlugin {
|
||||
if (Settings.DATABASE_USE.getBoolean()) {
|
||||
this.databaseConnector = new MySQLConnector(this, Settings.DATABASE_HOST.getString(), Settings.DATABASE_PORT.getInt(), Settings.DATABASE_NAME.getString(), Settings.DATABASE_USERNAME.getString(), Settings.DATABASE_PASSWORD.getString(), Settings.DATABASE_USE_SSL.getBoolean());
|
||||
this.dataManager = new DataManager(this.databaseConnector, this);
|
||||
DataMigrationManager dataMigrationManager = new DataMigrationManager(this.databaseConnector, this.dataManager, new _1_InitialMigration(), new _2_FilterWhitelistMigration());
|
||||
DataMigrationManager dataMigrationManager = new DataMigrationManager(this.databaseConnector, this.dataManager,
|
||||
new _1_InitialMigration(),
|
||||
new _2_FilterWhitelistMigration()
|
||||
);
|
||||
dataMigrationManager.runMigrations();
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class AuctionItem implements Serializable {
|
||||
public ItemStack getDisplayStack(AuctionStackType type) {
|
||||
ItemStack itemStack = AuctionAPI.getInstance().deserializeItem(this.rawItem).clone();
|
||||
itemStack.setAmount(Math.max(itemStack.getAmount(), 1));
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
ItemMeta meta = itemStack.hasItemMeta() ? itemStack.getItemMeta() : Bukkit.getItemFactory().getItemMeta(itemStack.getType());
|
||||
List<String> lore = (meta.hasLore()) ? meta.getLore() : new ArrayList<>();
|
||||
|
||||
String theSeller = (this.owner == null) ? "&eSeller Name???" : Bukkit.getOfflinePlayer(this.owner).getName();
|
||||
|
@ -1,17 +1,20 @@
|
||||
package ca.tweetzy.auctionhouse.commands;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionItem;
|
||||
import ca.tweetzy.auctionhouse.helpers.PlayerHelper;
|
||||
import ca.tweetzy.auctionhouse.helpers.MaterialCategorizer;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.commands.AbstractCommand;
|
||||
import ca.tweetzy.core.utils.items.ItemUtils;
|
||||
import ca.tweetzy.core.compatibility.XMaterial;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* The current file has been created by Kiran Hart
|
||||
@ -43,15 +46,19 @@ public class CommandAdmin extends AbstractCommand {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.relisteditems").sendPrefixedMessage(sender);
|
||||
break;
|
||||
case "cleanunknownusers":
|
||||
// Don't tell ppl that this exists just yet
|
||||
// Don't tell ppl that this exists
|
||||
AuctionHouse.getInstance().getAuctionItemManager().removeUnknownOwnerItems();
|
||||
break;
|
||||
case "stacksize":
|
||||
Player player = (Player) sender;
|
||||
ItemStack item = PlayerHelper.getHeldItem(player);
|
||||
ItemUtils.setMaxStack(item, 127);
|
||||
item.setAmount(127);
|
||||
|
||||
case "clearall":
|
||||
// Don't tell ppl that this exists
|
||||
AuctionHouse.getInstance().getAuctionItemManager().getAuctionItems().clear();
|
||||
case "clean":
|
||||
// Don't tell ppl that this exists
|
||||
AuctionHouse.getInstance().getAuctionItemManager().getAuctionItems().forEach(item -> {
|
||||
if (AuctionAPI.getInstance().deserializeItem(item.getRawItem()) == null || XMaterial.isAir(XMaterial.matchXMaterial(AuctionAPI.getInstance().deserializeItem(item.getRawItem())))) {
|
||||
AuctionHouse.getInstance().getAuctionItemManager().sendToGarbage(item);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class DataManager extends DataManagerAbstract {
|
||||
statement.executeBatch();
|
||||
}));
|
||||
} else {
|
||||
this.databaseConnector.connect(connection -> {
|
||||
this.sync(() -> this.databaseConnector.connect(connection -> {
|
||||
String saveItems = "INSERT IGNORE INTO " + this.getTablePrefix() + "items SET data = ?";
|
||||
String truncate = "TRUNCATE TABLE " + this.getTablePrefix() + "items";
|
||||
connection.prepareStatement(truncate).executeUpdate();
|
||||
@ -63,7 +63,7 @@ public class DataManager extends DataManagerAbstract {
|
||||
}
|
||||
});
|
||||
statement.executeBatch();
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public class DataManager extends DataManagerAbstract {
|
||||
statement.executeBatch();
|
||||
}));
|
||||
} else {
|
||||
this.databaseConnector.connect(connection -> {
|
||||
this.sync(() -> this.databaseConnector.connect(connection -> {
|
||||
String saveItems = "INSERT IGNORE INTO " + this.getTablePrefix() + "filter_whitelist SET data = ?";
|
||||
String truncate = "TRUNCATE TABLE " + this.getTablePrefix() + "filter_whitelist";
|
||||
try (PreparedStatement statement = connection.prepareStatement(truncate)) {
|
||||
@ -105,7 +105,7 @@ public class DataManager extends DataManagerAbstract {
|
||||
}
|
||||
});
|
||||
statement.executeBatch();
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ public class DataManager extends DataManagerAbstract {
|
||||
statement.executeBatch();
|
||||
}));
|
||||
} else {
|
||||
this.databaseConnector.connect(connection -> {
|
||||
this.sync(() -> this.databaseConnector.connect(connection -> {
|
||||
String saveItems = "INSERT IGNORE INTO " + this.getTablePrefix() + "transactions SET data = ?";
|
||||
String truncate = "TRUNCATE TABLE " + this.getTablePrefix() + "transactions";
|
||||
try (PreparedStatement statement = connection.prepareStatement(truncate)) {
|
||||
@ -147,7 +147,7 @@ public class DataManager extends DataManagerAbstract {
|
||||
}
|
||||
});
|
||||
statement.executeBatch();
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,8 @@ public class GUIConfirmPurchase extends Gui {
|
||||
setActionForRange(this.buyingSpecificQuantity ? 9 : 0, this.buyingSpecificQuantity ? 12 : 3, ClickType.LEFT, e -> {
|
||||
// Re-select the item to ensure that it's available
|
||||
try {
|
||||
// if the item is in the garbage then just don't continue
|
||||
if (AuctionHouse.getInstance().getAuctionItemManager().getGarbageBin().stream().anyMatch(items -> items.getKey().equals(this.auctionItem.getKey()))) return;
|
||||
AuctionItem located = AuctionHouse.getInstance().getAuctionItemManager().getItem(this.auctionItem.getKey());
|
||||
preItemChecks(e, located);
|
||||
|
||||
|
@ -23,6 +23,11 @@ public class AuctionListeners implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onAuctionStart(AuctionStartEvent e) {
|
||||
// TODO THIS IS GONNA BE SCUFFED
|
||||
if (Settings.DATABASE_USE.getBoolean() && Settings.DATABASE_UPDATE_ON_EVENT.getBoolean()) {
|
||||
|
||||
}
|
||||
|
||||
if (Settings.DISCORD_ENABLED.getBoolean() && Settings.DISCORD_ALERT_ON_AUCTION_START.getBoolean()) {
|
||||
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(AuctionHouse.getInstance(), () -> {
|
||||
Settings.DISCORD_WEBHOOKS.getStringList().forEach(hook -> {
|
||||
|
@ -161,6 +161,8 @@ public class Settings {
|
||||
public static final ConfigSetting DATABASE_PASSWORD = new ConfigSetting(config, "database.password", "Password1.", "What is the password to the user connecting?");
|
||||
public static final ConfigSetting DATABASE_USE_SSL = new ConfigSetting(config, "database.use ssl", true, "Should the database connection use ssl?");
|
||||
|
||||
public static final ConfigSetting DATABASE_UPDATE_ON_EVENT = new ConfigSetting(config, "database.update on event", true, "When an item is listed/bought/expired/cancelled should auction house update the database immediately?");
|
||||
|
||||
|
||||
/* ===============================
|
||||
* DISCORD WEBHOOK
|
||||
|
Loading…
Reference in New Issue
Block a user