mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2025-01-06 19:18:05 +01:00
update current menu
This commit is contained in:
parent
bf6da8b1a7
commit
a9b885d3e6
@ -25,10 +25,6 @@ public class HolderManager {
|
||||
return shopCategory.get(player.getUniqueId());
|
||||
}
|
||||
|
||||
public static Map<UUID, Category> getShopCategory() {
|
||||
return shopCategory;
|
||||
}
|
||||
|
||||
public static void addBidding(final Player player, final int amount) {
|
||||
bidding.put(player.getUniqueId(), amount);
|
||||
}
|
||||
@ -41,10 +37,6 @@ public class HolderManager {
|
||||
return bidding.get(player.getUniqueId());
|
||||
}
|
||||
|
||||
public static Map<UUID, Integer> getBidding() {
|
||||
return bidding;
|
||||
}
|
||||
|
||||
public static boolean containsBidding(final Player player) {
|
||||
return bidding.containsKey(player.getUniqueId());
|
||||
}
|
||||
@ -60,8 +52,4 @@ public class HolderManager {
|
||||
public static ShopType getShopType(final Player player) {
|
||||
return shopTypes.get(player.getUniqueId());
|
||||
}
|
||||
|
||||
public static Map<UUID, ShopType> getShopType() {
|
||||
return shopTypes;
|
||||
}
|
||||
}
|
@ -123,62 +123,56 @@ public class CurrentMenu extends Holder {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<Integer> pages = new ArrayList<>();
|
||||
String id = container.getOrDefault(Keys.auction_item.getNamespacedKey(), PersistentDataType.STRING, "");
|
||||
|
||||
if (pages.size() >= slot) {
|
||||
int id = pages.get(slot);
|
||||
final FileConfiguration data = Files.data.getConfiguration();
|
||||
|
||||
boolean valid = false;
|
||||
final ConfigurationSection section = data.getConfigurationSection("OutOfTime/Cancelled");
|
||||
|
||||
final FileConfiguration data = Files.data.getConfiguration();
|
||||
if (id.isEmpty() || section == null) {
|
||||
menu.click(player);
|
||||
|
||||
final ConfigurationSection section = this.data.getConfigurationSection("Items");
|
||||
GuiManager.openShop(player, HolderManager.getShopType(player), HolderManager.getShopCategory(player), 1);
|
||||
|
||||
if (section != null) {
|
||||
for (String key : section.getKeys(false)) {
|
||||
final ConfigurationSection auction = section.getConfigurationSection(key);
|
||||
player.sendMessage(Messages.ITEM_DOESNT_EXIST.getMessage(player));
|
||||
|
||||
if (auction == null) continue;
|
||||
|
||||
int config_id = auction.getInt("StoreID");
|
||||
|
||||
if (id == config_id) {
|
||||
player.sendMessage(Messages.CANCELLED_ITEM.getMessage(player));
|
||||
|
||||
final String item = auction.getString("Item");
|
||||
|
||||
AuctionCancelledEvent auctionCancelledEvent = new AuctionCancelledEvent(player, Methods.fromBase64(item), Reasons.PLAYER_FORCE_CANCEL);
|
||||
this.plugin.getServer().getPluginManager().callEvent(auctionCancelledEvent);
|
||||
|
||||
int num = 1;
|
||||
for (; data.contains("OutOfTime/Cancelled." + num); num++) ;
|
||||
|
||||
data.set("OutOfTime/Cancelled." + num + ".Seller", auction.getString("Seller"));
|
||||
data.set("OutOfTime/Cancelled." + num + ".Full-Time", auction.getString("Full-Time"));
|
||||
data.set("OutOfTime/Cancelled." + num + ".StoreID",config_id);
|
||||
data.set("OutOfTime/Cancelled." + num + ".Item", item);
|
||||
|
||||
data.set("Items." + key, null);
|
||||
|
||||
Files.data.save();
|
||||
|
||||
menu.click(player);
|
||||
|
||||
GuiManager.openPlayersCurrentList(player, 1);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
menu.click(player);
|
||||
|
||||
GuiManager.openShop(player, HolderManager.getShopType(player), HolderManager.getShopCategory(player), 1);
|
||||
|
||||
player.sendMessage(Messages.ITEM_DOESNT_EXIST.getMessage(player));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final ConfigurationSection auction = section.getConfigurationSection(id);
|
||||
|
||||
if (auction == null) {
|
||||
menu.click(player);
|
||||
|
||||
GuiManager.openShop(player, HolderManager.getShopType(player), HolderManager.getShopCategory(player), 1);
|
||||
|
||||
player.sendMessage(Messages.ITEM_DOESNT_EXIST.getMessage(player));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendMessage(Messages.CANCELLED_ITEM.getMessage(player));
|
||||
|
||||
final String item = auction.getString("Item");
|
||||
|
||||
AuctionCancelledEvent auctionCancelledEvent = new AuctionCancelledEvent(player, Methods.fromBase64(item), Reasons.PLAYER_FORCE_CANCEL);
|
||||
this.plugin.getServer().getPluginManager().callEvent(auctionCancelledEvent);
|
||||
|
||||
int num = 1;
|
||||
for (; data.contains("OutOfTime/Cancelled." + num); num++) ;
|
||||
|
||||
data.set("OutOfTime/Cancelled." + num + ".Seller", auction.getString("Seller"));
|
||||
data.set("OutOfTime/Cancelled." + num + ".Full-Time", auction.getString("Full-Time"));
|
||||
data.set("OutOfTime/Cancelled." + num + ".StoreID", auction.getString("StoreID"));
|
||||
data.set("OutOfTime/Cancelled." + num + ".Item", item);
|
||||
|
||||
data.set("Items." + id, null);
|
||||
|
||||
Files.data.save();
|
||||
|
||||
menu.click(player);
|
||||
|
||||
GuiManager.openPlayersCurrentList(player, 1);
|
||||
}
|
||||
|
||||
private void getItems() {
|
||||
|
Loading…
Reference in New Issue
Block a user