Untitled
unknown
plain_text
3 years ago
1.1 kB
9
Indexable
package ballistickemu.Types;
import ballistickemu.Tools.DatabaseTools;
import java.sql.ResultSet;
import java.util.LinkedHashMap;
public class StickShop
{
private LinkedHashMap<Integer, Integer> ShopList;
public StickShop()
{
this.ShopList = new LinkedHashMap();
}
public int getPriceByItemID(int itemID)
{
if (this.ShopList.containsKey(Integer.valueOf(itemID)))
{
return ((Integer)this.ShopList.get(Integer.valueOf(itemID))).intValue();
}
return -1;
}
public Boolean PopulateShop()
{
try
{
ResultSet rs = DatabaseTools.executeSelectQuery("select * from shop");
while (rs.next())
{
int IID = rs.getInt("itemID");
int cost = rs.getInt("cost");
this.ShopList.put(Integer.valueOf(IID), Integer.valueOf(cost));
}
if (this.ShopList.size() > 1) {
return Boolean.valueOf(true);
}
return Boolean.valueOf(false);
}
catch (Exception e)
{
e.printStackTrace(); }
return Boolean.valueOf(false);
}
}Editor is loading...