/** * see CommandHelper.marketAdd() for now * * @param sender * @param args * @return */ private boolean marketAdd(CommandSender sender, String[] args) { String addendNumber = null, addendData = null, addendName = null, addendValue = null, addendMinValue = null, addendMaxValue = null, addendChangeRate = null, addendSpread = null; try { addendNumber = args[1]; addendData = args[2]; addendName = args[3]; addendValue = args[4]; addendMinValue = args[5]; addendMaxValue = args[6]; addendChangeRate = args[7]; addendSpread = args[8]; } catch (ArrayIndexOutOfBoundsException e) { new CommandHelper("Too few arguments", sender).marketAddHelp(); return false; } Commodities commodity = new Commodities(); try { commodity.setNumber(Integer.valueOf(addendNumber)); commodity.setData(Integer.valueOf(addendData)); commodity.setName(addendName); commodity.setValue(Double.valueOf(addendValue)); commodity.setMaxValue(Double.valueOf(addendMaxValue)); commodity.setMinValue(Double.valueOf(addendMinValue)); commodity.setChangeRate(Double.valueOf(addendChangeRate)); commodity.setSpread(Double.valueOf(addendSpread)); } catch (NumberFormatException e) { new CommandHelper("Invalid Arguments", sender).marketAddHelp(); return false; } System.out.println(commodity.toString()); try { new CommodityDBAdder(this).addCommodity(commodity); } catch (DuplicateCommodityException e) { sender.sendMessage(e.getMessage()); return false; } sender.sendMessage(commodity.getName() + " successfully added to the database"); return true; }