Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_DataPack_BETA
- Index: data/scripts/handlers/MasterHandler.java
- ===================================================================
- --- data/scripts/handlers/MasterHandler.java (revision 8223)
- +++ data/scripts/handlers/MasterHandler.java (working copy)
- @@ -243,8 +245,10 @@
- import handlers.usercommandhandlers.OlympiadStat;
- import handlers.usercommandhandlers.PartyInfo;
- import handlers.usercommandhandlers.Time;
- import handlers.voicedcommandhandlers.Banking;
- import handlers.voicedcommandhandlers.ChatAdmin;
- +import handlers.voicedcommandhandlers.Clan;
- import handlers.voicedcommandhandlers.Debug;
- import handlers.voicedcommandhandlers.Lang;
- import handlers.voicedcommandhandlers.TvTVoicedInfo;
- @@ -563,6 +569,8 @@
- VOICE.registerVoicedCommandHandler(new Lang());
- if (Config.L2JMOD_DEBUG_VOICE_COMMAND)
- VOICE.registerVoicedCommandHandler(new Debug());
- + VOICE.registerVoicedCommandHandler(new Clan());
- _log.config("Loaded " + VOICE.size() + " VoicedHandlers");
- }
- Index: data/scripts/handlers/voicedcommandhandlers/Clan.java
- ===================================================================
- --- data/scripts/handlers/voicedcommandhandlers/Clan.java (revision 0)
- +++ data/scripts/handlers/voicedcommandhandlers/Clan.java (revision 0)
- @@ -0,0 +1,102 @@
- +/*
- + * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
- + */
- +package handlers.voicedcommandhandlers;
- +
- +import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
- +import com.l2jserver.gameserver.model.L2Clan.SubPledge;
- +import com.l2jserver.gameserver.model.L2World;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.network.clientpackets.RequestJoinPledge;
- +import com.l2jserver.gameserver.network.serverpackets.AskJoinPledge;
- +
- +/**
- + *
- + * @author horato
- + *
- + * Handler for claninvite command
- + *
- + */
- +public class Clan implements IVoicedCommandHandler
- +{
- + private static final String[] VOICED_COMMANDS = { "claninvite" };
- +
- + /**
- + *
- + * @see com.l2jserver.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
- + */
- + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
- + {
- + if (command.startsWith("claninvite"))
- + {
- + if (params != null && params.length() > 3)
- + invite(activeChar, params);
- + else
- + activeChar.sendMessage("Usage: .claninvite <playerName> <subpledgeName>");
- + }
- + return true;
- + }
- +
- + private void invite(L2PcInstance activeChar, String params)
- + {
- + if (activeChar == null)
- + return;
- + if (activeChar.getClan() == null)
- + {
- + activeChar.sendMessage("You are not in any clan");
- + return;
- + }
- + L2PcInstance player = L2World.getInstance().getPlayer(params.split(" ")[0]);
- +
- + SubPledge subPledge = null;
- + try
- + {
- + subPledge = activeChar.getClan().getSubPledge(params.split(" ")[1]);
- + }
- + catch (Exception e)
- + {
- +
- + }
- +
- + if (!activeChar.getClan().checkClanJoinCondition(activeChar, player, subPledge == null ? 0 : subPledge.getId()))
- + return;
- +
- + try
- + {
- + RequestJoinPledge rjp = new RequestJoinPledge();
- + rjp.setTarget(player.getObjectId());
- + rjp.setPledgeType(subPledge == null ? 0 : subPledge.getId());
- + if (!activeChar.getRequest().setRequest(player, rjp))
- + return;
- + }
- + catch (Exception e)
- + {
- + e.printStackTrace();
- + }
- +
- + if (subPledge == null)
- + player.sendPacket(new AskJoinPledge(activeChar.getObjectId(), null, 0, activeChar.getClan().getName()));
- + else
- + player.sendPacket(new AskJoinPledge(activeChar.getObjectId(), activeChar.getClan().getName(), subPledge.getId(), subPledge.getName()));
- + }
- +
- + /**
- + *
- + * @see com.l2jserver.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
- + */
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement