public int addMember(MapleCharacter member, boolean join) { if (getLeader() == null) { return -1; } final String job = MapleCarnivalChallenge.getJobBasicNameById(member.getJob()); if (join) { if (!containsMember(member) && !getAllNextPlayer().contains(member.getName())) { if (members.size() <= 30) { members.put(member.getName(), job); getLeader().dropMessage(5, member.getName() + " (" + job + ") has joined the fight!"); return 1; } return 2; } return -1; } else { if (containsMember(member)) { members.remove(member.getName()); getLeader() .dropMessage(5, member.getName() + " (" + job + ") have withdrawed from the fight."); return 1; } return -1; } }
public MapleSquad( final int ch, final String type, final MapleCharacter leader, final int expiration, final String toSay) { this.leader = new WeakReference<MapleCharacter>(leader); this.members.put(leader.getName(), MapleCarnivalChallenge.getJobBasicNameById(leader.getJob())); this.leaderName = leader.getName(); this.ch = ch; this.toSay = toSay; this.type = MapleSquadType.valueOf(type.toLowerCase()); this.status = 1; this.beginMapId = leader.getMapId(); leader.getMap().setSquad(this.type); if (this.type.queue.get(ch) == null) { this.type.queue.put(ch, new ArrayList<Pair<String, Long>>()); this.type.queuedPlayers.put(ch, new ArrayList<Pair<String, String>>()); } this.startTime = System.currentTimeMillis(); this.expiration = expiration; }
public void reAddMember(MapleCharacter chr) { removeMember(chr); members.put(chr.getName(), MapleCarnivalChallenge.getJobBasicNameById(chr.getJob())); }