mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-22 05:25:11 +01:00
🚫 add clear bids admin command
Took 8 minutes
This commit is contained in:
parent
d770a06698
commit
75121ef290
@ -136,10 +136,22 @@ public class CommandAdmin extends AbstractCommand {
|
|||||||
if (player == null) return ReturnType.FAILURE;
|
if (player == null) return ReturnType.FAILURE;
|
||||||
|
|
||||||
final boolean returnItems = Boolean.parseBoolean(args[2]);
|
final boolean returnItems = Boolean.parseBoolean(args[2]);
|
||||||
final boolean returnMoney = Boolean.parseBoolean(args[3]);
|
boolean returnMoney = Boolean.parseBoolean(args[3]);
|
||||||
|
|
||||||
handleUserClear(player, returnMoney, returnItems);
|
handleUserClear(player, returnMoney, returnItems);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "clearbids":
|
||||||
|
if (args.length < 3) return ReturnType.FAILURE;
|
||||||
|
if (!sender.hasPermission("auctionhouse.cmd.admin.clearbids")) return ReturnType.FAILURE;
|
||||||
|
|
||||||
|
player = PlayerUtils.findPlayer(args[1]);
|
||||||
|
if (player == null) return ReturnType.FAILURE;
|
||||||
|
|
||||||
|
returnMoney = Boolean.parseBoolean(args[2]);
|
||||||
|
|
||||||
|
handleUserBidClear(player, returnMoney);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "opensell":
|
case "opensell":
|
||||||
if (args.length < 2) return ReturnType.FAILURE;
|
if (args.length < 2) return ReturnType.FAILURE;
|
||||||
@ -223,6 +235,27 @@ public class CommandAdmin extends AbstractCommand {
|
|||||||
return "Admin options for auction house.";
|
return "Admin options for auction house.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleUserBidClear(final Player player, final boolean returnMoney) {
|
||||||
|
final List<AuctionedItem> items = AuctionHouse.getInstance().getAuctionItemManager().getHighestBidItems(player);
|
||||||
|
|
||||||
|
for (AuctionedItem auctionedItem : items) {
|
||||||
|
auctionedItem.setHighestBidder(auctionedItem.getOwner());
|
||||||
|
auctionedItem.setHighestBidderName(auctionedItem.getOwnerName());
|
||||||
|
|
||||||
|
if (returnMoney && Settings.BIDDING_TAKES_MONEY.getBoolean())
|
||||||
|
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
|
||||||
|
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
|
||||||
|
player.getUniqueId(),
|
||||||
|
auctionedItem.getCurrentPrice(),
|
||||||
|
auctionedItem.getItem(),
|
||||||
|
player.getName(),
|
||||||
|
PaymentReason.BID_RETURNED
|
||||||
|
), null);
|
||||||
|
else
|
||||||
|
EconomyManager.deposit(player, auctionedItem.getCurrentPrice());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleUserClear(final Player player, final boolean returnBids, final boolean giveItemsBack) {
|
private void handleUserClear(final Player player, final boolean returnBids, final boolean giveItemsBack) {
|
||||||
final AuctionPlayer auctionPlayer = AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(player.getUniqueId());
|
final AuctionPlayer auctionPlayer = AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(player.getUniqueId());
|
||||||
final List<AuctionedItem> items = auctionPlayer.getAllItems();
|
final List<AuctionedItem> items = auctionPlayer.getAllItems();
|
||||||
|
Loading…
Reference in New Issue
Block a user