mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-11-21 11:45:11 +01:00
add more null checks
This commit is contained in:
parent
d7e3f775d6
commit
a6d2169103
@ -164,7 +164,11 @@ public class CurrentMenu extends Holder {
|
||||
}
|
||||
|
||||
public void calculateItems() {
|
||||
this.items = this.userManager.getAuctions().get(this.player.getUniqueId());
|
||||
final UUID uuid = this.player.getUniqueId();
|
||||
|
||||
if (this.userManager.hasAuction(uuid)) {
|
||||
this.items = this.userManager.getAuctions(uuid);
|
||||
}
|
||||
|
||||
this.maxPages = getMaxPage(this.items);
|
||||
}
|
||||
|
@ -51,7 +51,11 @@ public class ExpiredMenu extends Holder {
|
||||
"WhatIsThis.Cancelled/ExpiredItems"
|
||||
));
|
||||
|
||||
this.items = this.userManager.getExpiredItems().get(this.player.getUniqueId());
|
||||
final UUID uuid = this.player.getUniqueId();
|
||||
|
||||
if (this.userManager.hasExpiredItem(uuid)) {
|
||||
this.items = this.userManager.getExpiredItems(uuid);
|
||||
}
|
||||
|
||||
this.maxPages = getExpiredMaxPages(this.items == null ? new ArrayList<>() : this.items);
|
||||
|
||||
|
@ -152,6 +152,14 @@ public class UserManager {
|
||||
return this.auctions;
|
||||
}
|
||||
|
||||
public final boolean hasAuction(final UUID uuid) {
|
||||
return this.auctions.containsKey(uuid);
|
||||
}
|
||||
|
||||
public final List<AuctionItem> getAuctions(final UUID uuid) {
|
||||
return this.auctions.get(uuid);
|
||||
}
|
||||
|
||||
public final void updateExpiredCache() {
|
||||
this.expired_items.clear();
|
||||
|
||||
@ -304,6 +312,14 @@ public class UserManager {
|
||||
return this.expired_items;
|
||||
}
|
||||
|
||||
public final boolean hasExpiredItem(final UUID uuid) {
|
||||
return this.expired_items.containsKey(uuid);
|
||||
}
|
||||
|
||||
public final List<ExpiredItem> getExpiredItems(final UUID uuid) {
|
||||
return this.expired_items.get(uuid);
|
||||
}
|
||||
|
||||
public void addActiveAuction(final String uuid, final ConfigurationSection section) {
|
||||
final AuctionItem new_auction = new AuctionItem(uuid, section.getString("name"),
|
||||
section.getName(),
|
||||
|
Loading…
Reference in New Issue
Block a user