Sync with L2JServer Feb 7th 2015.

This commit is contained in:
mobius
2015-02-07 23:48:56 +00:00
parent 1e166ca657
commit ecd17fdefb
1949 changed files with 3120 additions and 33466 deletions

View File

@ -19,6 +19,7 @@
package handlers.chathandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.enums.ChatType;
import com.l2jserver.gameserver.handler.IChatHandler;
import com.l2jserver.gameserver.model.BlockList;
import com.l2jserver.gameserver.model.L2World;
@ -26,54 +27,49 @@ import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Util;
/**
* Hero chat handler.
* @author durgus
*/
public class ChatHeroVoice implements IChatHandler
public final class ChatHeroVoice implements IChatHandler
{
private static final int[] COMMAND_IDS =
private static final ChatType[] CHAT_TYPES =
{
17
ChatType.HERO_VOICE,
};
/**
* Handle chat type 'hero voice'
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
public void handleChat(ChatType type, L2PcInstance activeChar, String target, String text)
{
if (activeChar.isHero() || activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))
if (!activeChar.isHero() && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))
{
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
activeChar.sendPacket(SystemMessageId.ONLY_HEROES_CAN_ENTER_THE_HERO_CHANNEL);
return;
}
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (!activeChar.getFloodProtectors().getHeroVoice().tryPerformAction("hero voice"))
{
activeChar.sendMessage("Action failed. Heroes are only able to speak in the global channel once every 10 seconds.");
return;
}
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if ((player != null) && !BlockList.isBlocked(player, activeChar))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (!activeChar.getFloodProtectors().getHeroVoice().tryPerformAction("hero voice"))
{
activeChar.sendMessage("Action failed. Heroes are only able to speak in the global channel once every 10 seconds.");
return;
}
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
for (L2PcInstance player : L2World.getInstance().getPlayers())
{
if ((player != null) && !BlockList.isBlocked(player, activeChar))
if (Config.FACTION_SYSTEM_ENABLED)
{
if (Config.FACTION_SYSTEM_ENABLED)
if (Config.FACTION_SPECIFIC_CHAT)
{
if (Config.FACTION_SPECIFIC_CHAT)
{
if ((activeChar.isGood() && player.isGood()) || (activeChar.isEvil() && player.isEvil()))
{
player.sendPacket(cs);
}
}
else
if ((activeChar.isGood() && player.isGood()) || (activeChar.isEvil() && player.isEvil()))
{
player.sendPacket(cs);
}
@ -83,16 +79,17 @@ public class ChatHeroVoice implements IChatHandler
player.sendPacket(cs);
}
}
else
{
player.sendPacket(cs);
}
}
}
}
/**
* Returns the chat types registered to this handler.
*/
@Override
public int[] getChatTypeList()
public ChatType[] getChatTypeList()
{
return COMMAND_IDS;
return CHAT_TYPES;
}
}
}