mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-22 05:25:11 +01:00
if the user doesn't have the perm: auctionhouse.transactions.viewall and restrict all transactions to perm is true, it will just open their transactions by default w.o showing them the menu asking to view all
Took 7 minutes
This commit is contained in:
parent
1627fad0e0
commit
8e009d578e
@ -2,6 +2,7 @@ package ca.tweetzy.auctionhouse.commands;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.guis.transaction.GUITransactionList;
|
||||
import ca.tweetzy.auctionhouse.guis.transaction.GUITransactionType;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.commands.AbstractCommand;
|
||||
@ -28,7 +29,12 @@ public class CommandTransactions extends AbstractCommand {
|
||||
|
||||
if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
|
||||
|
||||
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUITransactionType());
|
||||
if (Settings.RESTRICT_ALL_TRANSACTIONS_TO_PERM.getBoolean() && !player.hasPermission("auctionhouse.transactions.viewall")) {
|
||||
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUITransactionList(player, false));
|
||||
} else {
|
||||
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUITransactionType());
|
||||
}
|
||||
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ import ca.tweetzy.auctionhouse.guis.admin.GUIAdminItem;
|
||||
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmBid;
|
||||
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmPurchase;
|
||||
import ca.tweetzy.auctionhouse.guis.filter.GUIFilterSelection;
|
||||
import ca.tweetzy.auctionhouse.guis.transaction.GUITransactionList;
|
||||
import ca.tweetzy.auctionhouse.guis.transaction.GUITransactionType;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.managers.SoundManager;
|
||||
@ -412,7 +413,13 @@ public class GUIAuctionHouse extends Gui {
|
||||
setButton(Settings.GUI_AUCTION_HOUSE_ITEMS_TRANSACTIONS_SLOT.getInt(), ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_TRANSACTIONS_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_TRANSACTIONS_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_TRANSACTIONS_LORE.getStringList(), new HashMap<String, Object>() {{
|
||||
put("%total_items_bought%", AuctionHouse.getInstance().getTransactionManager().getTotalItemsBought(auctionPlayer.getPlayer().getUniqueId()));
|
||||
put("%total_items_sold%", AuctionHouse.getInstance().getTransactionManager().getTotalItemsSold(auctionPlayer.getPlayer().getUniqueId()));
|
||||
}}), e -> e.manager.showGUI(e.player, new GUITransactionType()));
|
||||
}}), e -> {
|
||||
if (Settings.RESTRICT_ALL_TRANSACTIONS_TO_PERM.getBoolean() && !e.player.hasPermission("auctionhouse.transactions.viewall")) {
|
||||
e.manager.showGUI(e.player, new GUITransactionList(e.player, false));
|
||||
} else {
|
||||
e.manager.showGUI(e.player, new GUITransactionType());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package ca.tweetzy.auctionhouse.guis.transaction;
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.auctionhouse.transaction.Transaction;
|
||||
@ -54,7 +55,13 @@ public class GUITransactionList extends Gui {
|
||||
setOnPage(e -> draw());
|
||||
|
||||
// Other Buttons
|
||||
setButton(5, 0, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_BACK_BTN_ITEM.getString(), Settings.GUI_BACK_BTN_NAME.getString(), Settings.GUI_BACK_BTN_LORE.getStringList(), null), e -> e.manager.showGUI(e.player, new GUITransactionType()));
|
||||
setButton(5, 0, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_BACK_BTN_ITEM.getString(), Settings.GUI_BACK_BTN_NAME.getString(), Settings.GUI_BACK_BTN_LORE.getStringList(), null), e -> {
|
||||
if (Settings.RESTRICT_ALL_TRANSACTIONS_TO_PERM.getBoolean() && !e.player.hasPermission("auctionhouse.transactions.viewall")) {
|
||||
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
|
||||
} else {
|
||||
e.manager.showGUI(e.player, new GUITransactionType());
|
||||
}
|
||||
});
|
||||
|
||||
int slot = 0;
|
||||
List<Transaction> data = this.transactions.stream().sorted(Comparator.comparingLong(Transaction::getTransactionTime).reversed()).skip((page - 1) * 45L).limit(45).collect(Collectors.toList());
|
||||
|
Loading…
Reference in New Issue
Block a user