06-07-2009, 09:14 PM
|
#2 (permalink)
|
|
Banido
Registrado em: Dec 2008
Posts: 52
Agradecido 62 Vezes em 9 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
|
Meu L2Emu tem o seguinte codigo no VoicedCommandHandler.java, como eu add o novo voiced?
/*
* 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.l2emuproject.gameserver.handler;
import javolution.util.FastMap;
import net.l2emuproject.Config;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This class ...
*
* @version $Revision: 1.1.4.5 $ $Date: 2005/03/27 15:30:09 $
*/
public class VoicedCommandHandler
{
private final static Log _log = LogFactory.getLog(ItemHandler.class.getName());
private static VoicedCommandHandler _instance;
private FastMap<String, IVoicedCommandHandler> _datatable;
public static VoicedCommandHandler getInstance()
{
if (_instance == null)
_instance = new VoicedCommandHandler();
return _instance;
}
private VoicedCommandHandler()
{
_datatable = new FastMap<String, IVoicedCommandHandler>();
//_log.info("VoicedCommandHandler: Loaded " + _datatable.size() + " handlers.");
}
public void registerVoicedCommandHandler(IVoicedCommandHandler handler)
{
String[] ids = handler.getVoicedCommandList();
for (String element : ids)
{
if (_log.isDebugEnabled() || Config.DEBUG)
_log.debug("Adding handler for command " + element);
_datatable.put(element, handler);
}
}
public IVoicedCommandHandler getVoicedCommandHandler(String voicedCommand)
{
String command = voicedCommand;
if (voicedCommand.indexOf(" ") != -1)
command = voicedCommand.substring(0, voicedCommand.indexOf(" "));
if (_log.isDebugEnabled() || Config.DEBUG)
_log.debug("getting handler for command: " + command + " -> " + (_datatable.get(command) != null));
return _datatable.get(command);
}
public int size()
{
return _datatable.size();
}
}
|
|
|