sb.append(_text.substring(end, end = m.end()));
}
_text = sb.append(Strings.fromTranslit(_text.substring(end, _text.length()), translit.equals("tl") ? 1 : 2)).toString();
}
Log.LogChat(_type.name(), activeChar.getName(), _target, _text);
Say2 cs = new Say2(activeChar.getObjectId(), _type, activeChar.getName(), _text);
switch (_type)
{
case TELL:
Player receiver = World.getPlayer(_target);
if ((receiver == null) && Config.ALLOW_FAKE_PLAYERS && FakePlayersTable.getActiveFakePlayers().contains(_target))
{
cs = new Say2(activeChar.getObjectId(), _type, "->" + _target, _text);
activeChar.sendPacket(cs);
return;
}
else if ((receiver != null) && receiver.isInOfflineMode())
{
activeChar.sendMessage("The person is in offline trade mode.");
activeChar.sendActionFailed();
}
else if ((receiver != null) && !receiver.isInBlockList(activeChar) && !receiver.isBlockAll())
{
if (!receiver.getMessageRefusal())
{
if (activeChar.antiFlood.canTell(receiver.getObjectId(), _text))
{
receiver.sendPacket(cs);
}
cs = new Say2(activeChar.getObjectId(), _type, "->" + receiver.getName(), _text);
activeChar.sendPacket(cs);
}
else
{
activeChar.sendPacket(Msg.THE_PERSON_IS_IN_A_MESSAGE_REFUSAL_MODE);
}
}
else if (receiver == null)
{
activeChar.sendPacket(new SystemMessage(SystemMessage.S1_IS_NOT_CURRENTLY_LOGGED_IN).addString(_target), ActionFail.STATIC);
}
else
{
activeChar.sendPacket(Msg.YOU_HAVE_BEEN_BLOCKED_FROM_THE_CONTACT_YOU_SELECTED, ActionFail.STATIC);
}
break;
case SHOUT:
if (activeChar.isCursedWeaponEquipped())
{
activeChar.sendPacket(Msg.SHOUT_AND_TRADE_CHATING_CANNOT_BE_USED_SHILE_POSSESSING_A_CURSED_WEAPON);
return;
}
if (activeChar.isInObserverMode())
{
activeChar.sendPacket(Msg.YOU_CANNOT_CHAT_LOCALLY_WHILE_OBSERVING);
return;
}
if (!activeChar.isGM() && !activeChar.antiFlood.canShout(_text))
{
activeChar.sendMessage("Shout chat is allowed once per 5 seconds.");
return;
}
if (Config.GLOBAL_SHOUT)
{
announce(activeChar, cs);
}
else
{
shout(activeChar, cs);
}
activeChar.sendPacket(cs);
break;
case TRADE:
if (activeChar.isCursedWeaponEquipped())
{
activeChar.sendPacket(Msg.SHOUT_AND_TRADE_CHATING_CANNOT_BE_USED_SHILE_POSSESSING_A_CURSED_WEAPON);
return;
}
if (activeChar.isInObserverMode())
{
activeChar.sendPacket(Msg.YOU_CANNOT_CHAT_LOCALLY_WHILE_OBSERVING);
return;
}
if (!activeChar.isGM() && !activeChar.antiFlood.canTrade(_text))
{
activeChar.sendMessage("Trade chat is allowed once per 5 seconds.");
return;
}
if (Config.GLOBAL_TRADE_CHAT)
{
announce(activeChar, cs);
}
else
{
shout(activeChar, cs);
}
activeChar.sendPacket(cs);
break;
case ALL:
if (activeChar.isCursedWeaponEquipped())
{
cs = new Say2(activeChar.getObjectId(), _type, activeChar.getTransformationName(), _text);
}
List<Player> list = null;
if (activeChar.isInObserverMode() && (activeChar.getObserverRegion() != null) && (activeChar.getOlympiadObserveGame() != null))
{
OlympiadGame game = activeChar.getOlympiadObserveGame();