/** * Verifies if player can join the given party room and either adds the player to the party room * or sends a message why the player could not join the room.<br> * <I>Parameters may be <CODE>null</CODE>, which guarantees <CODE>false</CODE></I> * * @param activeChar a player * @param room a party room * @param checkForParty whether check if the player is in party/[room] * @return true if player joined the given room, false otherwise */ public static final boolean tryJoin( L2PcInstance activeChar, L2PartyRoom room, boolean checkForParty) { if (activeChar == null) return false; if (checkForParty) { if (activeChar.getPartyRoom() != null || activeChar.getParty() != null) { activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FORBIDDEN); return false; } } if (room == null) { activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FORBIDDEN); return false; } else if (!room.checkLevel(activeChar.getLevel())) { activeChar.sendPacket(SystemMessageId.CANT_ENTER_PARTY_ROOM); return false; } else if (room.getMemberCount() >= room.getMaxMembers()) { activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FULL); return false; } room.addMember(activeChar); return true; }