mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-22 05:25:11 +01:00
🈂️ server listing migration
Took 2 minutes Took 12 seconds
This commit is contained in:
parent
99fac3c589
commit
7b5e4c93f0
@ -221,7 +221,8 @@ public class AuctionHouse extends TweetyPlugin {
|
||||
new _15_AuctionPlayerMigration(),
|
||||
new _16_StatisticVersionTwoMigration(),
|
||||
new _17_PaymentsMigration(),
|
||||
new _18_PaymentsItemMigration()
|
||||
new _18_PaymentsItemMigration(),
|
||||
new _19_ServerAuctionMigration()
|
||||
);
|
||||
|
||||
dataMigrationManager.runMigrations();
|
||||
|
@ -70,6 +70,7 @@ public class AuctionedItem {
|
||||
private String listedWorld = null;
|
||||
private boolean infinite = false;
|
||||
private boolean allowPartialBuy = false;
|
||||
private boolean serverItem = false;
|
||||
|
||||
public AuctionedItem() {
|
||||
}
|
||||
@ -104,6 +105,7 @@ public class AuctionedItem {
|
||||
this.isBidItem = isBidItem;
|
||||
this.expired = expired;
|
||||
this.expiresAt = expiresAt;
|
||||
this.serverItem = false;
|
||||
}
|
||||
|
||||
public ItemStack getBidStack() {
|
||||
|
@ -379,27 +379,27 @@ public final class CommandSell extends AbstractCommand {
|
||||
}));
|
||||
} else {
|
||||
// Bukkit.getScheduler().runTaskLaterAsynchronously(AuctionHouse.getInstance(), () -> {
|
||||
if (auctionPlayer.getPlayer() == null || !auctionPlayer.getPlayer().isOnline()) {
|
||||
return ReturnType.FAILURE;
|
||||
if (auctionPlayer.getPlayer() == null || !auctionPlayer.getPlayer().isOnline()) {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
player.getInventory().setItemInHand(XMaterial.AIR.parseItem());
|
||||
|
||||
AuctionCreator.create(auctionPlayer, auctionedItem, (auction, listingResult) -> {
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().processSell(player);
|
||||
|
||||
if (listingResult != ListingResult.SUCCESS) {
|
||||
PlayerUtils.giveItem(player, auction.getItem());
|
||||
auctionPlayer.setItemBeingListed(null);
|
||||
return;
|
||||
}
|
||||
|
||||
player.getInventory().setItemInHand(XMaterial.AIR.parseItem());
|
||||
|
||||
AuctionCreator.create(auctionPlayer, auctionedItem, (auction, listingResult) -> {
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().processSell(player);
|
||||
|
||||
if (listingResult != ListingResult.SUCCESS) {
|
||||
PlayerUtils.giveItem(player, auction.getItem());
|
||||
auctionPlayer.setItemBeingListed(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean()) {
|
||||
player.removeMetadata("AuctionHouseConfirmListing", AuctionHouse.getInstance());
|
||||
instance.getGuiManager().showGUI(player, new GUIAuctionHouse(auctionPlayer));
|
||||
} else
|
||||
AuctionHouse.newChain().sync(player::closeInventory).execute();
|
||||
});
|
||||
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean()) {
|
||||
player.removeMetadata("AuctionHouseConfirmListing", AuctionHouse.getInstance());
|
||||
instance.getGuiManager().showGUI(player, new GUIAuctionHouse(auctionPlayer));
|
||||
} else
|
||||
AuctionHouse.newChain().sync(player::closeInventory).execute();
|
||||
});
|
||||
|
||||
// }, Settings.INTERNAL_CREATE_DELAY.getInt());
|
||||
|
||||
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Auction House
|
||||
* Copyright 2018-2022 Kiran Hart
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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 _19_ServerAuctionMigration extends DataMigration {
|
||||
|
||||
public _19_ServerAuctionMigration() {
|
||||
super(19);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrate(Connection connection, String tablePrefix) throws SQLException {
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
statement.execute("ALTER TABLE " + tablePrefix + "auctions ADD server_auction BOOLEAN NOT NULL DEFAULT 0");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -23,8 +23,8 @@ import ca.tweetzy.core.compatibility.XMaterial;
|
||||
import ca.tweetzy.core.utils.NumberUtils;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.flight.comp.enums.ServerVersion;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import ca.tweetzy.flight.nbtapi.NBT;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
Loading…
Reference in New Issue
Block a user