All pastes #25224 Raw Edit

Mine

public java v1 · immutable
#25224 ·published 2005-10-11 14:24 UTC
rendered paste body
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * http://www.gnu.org/copyleft/gpl.html */package net.sf.l2j.gameserver.clientpackets;import java.nio.ByteBuffer;import java.util.logging.Logger;import net.sf.l2j.Config;import net.sf.l2j.gameserver.AllianceTable;import net.sf.l2j.gameserver.ClientThread;import net.sf.l2j.gameserver.model.L2Alliance;import net.sf.l2j.gameserver.model.L2Object;import net.sf.l2j.gameserver.model.L2PcInstance;import net.sf.l2j.gameserver.model.L2World;import net.sf.l2j.gameserver.serverpackets.AskJoinPledge;import net.sf.l2j.gameserver.serverpackets.SystemMessage;/** * This class ... *  * @version $Revision: 1.3.4.4 $ $Date: 2005/03/27 15:29:30 $ */public class RequestJoinAlly extends ClientBasePacket{    private static final String _C__24_REQUESTJOINALLY = "[C] 24 RequestJoinAlly";    static Logger _log = Logger.getLogger(RequestJoinAlly.class.getName());    private final int _target;    private static final int LIMIT = 12;        public RequestJoinAlly(ByteBuffer buf, ClientThread client)    {        super(buf, client);        _target  = readD();    }    void runImpl()    {        L2PcInstance activeChar = getClient().getActiveChar();                if (activeChar.isTransactionInProgress())        {            activeChar.sendPacket(new SystemMessage(SystemMessage.WAITING_FOR_REPLY));            if (Config.DEBUG) _log.fine("player is already doing some other action");            return;        }                if (_target == activeChar.getObjectId())        {            SystemMessage sm = new SystemMessage(SystemMessage.CANNOT_INVITE_YOURSELF);            activeChar.sendPacket(sm);            return;        }                //Is the character the leader of the alliance        if (activeChar.getAlliance().getLeaderId() == activeChar.getObjectId())         {               L2Object object = L2World.getInstance().findObject(_target);            if (object instanceof L2PcInstance)            {                L2PcInstance member = (L2PcInstance) object;                L2Alliance alliance = activeChar.getAlliance();                if (member.getAllianceId() != 0)                {                    SystemMessage sm = new SystemMessage(SystemMessage.S1_WORKING_WITH_ANOTHER_CLAN);                    sm.addString(member.getName());                    activeChar.sendPacket(sm);                    return;                             }                else if (member.isTransactionInProgress())                {                    SystemMessage sm = new SystemMessage(SystemMessage.S1_IS_BUSY_TRY_LATER);                    sm.addString(member.getName());                    activeChar.sendPacket(sm);                    return;                }                 else if (alliance.getMembers().length >= LIMIT)                {                    SystemMessage sm = new SystemMessage(SystemMessage.S1_S2);                    sm.addString("The clan is full, you cannot invite any more players."); // haven't found a sysmsg for this one                    activeChar.sendPacket(sm);                    return;                }                else                {                    member.setTransactionRequester(activeChar);                    activeChar.setTransactionRequester(member);                                        AskJoinPledge ap = new AskJoinPledge(activeChar.getObjectId(), activeChar.getClan().getName());                     member.sendPacket(ap);                }            }        }    }    /* (non-Javadoc)     * @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()     */    public String getType()    {        return _C__24_REQUESTJOINALLY;    }}