Geoffrey-MC-Plugin/src/main/java/com/zerohighdef/geoffrey/Models/GeoffreyItemListing.java

42 lines
1.1 KiB
Java

package com.zerohighdef.geoffrey.Models;
import com.google.gson.JsonObject;
public class GeoffreyItemListing {
private int amount;
private int price;
private int daysSinceRestock;
private String itemName;
public GeoffreyItemListing(JsonObject itemListingJSON) {
this.amount = itemListingJSON.get("amount").getAsInt();
this.price = itemListingJSON.get("price").getAsInt();
this.itemName = itemListingJSON.get("item_name").getAsString();
this.daysSinceRestock = itemListingJSON.get("days_since_restock").getAsInt();
}
public GeoffreyItemListing(int amount, int price, int daysSinceRestock, String itemName) {
this.amount = amount;
this.price = price;
this.itemName = itemName;
this.daysSinceRestock = daysSinceRestock;
}
public int getAmount() {
return amount;
}
public String getItemName() {
return itemName;
}
public String getFormattedItemListing() {
return amount + " " + itemName + " for " + price + "D, restocked " + daysSinceRestock + " day(s) ago" ;
}
public int getPrice() {
return price;
}
}