mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-22 05:25:11 +01:00
💎 fixed filter cycle bug, and listing confirmation when player doesn't have enough money
Took 2 minutes
This commit is contained in:
parent
0cc26b0847
commit
0d3da74f94
@ -140,13 +140,29 @@ public enum AuctionItemCategory {
|
|||||||
return getType();
|
return getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public AuctionItemCategory next() {
|
||||||
|
// int currentIndex = this.ordinal();
|
||||||
|
// int nextIndex = currentIndex + 1;
|
||||||
|
// while (!values()[nextIndex %= values().length].isEnabled()) {
|
||||||
|
// nextIndex++;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return values()[nextIndex];
|
||||||
|
// }
|
||||||
|
|
||||||
public AuctionItemCategory next() {
|
public AuctionItemCategory next() {
|
||||||
int currentIndex = this.ordinal();
|
int currentIndex = this.ordinal();
|
||||||
int nextIndex = currentIndex + 1;
|
int nextIndex = currentIndex;
|
||||||
while (!values()[nextIndex %= values().length].isEnabled()) {
|
int totalCategories = values().length;
|
||||||
nextIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (int i = 1; i <= totalCategories; i++) {
|
||||||
|
nextIndex = (currentIndex + i) % totalCategories;
|
||||||
|
if (values()[nextIndex].isEnabled()) {
|
||||||
return values()[nextIndex];
|
return values()[nextIndex];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no enabled categories are found, return the current category
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -426,8 +426,9 @@ public final class CommandSell extends Command {
|
|||||||
AuctionHouse.getAuctionPlayerManager().processSell(player);
|
AuctionHouse.getAuctionPlayerManager().processSell(player);
|
||||||
|
|
||||||
if (listingResult != ListingResult.SUCCESS) {
|
if (listingResult != ListingResult.SUCCESS) {
|
||||||
// PlayerUtils.giveItem(player, auction.getCleanItem());
|
PlayerUtils.giveItem(player, auction.getCleanItem());
|
||||||
auctionPlayer.setItemBeingListed(null);
|
auctionPlayer.setItemBeingListed(null);
|
||||||
|
AuctionHouse.newChain().sync(player::closeInventory).execute();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public final class GUIListingConfirm extends AuctionBaseGUI {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setOnClose(close -> {
|
setOnClose(close -> {
|
||||||
final AuctionPlayer auctionPlayer = AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(close.player.getUniqueId());
|
final AuctionPlayer auctionPlayer = AuctionHouse.getAuctionPlayerManager().getPlayer(close.player.getUniqueId());
|
||||||
|
|
||||||
if (!this.resulted.contains(close.player.getUniqueId())) {
|
if (!this.resulted.contains(close.player.getUniqueId())) {
|
||||||
if (auctionPlayer.getItemBeingListed() != null) {
|
if (auctionPlayer.getItemBeingListed() != null) {
|
||||||
@ -73,7 +73,7 @@ public final class GUIListingConfirm extends AuctionBaseGUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close.player.removeMetadata("AuctionHouseConfirmListing", AuctionHouse.getInstance());
|
close.player.removeMetadata("AuctionHouseConfirmListing", AuctionHouse.getInstance());
|
||||||
AuctionHouse.getInstance().getAuctionPlayerManager().processSell(close.player);
|
AuctionHouse.getAuctionPlayerManager().processSell(close.player);
|
||||||
});
|
});
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
@ -665,7 +665,7 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
|
|||||||
this.auctionPlayer.setSelectedFilter(this.auctionPlayer.getSelectedFilter().next());
|
this.auctionPlayer.setSelectedFilter(this.auctionPlayer.getSelectedFilter().next());
|
||||||
updatePlayerFilter(this.auctionPlayer);
|
updatePlayerFilter(this.auctionPlayer);
|
||||||
draw();
|
draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_RESET.getString().toUpperCase())) {
|
if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_RESET.getString().toUpperCase())) {
|
||||||
@ -688,11 +688,13 @@ public final class GUIAuctionHouse extends AuctionUpdatingPagedGUI<AuctionedItem
|
|||||||
this.auctionPlayer.setAuctionSortType(this.auctionPlayer.getAuctionSortType().next());
|
this.auctionPlayer.setAuctionSortType(this.auctionPlayer.getAuctionSortType().next());
|
||||||
updatePlayerFilter(this.auctionPlayer);
|
updatePlayerFilter(this.auctionPlayer);
|
||||||
draw();
|
draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_CURRENCY.getString().toUpperCase())) {
|
if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_CURRENCY.getString().toUpperCase())) {
|
||||||
this.auctionPlayer.setSelectedCurrencyFilter(AuctionHouse.getCurrencyManager().getNext(this.auctionPlayer.getSelectedCurrencyFilter()));
|
this.auctionPlayer.setSelectedCurrencyFilter(AuctionHouse.getCurrencyManager().getNext(this.auctionPlayer.getSelectedCurrencyFilter()));
|
||||||
draw();
|
draw();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user