public Object setState(State state) { // remove drops from previous state if (drops != null) { for (Iterator> i = drops.values().iterator(); i.hasNext(); ) { ArrayList lst = i.next(); for (Iterator ds = lst.iterator(); ds.hasNext(); ) { L2DropData d = ds.next(); String[] states = d.getStateIDs(); for (int k=0; k < states.length; k++) { if (this.state.getName().equals(states[k])) { ds.remove(); break; } } } if (lst == null || lst.size() == 0) i.remove(); } } // set new state this.state = state; // add drops from new state if (state != null && !completed) { HashMap> new_drops = state.getDrops(); if (new_drops != null) { if (drops == null) drops = new HashMap>(); drops.putAll(new_drops); } } Quest.updateQuestInDb(this); QuestList ql = new QuestList(); player.sendPacket(ql); return state; }