mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-15 04:15:10 +01:00
✈️ migrate admin guis to new gui template/format
Took 22 minutes
This commit is contained in:
parent
285a118367
commit
f50012a2f4
@ -20,69 +20,48 @@ package ca.tweetzy.auctionhouse.guis.admin;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
|
||||
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.guis.abstraction.AuctionPagedGUI;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import ca.tweetzy.core.gui.events.GuiClickEvent;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class GUIAdminExpired extends AbstractPlaceholderGui {
|
||||
public final class GUIAdminExpired extends AuctionPagedGUI<AuctionedItem> {
|
||||
|
||||
final OfflinePlayer targetUser;
|
||||
List<AuctionedItem> items;
|
||||
|
||||
public GUIAdminExpired(Player viewer, OfflinePlayer targetUser) {
|
||||
super(viewer);
|
||||
super(null, viewer, Settings.GUI_EXPIRED_ITEMS_ADMIN_TITLE.getString(), 6, new ArrayList<>(AuctionHouse.getInstance().getAuctionItemManager().getItems().values().stream().filter(item -> item.isExpired() && item.getOwner().equals(targetUser.getUniqueId()) && !AuctionHouse.getInstance().getAuctionItemManager().getGarbageBin().containsKey(item.getId())).collect(Collectors.toList())));
|
||||
this.targetUser = targetUser;
|
||||
this.items = AuctionHouse.getInstance().getAuctionItemManager().getItems().values().stream().filter(item -> item.isExpired() && item.getOwner().equals(targetUser.getUniqueId())).collect(Collectors.toList());
|
||||
setTitle(Settings.GUI_EXPIRED_ITEMS_ADMIN_TITLE.getString());
|
||||
setRows(6);
|
||||
setAcceptsItems(false);
|
||||
draw();
|
||||
}
|
||||
|
||||
private void draw() {
|
||||
reset();
|
||||
|
||||
setButton(5, 4, ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_CLOSE_BTN_ITEM.getString(), Settings.GUI_CLOSE_BTN_NAME.getString(), Settings.GUI_CLOSE_BTN_LORE.getStringList(), null), e -> e.gui.close());
|
||||
|
||||
AuctionHouse.newChain().asyncFirst(() -> this.items.stream().sorted(Comparator.comparingLong(AuctionedItem::getExpiresAt).reversed()).skip((page - 1) * 45L).limit(45).collect(Collectors.toList())).asyncLast(data -> {
|
||||
pages = (int) Math.max(1, Math.ceil(this.items.size() / (double) 45));
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
|
||||
setOnPage(e -> {
|
||||
draw();
|
||||
});
|
||||
|
||||
int slot = 0;
|
||||
for (AuctionedItem auctionItem : data) {
|
||||
ItemStack item = auctionItem.getItem().clone();
|
||||
|
||||
ItemMeta meta = item.hasItemMeta() ? item.getItemMeta() : Bukkit.getItemFactory().getItemMeta(item.getType());
|
||||
List<String> lore = (meta.hasLore()) ? meta.getLore() : new ArrayList<>();
|
||||
|
||||
lore.addAll(TextUtils.formatText(Settings.GUI_EXPIRED_ITEMS_ADMIN_ITEMS_LORE.getStringList()));
|
||||
meta.setLore(lore);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
|
||||
setButton(slot++, item, ClickType.LEFT, e -> {
|
||||
AuctionHouse.getInstance().getAuctionItemManager().sendToGarbage(auctionItem);
|
||||
e.manager.showGUI(e.player, new GUIAdminExpired(e.player, this.targetUser));
|
||||
});
|
||||
@Override
|
||||
protected void drawFixed() {
|
||||
applyBackExit();
|
||||
}
|
||||
|
||||
}).execute();
|
||||
@Override
|
||||
protected void prePopulate() {
|
||||
this.items.sort(Comparator.comparing(AuctionedItem::getExpiresAt).reversed());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack makeDisplayItem(AuctionedItem auctionedItem) {
|
||||
final ItemStack item = auctionedItem.getItem().clone();
|
||||
return QuickItem.of(item).lore(Settings.GUI_EXPIRED_ITEMS_ADMIN_ITEMS_LORE.getStringList()).make();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClick(AuctionedItem item, GuiClickEvent event) {
|
||||
AuctionHouse.getInstance().getAuctionItemManager().sendToGarbage(item);
|
||||
event.manager.showGUI(event.player, new GUIAdminExpired(event.player, this.targetUser));
|
||||
}
|
||||
}
|
||||
|
@ -27,13 +27,12 @@ import ca.tweetzy.auctionhouse.auction.AuctionedItem;
|
||||
import ca.tweetzy.auctionhouse.auction.enums.AdminAction;
|
||||
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
|
||||
import ca.tweetzy.auctionhouse.events.AuctionAdminEvent;
|
||||
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.guis.abstraction.AuctionBaseGUI;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.hooks.EconomyManager;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -45,32 +44,39 @@ import org.bukkit.entity.Player;
|
||||
* Time Created: 3:04 p.m.
|
||||
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
|
||||
*/
|
||||
public class GUIAdminItem extends AbstractPlaceholderGui {
|
||||
public class GUIAdminItem extends AuctionBaseGUI {
|
||||
|
||||
private final AuctionPlayer auctionPlayer;
|
||||
private final AuctionedItem auctionItem;
|
||||
|
||||
public GUIAdminItem(AuctionPlayer auctionPlayer, AuctionedItem auctionItem) {
|
||||
super(auctionPlayer);
|
||||
super(new GUIAuctionHouse(auctionPlayer), auctionPlayer.getPlayer(), Settings.GUI_ITEM_ADMIN_TITLE.getString(), 3);
|
||||
this.auctionPlayer = auctionPlayer;
|
||||
this.auctionItem = auctionItem;
|
||||
setTitle(TextUtils.formatText(Settings.GUI_ITEM_ADMIN_TITLE.getString()));
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_ITEM_ADMIN_BG_ITEM.getString()));
|
||||
setRows(3);
|
||||
setAcceptsItems(false);
|
||||
setUseLockedCells(true);
|
||||
|
||||
setOnClose(close -> close.manager.showGUI(close.player, new GUIAuctionHouse(this.auctionPlayer)));
|
||||
draw();
|
||||
}
|
||||
|
||||
private void draw() {
|
||||
@Override
|
||||
protected void draw() {
|
||||
applyBackExit();
|
||||
|
||||
drawReturnButton();
|
||||
drawClaimButton();
|
||||
drawDeleteButton();
|
||||
drawCopyButton();
|
||||
}
|
||||
|
||||
private void drawReturnButton() {
|
||||
|
||||
if (Settings.ADMIN_OPTION_SHOW_RETURN_ITEM.getBoolean())
|
||||
setButton(1, 1, ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_ITEM.getString(), Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_NAME.getString(), Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_LORE.getStringList(), null), e -> {
|
||||
if (!e.player.hasPermission("auctionhouse.admin.returnitem")) return;
|
||||
setButton(1, 1, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_NAME.getString()).lore(Settings.GUI_ITEM_ADMIN_ITEMS_RETURN_LORE.getStringList()).make(), click -> {
|
||||
|
||||
AuctionAdminEvent event = new AuctionAdminEvent(createLog(e.player, AdminAction.RETURN_ITEM));
|
||||
if (!click.player.hasPermission("auctionhouse.admin.returnitem")) return;
|
||||
|
||||
AuctionAdminEvent event = new AuctionAdminEvent(createLog(click.player, AdminAction.RETURN_ITEM));
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
@ -83,47 +89,36 @@ public class GUIAdminItem extends AbstractPlaceholderGui {
|
||||
final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(this.auctionItem.getHighestBidder());
|
||||
|
||||
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
|
||||
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
|
||||
oldBidder.getUniqueId(),
|
||||
auctionItem.getCurrentPrice(),
|
||||
auctionItem.getItem(),
|
||||
e.player.getName(),
|
||||
PaymentReason.ADMIN_REMOVED
|
||||
), null);
|
||||
else
|
||||
EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
|
||||
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice(), auctionItem.getItem(), click.player.getName(), PaymentReason.ADMIN_REMOVED), null);
|
||||
else EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
|
||||
|
||||
if (oldBidder.isOnline())
|
||||
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
|
||||
|
||||
}
|
||||
|
||||
// AuctionHouse.getInstance().getAuctionItemManager().sendToGarbage(this.auctionItem);
|
||||
e.gui.close();
|
||||
click.gui.close();
|
||||
});
|
||||
}
|
||||
|
||||
private void drawClaimButton() {
|
||||
if (Settings.ADMIN_OPTION_SHOW_CLAIM_ITEM.getBoolean())
|
||||
setButton(1, 3, ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_ITEM.getString(), Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_NAME.getString(), Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_LORE.getStringList(), null), e -> {
|
||||
if (!e.player.hasPermission("auctionhouse.admin.claimitem")) return;
|
||||
AuctionAdminEvent event = new AuctionAdminEvent(createLog(e.player, AdminAction.CLAIM_ITEM));
|
||||
setButton(1, 3, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_NAME.getString()).lore(Settings.GUI_ITEM_ADMIN_ITEMS_CLAIM_LORE.getStringList()).make(), click -> {
|
||||
|
||||
if (!click.player.hasPermission("auctionhouse.admin.claimitem")) return;
|
||||
|
||||
AuctionAdminEvent event = new AuctionAdminEvent(createLog(click.player, AdminAction.CLAIM_ITEM));
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
PlayerUtils.giveItem(e.player, this.auctionItem.getItem());
|
||||
PlayerUtils.giveItem(click.player, this.auctionItem.getItem());
|
||||
|
||||
if (Settings.BIDDING_TAKES_MONEY.getBoolean() && !this.auctionItem.getHighestBidder().equals(this.auctionItem.getOwner())) {
|
||||
final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(this.auctionItem.getHighestBidder());
|
||||
|
||||
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
|
||||
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
|
||||
oldBidder.getUniqueId(),
|
||||
auctionItem.getCurrentPrice(),
|
||||
auctionItem.getItem(),
|
||||
e.player.getName(),
|
||||
PaymentReason.ADMIN_REMOVED
|
||||
), null);
|
||||
else
|
||||
EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
|
||||
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice(), auctionItem.getItem(), click.player.getName(), PaymentReason.ADMIN_REMOVED), null);
|
||||
else EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
|
||||
|
||||
if (oldBidder.isOnline())
|
||||
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(this.auctionItem.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
|
||||
@ -131,13 +126,16 @@ public class GUIAdminItem extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
AuctionHouse.getInstance().getAuctionItemManager().sendToGarbage(this.auctionItem);
|
||||
e.gui.close();
|
||||
click.gui.close();
|
||||
});
|
||||
}
|
||||
|
||||
private void drawDeleteButton() {
|
||||
if (Settings.ADMIN_OPTION_SHOW_DELETE_ITEM.getBoolean())
|
||||
setButton(1, 5, ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_ITEM.getString(), Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_NAME.getString(), Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_LORE.getStringList(), null), e -> {
|
||||
if (!e.player.hasPermission("auctionhouse.admin.deleteitem")) return;
|
||||
AuctionAdminEvent event = new AuctionAdminEvent(createLog(e.player, AdminAction.DELETE_ITEM));
|
||||
setButton(1, 5, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_NAME.getString()).lore(Settings.GUI_ITEM_ADMIN_ITEMS_DELETE_LORE.getStringList()).make(), click -> {
|
||||
|
||||
if (!click.player.hasPermission("auctionhouse.admin.deleteitem")) return;
|
||||
AuctionAdminEvent event = new AuctionAdminEvent(createLog(click.player, AdminAction.DELETE_ITEM));
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
@ -149,7 +147,7 @@ public class GUIAdminItem extends AbstractPlaceholderGui {
|
||||
oldBidder.getUniqueId(),
|
||||
auctionItem.getCurrentPrice(),
|
||||
auctionItem.getItem(),
|
||||
e.player.getName(),
|
||||
click.player.getName(),
|
||||
PaymentReason.ADMIN_REMOVED
|
||||
), null);
|
||||
else
|
||||
@ -161,36 +159,31 @@ public class GUIAdminItem extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
AuctionHouse.getInstance().getAuctionItemManager().sendToGarbage(this.auctionItem);
|
||||
e.gui.close();
|
||||
click.gui.close();
|
||||
});
|
||||
}
|
||||
|
||||
private void drawCopyButton() {
|
||||
if (Settings.ADMIN_OPTION_SHOW_COPY_ITEM.getBoolean())
|
||||
setButton(1, 7, ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_ITEM_ADMIN_ITEMS_COPY_ITEM.getString(), Settings.GUI_ITEM_ADMIN_ITEMS_COPY_NAME.getString(), Settings.GUI_ITEM_ADMIN_ITEMS_COPY_LORE.getStringList(), null), e -> {
|
||||
if (!e.player.hasPermission("auctionhouse.admin.copyitem")) return;
|
||||
if (Settings.ITEM_COPY_REQUIRES_GMC.getBoolean() && e.player.getGameMode() != GameMode.CREATIVE) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.requires creative").sendPrefixedMessage(e.player);
|
||||
setButton(1, 7, QuickItem.of(Settings.GUI_ITEM_ADMIN_ITEMS_COPY_ITEM.getString()).name(Settings.GUI_ITEM_ADMIN_ITEMS_COPY_NAME.getString()).lore(Settings.GUI_ITEM_ADMIN_ITEMS_COPY_LORE.getStringList()).make(), click -> {
|
||||
|
||||
if (!click.player.hasPermission("auctionhouse.admin.copyitem")) return;
|
||||
if (Settings.ITEM_COPY_REQUIRES_GMC.getBoolean() && click.player.getGameMode() != GameMode.CREATIVE) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.requires creative").sendPrefixedMessage(click.player);
|
||||
return;
|
||||
}
|
||||
|
||||
AuctionAdminEvent event = new AuctionAdminEvent(createLog(e.player, AdminAction.COPY_ITEM));
|
||||
AuctionAdminEvent event = new AuctionAdminEvent(createLog(click.player, AdminAction.COPY_ITEM));
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
PlayerUtils.giveItem(e.player, this.auctionItem.getItem());
|
||||
e.gui.close();
|
||||
PlayerUtils.giveItem(click.player, this.auctionItem.getItem());
|
||||
click.gui.close();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private AuctionAdminLog createLog(final Player player, AdminAction adminAction) {
|
||||
return new AuctionAdminLog(
|
||||
player.getUniqueId(),
|
||||
player.getName(),
|
||||
auctionItem.getOwner(),
|
||||
auctionItem.getOwnerName(),
|
||||
auctionItem.getItem(),
|
||||
auctionItem.getId(),
|
||||
adminAction,
|
||||
System.currentTimeMillis()
|
||||
);
|
||||
return new AuctionAdminLog(player.getUniqueId(), player.getName(), auctionItem.getOwner(), auctionItem.getOwnerName(), auctionItem.getItem(), auctionItem.getId(), adminAction, System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
@ -20,16 +20,19 @@ package ca.tweetzy.auctionhouse.guis.admin;
|
||||
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionAdminLog;
|
||||
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.guis.abstraction.AuctionPagedGUI;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.gui.events.GuiClickEvent;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import ca.tweetzy.flight.utils.Replacer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* The current file has been created by Kiran Hart
|
||||
@ -37,41 +40,42 @@ import java.util.stream.Collectors;
|
||||
* Time Created: 2:11 p.m.
|
||||
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
|
||||
*/
|
||||
public final class GUIAdminLogs extends AbstractPlaceholderGui {
|
||||
|
||||
final List<AuctionAdminLog> logs;
|
||||
public final class GUIAdminLogs extends AuctionPagedGUI<AuctionAdminLog> {
|
||||
|
||||
public GUIAdminLogs(Player player, List<AuctionAdminLog> logs) {
|
||||
super(player);
|
||||
this.logs = logs;
|
||||
|
||||
setTitle(TextUtils.formatText(Settings.GUI_LOGS_TITLE.getString()));
|
||||
setRows(6);
|
||||
super(null, player, Settings.GUI_LOGS_TITLE.getString(), 6, logs);
|
||||
setAcceptsItems(false);
|
||||
draw();
|
||||
}
|
||||
|
||||
private void draw() {
|
||||
reset();
|
||||
@Override
|
||||
protected void drawFixed() {
|
||||
applyBackExit();
|
||||
}
|
||||
|
||||
pages = (int) Math.max(1, Math.ceil(this.logs.size() / (double) 45));
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
setOnPage(e -> draw());
|
||||
@Override
|
||||
protected void prePopulate() {
|
||||
this.items.sort(Comparator.comparingLong(AuctionAdminLog::getTime).reversed());
|
||||
}
|
||||
|
||||
int slot = 0;
|
||||
List<AuctionAdminLog> data = this.logs.stream().sorted(Comparator.comparingLong(AuctionAdminLog::getTime).reversed()).skip((page - 1) * 45L).limit(45).collect(Collectors.toList());
|
||||
@Override
|
||||
protected ItemStack makeDisplayItem(AuctionAdminLog log) {
|
||||
return QuickItem
|
||||
.of(log.getItem())
|
||||
.name(AuctionAPI.getInstance().getItemName(log.getItem()))
|
||||
.lore(Replacer.replaceVariables(Settings.GUI_LOGS_LORE.getStringList(),
|
||||
"admin", log.getAdminName(),
|
||||
"target", log.getTargetName(),
|
||||
"admin_uuid", log.getAdmin(),
|
||||
"target_uuid", log.getTarget(),
|
||||
"item_id", log.getItemId(),
|
||||
"admin_action", log.getAdminAction().getTranslation(),
|
||||
"admin_log_date", AuctionAPI.getInstance().convertMillisToDate(log.getTime())
|
||||
)).make();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClick(AuctionAdminLog object, GuiClickEvent clickEvent) {
|
||||
|
||||
for (AuctionAdminLog log : data) {
|
||||
setItem(slot++, ConfigurationItemHelper.createConfigurationItem(this.player, log.getItem(), AuctionAPI.getInstance().getItemName(log.getItem()), Settings.GUI_LOGS_LORE.getStringList(), new HashMap<String, Object>() {{
|
||||
put("%admin%", log.getAdminName());
|
||||
put("%target%", log.getTargetName());
|
||||
put("%admin_uuid%", log.getAdmin());
|
||||
put("%target_uuid%", log.getTarget());
|
||||
put("%item_id%", log.getItemId());
|
||||
put("%admin_action%", log.getAdminAction().getTranslation());
|
||||
put("%admin_log_date%", AuctionAPI.getInstance().convertMillisToDate(log.getTime()));
|
||||
}}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user