mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-21 05:15:11 +01:00
🚀 priority listing data columns
Took 13 seconds
This commit is contained in:
parent
af89cbc2be
commit
22dc21ebbb
@ -76,6 +76,10 @@ public class AuctionedItem {
|
||||
private boolean isRequest = false;
|
||||
private int requestAmount = 0;
|
||||
|
||||
// priority listing
|
||||
private boolean hasListingPriority = false;
|
||||
private long priorityExpiresAt = 0;
|
||||
|
||||
public AuctionedItem() {
|
||||
}
|
||||
|
||||
@ -137,7 +141,6 @@ public class AuctionedItem {
|
||||
return requested;
|
||||
}
|
||||
|
||||
|
||||
public ItemStack getBidStack(Player player) {
|
||||
QuickItem itemStack = QuickItem.of(this.item.clone());
|
||||
itemStack.amount(Math.max(this.item.getAmount(), 1));
|
||||
@ -304,4 +307,8 @@ public class AuctionedItem {
|
||||
public boolean containsValidBid() {
|
||||
return isBidItem() && !this.highestBidder.equals(this.owner);
|
||||
}
|
||||
|
||||
public boolean isListingPriorityActive() {
|
||||
return this.hasListingPriority && this.priorityExpiresAt > System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
@ -424,6 +424,10 @@ public class DataManager extends DataManagerAbstract {
|
||||
auctionItem.setRequest(resultSet.getBoolean("is_request"));
|
||||
auctionItem.setRequestAmount(resultSet.getInt("request_count"));
|
||||
|
||||
auctionItem.setHasListingPriority(resultSet.getBoolean("listing_priority"));
|
||||
auctionItem.setPriorityExpiresAt(resultSet.getLong("priority_expires_at"));
|
||||
|
||||
|
||||
return auctionItem;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package ca.tweetzy.auctionhouse.database.migrations;
|
||||
|
||||
import ca.tweetzy.flight.database.DataMigration;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
public final class _28_PriorityListingMigration extends DataMigration {
|
||||
|
||||
public _28_PriorityListingMigration() {
|
||||
super(28);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrate(Connection connection, String tablePrefix) throws SQLException {
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
statement.execute("ALTER TABLE " + tablePrefix + "auctions ADD listing_priority BOOLEAN default 0");
|
||||
statement.execute("ALTER TABLE " + tablePrefix + "auctions ADD priority_expires_at BigInt default 0");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user