Jump to content

Question

Posted

/*

* 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 com.it.br.gameserver.handler.chathandlers;

 

import java.util.StringTokenizer;

import java.util.logging.Logger;

 

import com.it.br.Config;

import com.it.br.gameserver.handler.DonatorCommandHandler;

import com.it.br.gameserver.handler.VipCommandHandler;

import com.it.br.gameserver.handler.IChatHandler;

import com.it.br.gameserver.handler.IDonatorCommandHandler;

import com.it.br.gameserver.handler.IVipCommandHandler;

import com.it.br.gameserver.handler.IVoicedCommandHandler;

import com.it.br.gameserver.handler.VoicedCommandHandler;

import com.it.br.gameserver.model.actor.instance.L2PcInstance;

import com.it.br.gameserver.serverpackets.CreatureSay;

 

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'

*

* @see com.it.br.gameserver.handler.IChatHandler#handleChat(int, com.it.br.gameserver.model.actor.instance.L2PcInstance, java.lang.String)

*/

public void handleChat(int type, L2PcInstance activeChar, String target, String text)

{

boolean dcd_used = false;

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);

target = 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, target);

}

else

{

if (Config.DEBUG) {

_log.warning("No handler registered for bypass '" + command + "'");

}

}

}

else

{

CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);

for (L2PcInstance player : activeChar.getKnownList().getKnownPlayers().values())

{

if (player != null && activeChar.isInsideRadius(player, 1250, false, true))

{

if (text.startsWith("!"));

{

tringTokenizer st = new StringTokenizer(text);

IDonatorCommandHandler dch;

String command = "";

if (activeChar.isDonator())

{

if (st.countTokens() > 1)

{

command = st.nextToken().substring(1);

target = text.substring(command.length() + 2);

dch = DonatorCommandHandler.getInstance().getDonatorCommandHandler(command);

}

else

{

command = text.substring(1);

if (Config.DEBUG)

_log.info("Command: " + command);

dch = DonatorCommandHandler.getInstance().getDonatorCommandHandler(command);

}

if (!activeChar.getFloodProtectors().getVoicedCommands().tryPerformAction("voiced command ." + command))

{

activeChar.sendMessage("Do not spam voiced commands.");

return;

}

if (dch != null)

{

dch.useDonatorCommand(command, activeChar, target);

dcd_used = true;

}

else

{

if (Config.DEBUG)

_log.warning("No handler registered for bypass '" + command + "'");

dcd_used = false;

}

}

}

if (!vcd_used || !dcd_used)

{

if (text.startsWith("~"))

{

StringTokenizer st = new StringTokenizer(text);

IVipCommandHandler dch;

String command = "";

if (activeChar.isVip())

{

if (st.countTokens() > 1)

{

command = st.nextToken().substring(1);

target = text.substring(command.length() + 2);

dch = VipCommandHandler.getInstance().getVipCommandHandler(command);

}

else

{

command = text.substring(1);

if (Config.DEBUG)

_log.info("Command: " + command);

dch = VipCommandHandler.getInstance().getVipCommandHandler(command);

}

if (!activeChar.getFloodProtectors().getVoicedCommands().tryPerformAction("voiced command ." + command))

{

activeChar.sendMessage("Do not spam voiced commands.");

return;

}

if (dch != null)

{

dch.useVipCommand(command, activeChar, target);

dcd_used = true;

}

else

{

if (Config.DEBUG)

_log.warning("No handler registered for bypass '" + command + "'");

dcd_used = false;

}

}

  }

if (!vcd_used || !dcd_used)

{

}

player.sendPacket(cs);

}

}

activeChar.sendPacket(cs);

      }

}

      /**

      * Returns the chat types registered to this handler

  *

  * @see com.it.br.gameserver.handler.IChatHandler#getChatTypeList()

  */

public int[] getChatTypeList()

 

{

return COMMAND_IDS;

}

}

---------------PROBLEMS---------------------------------------------------------------------

    [javac] C:\brazil\L2JBrasil\L2JBrasil_CORE\java\com\it\br\gameserver\handler\chathandlers\ChatAll.java:174: illegal start of expression

    [javac] public int[] getChatTypeList()

    [javac] ^

    [javac] C:\brazil\L2JBrasil\L2JBrasil_CORE\java\com\it\br\gameserver\handler\chathandlers\ChatAll.java:174: ';' expected

    [javac] public int[] getChatTypeList()

    [javac]                             ^

    [javac] C:\brazil\L2JBrasil\L2JBrasil_CORE\java\com\it\br\gameserver\handler\chathandlers\ChatAll.java:179: reached end of file while parsing

    [javac] }

-------------------------------------------------------------------------------------------------------------

 

pedia ti problima exei to java? help pliz !

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock