public boolean addLot(ItemStack item) { AuctionableItem ai = auctionConfig.getAuctionableItemConfig(item); if (null == ai) return false; double startingPrice = (((int) (ai.getStartingPrice() * 100)) * item.getAmount()) / 100D; double minimumIncrement = (((int) (ai.getMinimumIncrement() * 100)) * item.getAmount()) / 100D; Lot lot = new Lot( item, false, startingPrice, null, null, -1, minimumIncrement, System.currentTimeMillis() + ai.getPreserveTimeInSeconds() * 1000, ai.getAuctionDurationInSeconds() * 1000); lots.add(lot); LotShowcase.updateAll(); return true; }
public boolean isVaultAvailable(Player p) { String vaultPath = new StringBuilder(43).append("vaults.").append(p.getUniqueId()).toString(); ConfigurationSection singlePlayerVaultSection = data.getConfigurationSection(vaultPath); return singlePlayerVaultSection.getInt("itemCount", 0) < auctionConfig.getVaultCapacity(p); }
public boolean occupyVault(Player p) { String vaultPath = new StringBuilder(43).append("vaults.").append(p.getUniqueId()).toString(); ConfigurationSection singlePlayerVaultSection = data.getConfigurationSection(vaultPath); int itemCount = singlePlayerVaultSection.getInt("itemCount", 0); if (itemCount < auctionConfig.getVaultCapacity(p)) { singlePlayerVaultSection.set("itemCount", ++itemCount); return true; } else { return false; } }