Кто бы подсказал что я не так сделал не компилица просто
Index: /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java (revision 12)
+++ /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java (revision 12)
@@ -0,0 +1,71 @@
+/*
+ * 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 net.sf.l2j.gameserver.handler;
+
+import gnu.trove.map.hash.TIntObjectHashMap;
+
+import java.util.logging.Logger;
+
+import net.sf.l2j.Config;
+
+public class VoicedCommandHandler
+{
+ private static Logger _log = Logger.getLogger(ItemHandler.class.getName());
+
+ private final TIntObjectHashMap<IVoicedCommandHandler> _datatable;
+
+ public static VoicedCommandHandler getInstance()
+ {
+ return SingletonHolder._instance;
+ }
+
+ protected VoicedCommandHandler()
+ {
+ _datatable = new TIntObjectHashMap<>();
+ }
+
+ public void registerHandler(IVoicedCommandHandler handler)
+ {
+ String[] ids = handler.getVoicedCommandList();
+ for (int i = 0; i < ids.length; i++)
+ {
+ if (Config.DEBUG)
+ _log.fine("Adding handler for command " + ids[i]);
+ _datatable.put(ids[i].hashCode(), handler);
+ }
+ }
+
+ public IVoicedCommandHandler getHandler(String voicedCommand)
+ {
+ String command = voicedCommand;
+ if (voicedCommand.indexOf(" ") != -1)
+ {
+ command = voicedCommand.substring(0, voicedCommand.indexOf(" "));
+ }
+ if (Config.DEBUG)
+ _log.fine("getting handler for command: " + command + " -> " + (_datatable.get(command.hashCode()) != null));
+ return _datatable.get(command.hashCode());
+ }
+
+ public int size()
+ {
+ return _datatable.size();
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final VoicedCommandHandler _instance = new VoicedCommandHandler();
+ }
+}
Index: /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java
===================================================================
--- /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java (revision 12)
+++ /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java (revision 12)
@@ -0,0 +1,28 @@
+/*
+ * 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 net.sf.l2j.gameserver.handler;
+
+import java.util.logging.Logger;
+
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+public interface IVoicedCommandHandler
+{
+ public static Logger _log = Logger.getLogger(IVoicedCommandHandler.class.getName());
+
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params);
+
+ public String[] getVoicedCommandList();
+}
Index: /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java
===================================================================
--- /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java (revision 11)
+++ /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java (revision 12)
@@ -15,5 +15,9 @@
package net.sf.l2j.gameserver.handler.chathandlers;
+import java.util.StringTokenizer;
+
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;
@@ -38,13 +42,41 @@
public void handleChat(int type, L2PcInstance activeChar, String params, String text)
{
- CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
-
- for (L2PcInstance player : activeChar.getKnownList().getKnownPlayers())
- {
- if (activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar))
- player.sendPacket(cs);
- }
-
- activeChar.sendPacket(cs);
+ boolean vcd_used = false;
+ if (text.startsWith("."))
+ {
+ StringTokenizer st = new StringTokenizer(text);
+ IVoicedCommandHandler vch;
+ String command = "";
+
+ if (st.countTokens() > 1)
+ {
+ command = st.nextToken().substring(1);
+ params = text.substring(command.length() + 2);
+ vch = VoicedCommandHandler.getInstance().getHandler(command);
+ }
+ else
+ {
+ command = text.substring(1);
+ vch = VoicedCommandHandler.getInstance().getHandler(command);
+ }
+
+ if (vch != null)
+ {
+ vch.useVoicedCommand(command, activeChar, params);
+ vcd_used = true;
+ }
+ }
+ if (!vcd_used)
+ {
+ CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
+
+ for (L2PcInstance player : activeChar.getKnownList().getKnownPlayers())
+ {
+ if (activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar))
+ player.sendPacket(cs);
+ }
+
+ activeChar.sendPacket(cs);
+ }
}
Index: /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java (revision 11)
+++ /trunk/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java (revision 12)
@@ -63,4 +63,5 @@
import net.sf.l2j.gameserver.handler.SkillHandler;
import net.sf.l2j.gameserver.handler.UserCommandHandler;
+import net.sf.l2j.gameserver.handler.VoicedCommandHandler;
import net.sf.l2j.gameserver.idfactory.IdFactory;
import net.sf.l2j.gameserver.instancemanager.AuctionManager;
@@ -271,4 +272,5 @@
_log.config("SkillHandler: Loaded " + SkillHandler.getInstance().size() + " handlers.");
_log.config("UserCommandHandler: Loaded " + UserCommandHandler.getInstance().size() + " handlers.");
+ _log.config("VoicedCommandHandler: Loaded " + VoicedCommandHandler.getInstance().size() + " handlers.");
if (Config.ALLOW_WEDDING)