Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java (revision 86)
- +++ java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java (working copy)
- @@ -15,8 +15,13 @@
- package net.sf.l2j.gameserver.handler.chathandlers;
- import java.util.Collection;
- +import java.util.StringTokenizer;
- +import java.util.logging.Logger;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.handler.IChatHandler;
- +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
- +import net.sf.l2j.gameserver.handler.VoicedCommandHandler;
- import net.sf.l2j.gameserver.model.BlockList;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- @@ -29,6 +34,7 @@
- public class ChatAll implements IChatHandler
- {
- private static final int[] COMMAND_IDS = { 0 };
- + private static Logger _log = Logger.getLogger(ChatAll.class.getName());
- /**
- * Handle chat type 'all'
- @@ -36,16 +42,53 @@
- */
- public void handleChat(int type, L2PcInstance activeChar, String params, String text)
- {
- - CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
- - Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values();
- -
- - for (L2PcInstance player : plrs)
- + boolean vcd_used = false;
- + if (text.startsWith("."))
- {
- - if (player != null && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar))
- - player.sendPacket(cs);
- - }
- + StringTokenizer st = new StringTokenizer(text);
- + IVoicedCommandHandler vch;
- + String command = "";
- - activeChar.sendPacket(cs);
- + if (st.countTokens() > 1)
- + {
- + command = st.nextToken().substring(1);
- + params = text.substring(command.length() + 2);
- + vch = VoicedCommandHandler.getInstance().getVoicedCommandHandler(command);
- + }
- + else
- + {
- + command = text.substring(1);
- + if (Config.DEBUG)
- + _log.info("Command: " + command);
- + vch = VoicedCommandHandler.getInstance().getVoicedCommandHandler(command);
- + }
- +
- + if (vch != null)
- + {
- + vch.useVoicedCommand(command, activeChar, params);
- + vcd_used = true;
- + }
- + else
- + {
- + if (Config.DEBUG)
- + _log.warning("No handler registered for bypass '" + command + "'");
- + vcd_used = false;
- + }
- + }
- +
- + if (!vcd_used)
- + {
- + CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
- + Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values();
- +
- + for (L2PcInstance player : plrs)
- + {
- + if (player != null && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar))
- + player.sendPacket(cs);
- + }
- +
- + activeChar.sendPacket(cs);
- + }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement