mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-11-22 11:55:12 +01:00
update expired menu
This commit is contained in:
parent
514afb3f0d
commit
bf6da8b1a7
@ -203,40 +203,34 @@ public class ExpiredMenu extends Holder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> pages = new ArrayList<>();
|
String id = container.getOrDefault(Keys.auction_item.getNamespacedKey(), PersistentDataType.STRING, "");
|
||||||
|
|
||||||
if (pages.size() >= slot) {
|
if (id.isEmpty()) return;
|
||||||
int id = pages.get(slot);
|
|
||||||
|
|
||||||
boolean valid = false;
|
|
||||||
|
|
||||||
final FileConfiguration data = Files.data.getConfiguration();
|
|
||||||
|
|
||||||
final ConfigurationSection section = this.data.getConfigurationSection("OutOfTime/Cancelled");
|
|
||||||
|
|
||||||
if (section != null) {
|
|
||||||
for (String key : section.getKeys(false)) {
|
|
||||||
final ConfigurationSection auction = section.getConfigurationSection(key);
|
|
||||||
|
|
||||||
if (auction == null) continue;
|
|
||||||
|
|
||||||
int config_id = auction.getInt("StoreID");
|
|
||||||
|
|
||||||
if (id == config_id) {
|
|
||||||
if (Methods.isInvFull(player)) {
|
if (Methods.isInvFull(player)) {
|
||||||
player.sendMessage(Messages.INVENTORY_FULL.getMessage(player));
|
player.sendMessage(Messages.INVENTORY_FULL.getMessage(player));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendMessage(Messages.GOT_ITEM_BACK.getMessage(player));
|
final FileConfiguration data = Files.data.getConfiguration();
|
||||||
|
|
||||||
|
final ConfigurationSection section = data.getConfigurationSection("OutOfTime/Cancelled");
|
||||||
|
|
||||||
|
if (section == null) return;
|
||||||
|
|
||||||
|
final ConfigurationSection auction = section.getConfigurationSection(id);
|
||||||
|
|
||||||
|
if (auction == null) return;
|
||||||
|
|
||||||
final ItemStack yoink = Methods.fromBase64(auction.getString("Item"));
|
final ItemStack yoink = Methods.fromBase64(auction.getString("Item"));
|
||||||
|
|
||||||
if (yoink != null) {
|
if (yoink != null) {
|
||||||
|
player.sendMessage(Messages.GOT_ITEM_BACK.getMessage(player));
|
||||||
|
|
||||||
player.getInventory().addItem(yoink);
|
player.getInventory().addItem(yoink);
|
||||||
|
|
||||||
data.set("OutOfTime/Cancelled." + key, null);
|
data.set("OutOfTime/Cancelled." + id, null);
|
||||||
|
|
||||||
Files.data.save();
|
Files.data.save();
|
||||||
|
|
||||||
@ -244,15 +238,6 @@ public class ExpiredMenu extends Holder {
|
|||||||
|
|
||||||
GuiManager.openPlayersExpiredList(player, 1);
|
GuiManager.openPlayersExpiredList(player, 1);
|
||||||
} else {
|
} else {
|
||||||
this.plugin.getLogger().warning("The player " + player.getName() + " tried to redeem an invalid item in the expired menu.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!valid) {
|
|
||||||
menu.click(player);
|
menu.click(player);
|
||||||
|
|
||||||
GuiManager.openShop(player, HolderManager.getShopType(player), HolderManager.getShopCategory(player), 1);
|
GuiManager.openShop(player, HolderManager.getShopType(player), HolderManager.getShopCategory(player), 1);
|
||||||
@ -260,7 +245,6 @@ public class ExpiredMenu extends Holder {
|
|||||||
player.sendMessage(Messages.ITEM_DOESNT_EXIST.getMessage(player));
|
player.sendMessage(Messages.ITEM_DOESNT_EXIST.getMessage(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void getItems() {
|
private void getItems() {
|
||||||
final ConfigurationSection section = this.data.getConfigurationSection("OutOfTime/Cancelled");
|
final ConfigurationSection section = this.data.getConfigurationSection("OutOfTime/Cancelled");
|
||||||
|
Loading…
Reference in New Issue
Block a user