Method:
public Auction getAuction(UUID id) {
System.out.println("count: " + auctions.size());
if (!doesAuctionExist(id))
return null;
UUID owner = UUID.fromString(Main.getAuctionsFile().getConfiguration().getString("auctions."+id.toString()+".owner"));
Bukkit.getPlayer("NoneTaken").sendMessage("owner "+owner);
long price = Main.getAuctionsFile().getConfiguration().getLong("auctions." + id.toString() + ".price");
boolean useTokens = Main.getAuctionsFile().getConfiguration().getBoolean("auctions." + id.toString() + ".useTokens");
long timeCreated = Main.getAuctionsFile().getConfiguration().getLong("auctions." + id.toString() + ".timeCreated");
ItemStack item = (ItemStack) Main.getAuctionsFile().getConfiguration().get("auctions." + id.toString() + ".item");
Bukkit.getPlayer("NoneTaken").sendMessage("null: " + (owner == null));
return new Auction(
owner,
item,
price,
useTokens,
id,
timeCreated);
}
Constructor:
public Auction(UUID owner, ItemStack item, long price, boolean useTokens, UUID identifier, long timeCreated) {
this.owner = owner;
this.item = item;
this.price = price;
this.useTokens = useTokens;
this.identifier = identifier;
this.timeCreated = timeCreated;
Main.getAuctionManager().registerAuction(this);
}
Error:
18.10 17:12:12 [Server] ERROR Error occurred while enabling BanditAH v1.0 (Is it up to date?)
18.10 17:12:12 [Server] INFO java.lang.NullPointerException
18.10 17:12:12 [Server] INFO at me.nonetaken.banditah.managers.Auction.<init>(Auction.java:28) ~[?:?]
18.10 17:12:12 [Server] INFO at me.nonetaken.banditah.managers.AuctionManager.getAuction(AuctionManager.java:86) ~[?:?]
18.10 17:12:12 [Server] INFO at me.nonetaken.banditah.managers.AuctionManager.<init>(AuctionManager.java:28) ~[?:?]
Line 86 in AuctionManager.java is the owner,
line in the constructor in the first block of code.
The message sending "null: true/false" always returns false, thus the object can't be null but an NPE is being thrown in the error on that line.
Any help is appreciated :)