public void copy() { while (type.queue.get(ch).size() > 0 && ChannelServer.getInstance(ch).getMapleSquad(type) == null) { int index = 0; long lowest = 0; for (int i = 0; i < type.queue.get(ch).size(); i++) { if (lowest == 0 || type.queue.get(ch).get(i).right < lowest) { index = i; lowest = type.queue.get(ch).get(i).right; } } final String nextPlayerId = type.queue.get(ch).remove(index).left; final int theirCh = World.Find.findChannel(nextPlayerId); if (theirCh > 0) { final MapleCharacter lead = ChannelServer.getInstance(theirCh).getPlayerStorage().getCharacterByName(nextPlayerId); if (lead != null && lead.getMapId() == beginMapId && lead.getClient().getChannel() == ch) { final MapleSquad squad = new MapleSquad(ch, type.name(), lead, expiration, toSay); if (ChannelServer.getInstance(ch).addMapleSquad(squad, type.name())) { getBeginMap().broadcastMessage(CField.getClock(expiration / 1000)); getBeginMap().broadcastMessage(CWvsContext.serverNotice(6, nextPlayerId + toSay)); type.queuedPlayers.get(ch).add(new Pair<String, String>(nextPlayerId, "Success")); } else { squad.clear(); type.queuedPlayers.get(ch).add(new Pair<String, String>(nextPlayerId, "Skipped")); } break; } else { if (lead != null) { lead.dropMessage( 6, "Your squad has been skipped due to you not being in the right channel and map."); } getBeginMap() .broadcastMessage( CWvsContext.serverNotice( 6, nextPlayerId + "'s squad has been skipped due to the player not being in the right channel and map.")); type.queuedPlayers.get(ch).add(new Pair<String, String>(nextPlayerId, "Not in map")); } } else { getBeginMap() .broadcastMessage( CWvsContext.serverNotice( 6, nextPlayerId + "'s squad has been skipped due to the player not being online.")); type.queuedPlayers.get(ch).add(new Pair<String, String>(nextPlayerId, "Not online")); } } }