Sync with L2JServer Feb 7th 2015.
This commit is contained in:
@ -25,6 +25,7 @@ import javolution.text.TextBuilder;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.data.xml.impl.AdminData;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
@ -32,7 +33,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Hero;
|
||||
import com.l2jserver.gameserver.model.olympiad.Olympiad;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.Say2;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExWorldChatCnt;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
@ -311,7 +311,7 @@ public class AdminAdmin implements IAdminCommandHandler
|
||||
sb.append(" ");
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar, Say2.GLOBAL, sb.toString());
|
||||
final CreatureSay cs = new CreatureSay(activeChar, ChatType.GLOBAL, sb.toString());
|
||||
L2World.getInstance().getPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo);
|
||||
break;
|
||||
}
|
||||
|
@ -681,19 +681,19 @@ public class AdminEffects implements IAdminCommandHandler
|
||||
{
|
||||
try
|
||||
{
|
||||
if (target instanceof L2Character)
|
||||
if (target.isCharacter())
|
||||
{
|
||||
if (target instanceof L2ChestInstance)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.NOTHING_HAPPENED);
|
||||
return false;
|
||||
}
|
||||
if ((target instanceof L2Npc) && ((action < 1) || (action > 3)))
|
||||
if ((target.isNpc()) && ((action < 1) || (action > 20)))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.NOTHING_HAPPENED);
|
||||
return false;
|
||||
}
|
||||
if ((target instanceof L2PcInstance) && ((action < 2) || ((action > 18) && (action != SocialAction.LEVEL_UP))))
|
||||
if ((target.isPlayer()) && ((action < 2) || ((action > 18) && (action != SocialAction.LEVEL_UP))))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.NOTHING_HAPPENED);
|
||||
return false;
|
||||
|
@ -19,12 +19,12 @@
|
||||
package handlers.admincommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.AdminData;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.Say2;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
@ -115,7 +115,7 @@ public class AdminGmChat implements IAdminCommandHandler
|
||||
offset = 13;
|
||||
}
|
||||
text = command.substring(offset);
|
||||
CreatureSay cs = new CreatureSay(0, Say2.ALLIANCE, activeChar.getName(), text);
|
||||
CreatureSay cs = new CreatureSay(0, ChatType.ALLIANCE, activeChar.getName(), text);
|
||||
AdminData.getInstance().broadcastToGMs(cs);
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e)
|
||||
|
@ -18,13 +18,13 @@
|
||||
*/
|
||||
package handlers.admincommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2StaticObjectInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.Say2;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
@ -54,7 +54,7 @@ public class AdminTargetSay implements IAdminCommandHandler
|
||||
|
||||
final String message = command.substring(16);
|
||||
final L2Character target = (L2Character) obj;
|
||||
target.broadcastPacket(new CreatureSay(target.getObjectId(), (target.isPlayer() ? Say2.ALL : Say2.NPC_ALL), target.getName(), message));
|
||||
target.broadcastPacket(new CreatureSay(target.getObjectId(), target.isPlayer() ? ChatType.GENERAL : ChatType.NPC_GENERAL, target.getName(), message));
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e)
|
||||
{
|
||||
|
@ -18,44 +18,42 @@
|
||||
*/
|
||||
package handlers.chathandlers;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.handler.VoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.model.BlockList;
|
||||
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;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
* General Chat Handler.
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatAll implements IChatHandler
|
||||
public final class ChatAll implements IChatHandler
|
||||
{
|
||||
private static Logger _log = Logger.getLogger(ChatAll.class.getName());
|
||||
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
0
|
||||
ChatType.GENERAL,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'all'
|
||||
*/
|
||||
@Override
|
||||
public void handleChat(int type, L2PcInstance activeChar, String params, String text)
|
||||
public void handleChat(ChatType type, L2PcInstance activeChar, String params, String text)
|
||||
{
|
||||
boolean vcd_used = false;
|
||||
if (text.startsWith("."))
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(text);
|
||||
IVoicedCommandHandler vch;
|
||||
final StringTokenizer st = new StringTokenizer(text);
|
||||
final IVoicedCommandHandler vch;
|
||||
String command = "";
|
||||
|
||||
if (st.countTokens() > 1)
|
||||
@ -87,42 +85,34 @@ public class ChatAll implements IChatHandler
|
||||
vcd_used = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!vcd_used)
|
||||
{
|
||||
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Match the character "." literally (Exactly 1 time) Match any character that is NOT a . character. Between one and unlimited times as possible, giving back as needed (greedy)
|
||||
*/
|
||||
if (text.matches("\\.{1}[^\\.]+"))
|
||||
if ((activeChar.getLevel() < Config.MINIMUM_CHAT_LEVEL) && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INCORRECT_SYNTAX);
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PLAYERS_CAN_USE_GENERAL_CHAT_AFTER_LV_S1).addInt(Config.MINIMUM_CHAT_LEVEL));
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), text);
|
||||
final CreatureSay csRandom = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(text));
|
||||
for (L2PcInstance player : activeChar.getKnownList().getKnownPlayers().values())
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), text);
|
||||
CreatureSay csRandom = new CreatureSay(activeChar.getObjectId(), type, activeChar.getAppearance().getVisibleName(), ChatRandomizer.randomize(text));
|
||||
Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values();
|
||||
for (L2PcInstance player : plrs)
|
||||
if ((player != null) && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar))
|
||||
{
|
||||
if ((player != null) && activeChar.isInsideRadius(player, 1250, false, true) && !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.isEvil()) || (activeChar.isEvil() && player.isGood()))
|
||||
{
|
||||
if ((activeChar.isGood() && player.isEvil()) || (activeChar.isEvil() && player.isGood()))
|
||||
{
|
||||
player.sendPacket(csRandom);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
player.sendPacket(csRandom);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -134,19 +124,20 @@ public class ChatAll implements IChatHandler
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
|
||||
activeChar.sendPacket(cs);
|
||||
}
|
||||
|
||||
activeChar.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler.
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,44 +19,42 @@
|
||||
package handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
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;
|
||||
|
||||
public class ChatAlliance implements IChatHandler
|
||||
/**
|
||||
* Alliance Chat Handler.
|
||||
*/
|
||||
public final class ChatAlliance implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
9
|
||||
ChatType.ALLIANCE,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'alliance'
|
||||
*/
|
||||
@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.getClan() != null)
|
||||
if ((activeChar.getClan() == null) || ((activeChar.getClan() != null) && (activeChar.getClan().getAllyId() == 0)))
|
||||
{
|
||||
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, 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;
|
||||
}
|
||||
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
activeChar.getClan().broadcastToOnlineAllyMembers(cs);
|
||||
activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_IN_AN_ALLIANCE);
|
||||
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;
|
||||
}
|
||||
activeChar.getClan().broadcastToOnlineAllyMembers(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler.
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,48 +19,43 @@
|
||||
package handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
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;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
* Clan chat handler
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatClan implements IChatHandler
|
||||
public final class ChatClan implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
4
|
||||
ChatType.CLAN,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'clan'
|
||||
*/
|
||||
@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.getClan() != null)
|
||||
if (activeChar.getClan() == null)
|
||||
{
|
||||
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, 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;
|
||||
}
|
||||
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
activeChar.getClan().broadcastCSToOnlineMembers(cs, activeChar);
|
||||
activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_IN_A_CLAN);
|
||||
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;
|
||||
}
|
||||
activeChar.getClan().broadcastCSToOnlineMembers(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler.
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,48 +19,43 @@
|
||||
package handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
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;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
* Party chat handler.
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatParty implements IChatHandler
|
||||
public final class ChatParty implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
3
|
||||
ChatType.PARTY,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'party'
|
||||
*/
|
||||
@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.isInParty())
|
||||
if (!activeChar.isInParty())
|
||||
{
|
||||
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, 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;
|
||||
}
|
||||
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
activeChar.getParty().broadcastCreatureSay(cs, activeChar);
|
||||
activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_IN_A_PARTY);
|
||||
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;
|
||||
}
|
||||
activeChar.getParty().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler.
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,43 +19,40 @@
|
||||
package handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
import com.l2jserver.gameserver.model.PartyMatchRoom;
|
||||
import com.l2jserver.gameserver.model.PartyMatchRoomList;
|
||||
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;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
* Party Match Room chat handler.
|
||||
* @author Gnacik
|
||||
*/
|
||||
public class ChatPartyMatchRoom implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
14
|
||||
ChatType.PARTYMATCH_ROOM,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'partymatchroom'
|
||||
*/
|
||||
@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.isInPartyMatchRoom())
|
||||
{
|
||||
PartyMatchRoom _room = PartyMatchRoomList.getInstance().getPlayerRoom(activeChar);
|
||||
final PartyMatchRoom _room = PartyMatchRoomList.getInstance().getPlayerRoom(activeChar);
|
||||
if (_room != null)
|
||||
{
|
||||
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
|
||||
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;
|
||||
}
|
||||
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
for (L2PcInstance _member : _room.getPartyMembers())
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
@ -81,17 +78,9 @@ public class ChatPartyMatchRoom implements IChatHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new ChatPartyMatchRoom();
|
||||
}
|
||||
}
|
||||
}
|
@ -19,51 +19,43 @@
|
||||
package handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
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;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
* Party Room All chat handler.
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatPartyRoomAll implements IChatHandler
|
||||
public final class ChatPartyRoomAll implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
16
|
||||
ChatType.PARTYROOM_ALL,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'party room all'
|
||||
*/
|
||||
@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.isInParty())
|
||||
{
|
||||
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
|
||||
{
|
||||
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
|
||||
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;
|
||||
}
|
||||
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
activeChar.getParty().getCommandChannel().broadcastCreatureSay(cs, activeChar);
|
||||
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler.
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,51 +19,43 @@
|
||||
package handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
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;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
* Party Room Commander chat handler.
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatPartyRoomCommander implements IChatHandler
|
||||
public final class ChatPartyRoomCommander implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
15
|
||||
ChatType.PARTYROOM_COMMANDER,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'party room commander'
|
||||
*/
|
||||
@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.isInParty())
|
||||
{
|
||||
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
|
||||
{
|
||||
if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
|
||||
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;
|
||||
}
|
||||
|
||||
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
activeChar.getParty().getCommandChannel().broadcastCreatureSay(cs, activeChar);
|
||||
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler.
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,31 +19,28 @@
|
||||
package handlers.chathandlers;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.PetitionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* A chat handler
|
||||
* Petition chat handler.
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatPetition implements IChatHandler
|
||||
public final class ChatPetition implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
6,
|
||||
7
|
||||
ChatType.PETITION_PLAYER,
|
||||
ChatType.PETITION_GM,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'petition player'
|
||||
*/
|
||||
@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.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
|
||||
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;
|
||||
@ -54,16 +51,12 @@ public class ChatPetition implements IChatHandler
|
||||
activeChar.sendPacket(SystemMessageId.YOU_ARE_CURRENTLY_NOT_IN_A_PETITION_CHAT);
|
||||
return;
|
||||
}
|
||||
|
||||
PetitionManager.getInstance().sendActivePetitionMessage(activeChar, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler.
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -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.instancemanager.MapRegionManager;
|
||||
import com.l2jserver.gameserver.model.BlockList;
|
||||
@ -27,35 +28,38 @@ 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;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Shout chat handler.
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatShout implements IChatHandler
|
||||
public final class ChatShout implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
1
|
||||
ChatType.SHOUT,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'shout'
|
||||
*/
|
||||
@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.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
|
||||
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.getLevel() < Config.MINIMUM_CHAT_LEVEL) && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PLAYERS_CAN_SHOUT_AFTER_LV_S1).addInt(Config.MINIMUM_CHAT_LEVEL));
|
||||
return;
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS)))
|
||||
{
|
||||
int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
|
||||
final int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
|
||||
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
||||
{
|
||||
if ((region == MapRegionManager.getInstance().getMapRegionLocId(player)) && !BlockList.isBlocked(player, activeChar) && (player.getInstanceId() == activeChar.getInstanceId()))
|
||||
@ -119,12 +123,9 @@ public class ChatShout implements IChatHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler.
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -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,26 +27,23 @@ 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;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Tell chat handler.
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatTell implements IChatHandler
|
||||
public final class ChatTell implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
2
|
||||
ChatType.TELL,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'tell'
|
||||
*/
|
||||
@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.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
|
||||
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;
|
||||
@ -63,9 +61,7 @@ public class ChatTell implements IChatHandler
|
||||
return;
|
||||
}
|
||||
|
||||
L2PcInstance receiver = null;
|
||||
|
||||
receiver = L2World.getInstance().getPlayer(target);
|
||||
final L2PcInstance receiver = L2World.getInstance().getPlayer(target);
|
||||
|
||||
if ((receiver != null) && !receiver.isSilenceMode(activeChar.getObjectId()))
|
||||
{
|
||||
@ -74,22 +70,27 @@ public class ChatTell implements IChatHandler
|
||||
activeChar.sendMessage("Player is in jail.");
|
||||
return;
|
||||
}
|
||||
if (receiver.isChatBanned())
|
||||
else if (receiver.isChatBanned())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THAT_PERSON_IS_IN_MESSAGE_REFUSAL_MODE);
|
||||
return;
|
||||
}
|
||||
if ((receiver.getClient() == null) || receiver.getClient().isDetached())
|
||||
else if ((receiver.getClient() == null) || receiver.getClient().isDetached())
|
||||
{
|
||||
activeChar.sendMessage("Player is in offline mode.");
|
||||
return;
|
||||
}
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT && ((activeChar.isGood() && receiver.isEvil()) || (activeChar.isEvil() && receiver.isGood())))
|
||||
else if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT && ((activeChar.isGood() && receiver.isEvil()) || (activeChar.isEvil() && receiver.isGood())))
|
||||
{
|
||||
activeChar.sendMessage("Player belongs to the opposing faction.");
|
||||
return;
|
||||
}
|
||||
if (!BlockList.isBlocked(receiver, activeChar))
|
||||
else if ((activeChar.getLevel() < Config.MINIMUM_CHAT_LEVEL) && !activeChar.getWhisperers().contains(receiver.getObjectId()) && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PLAYERS_CAN_RESPOND_TO_A_WHISPER_BUT_CANNOT_INITIATE_A_WHISPER_UNTIL_LV_S1).addInt(Config.MINIMUM_CHAT_LEVEL));
|
||||
return;
|
||||
}
|
||||
else if (!BlockList.isBlocked(receiver, activeChar))
|
||||
{
|
||||
// Allow reciever to send PMs to this char, which is in silence mode.
|
||||
if (Config.SILENCE_MODE_EXCLUDE && activeChar.isSilenceMode())
|
||||
@ -97,6 +98,7 @@ public class ChatTell implements IChatHandler
|
||||
activeChar.addSilenceModeExcluded(receiver.getObjectId());
|
||||
}
|
||||
|
||||
receiver.getWhisperers().add(activeChar.getObjectId());
|
||||
receiver.sendPacket(new CreatureSay(activeChar, receiver, activeChar.getName(), type, text));
|
||||
activeChar.sendPacket(new CreatureSay(activeChar, receiver, "->" + receiver.getName(), type, text));
|
||||
}
|
||||
@ -111,12 +113,9 @@ public class ChatTell implements IChatHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler.
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -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.instancemanager.MapRegionManager;
|
||||
import com.l2jserver.gameserver.model.BlockList;
|
||||
@ -27,31 +28,34 @@ 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;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Trade chat handler.
|
||||
* @author durgus
|
||||
*/
|
||||
public class ChatTrade implements IChatHandler
|
||||
public final class ChatTrade implements IChatHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
8
|
||||
ChatType.TRADE,
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle chat type 'trade'
|
||||
*/
|
||||
@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.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
|
||||
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.getLevel() < 20)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PLAYERS_CAN_USE_TRADE_CHAT_AFTER_LV_S1).addInt(20));
|
||||
return;
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS)))
|
||||
{
|
||||
@ -116,12 +120,9 @@ public class ChatTrade implements IChatHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chat types registered to this handler.
|
||||
*/
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.IChatHandler;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
@ -31,22 +32,22 @@ import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExWorldChatCnt;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* World chat handler.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ChatWorld implements IChatHandler
|
||||
public final class ChatWorld implements IChatHandler
|
||||
{
|
||||
private static final Map<Integer, Instant> REUSE = new ConcurrentHashMap<>();
|
||||
|
||||
private static final int[] COMMANDS =
|
||||
private static final ChatType[] CHAT_TYPES =
|
||||
{
|
||||
25
|
||||
ChatType.GLOBAL,
|
||||
};
|
||||
|
||||
@Override
|
||||
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
|
||||
public void handleChat(ChatType type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
final Instant now = Instant.now();
|
||||
if (!REUSE.isEmpty())
|
||||
@ -60,7 +61,7 @@ public class ChatWorld implements IChatHandler
|
||||
msg.addInt(Config.WORLD_CHAT_MIN_LEVEL);
|
||||
activeChar.sendPacket(msg);
|
||||
}
|
||||
else if (activeChar.isChatBanned() && Util.contains(Config.BAN_CHAT_CHANNELS, type))
|
||||
else 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);
|
||||
}
|
||||
@ -79,50 +80,30 @@ public class ChatWorld implements IChatHandler
|
||||
final Duration timeDiff = Duration.between(instant, now);
|
||||
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_S1_SEC_UNTIL_YOU_ARE_ABLE_TO_USE_WORLD_CHAT);
|
||||
msg.addInt((int) timeDiff.getSeconds());
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
if (Config.FACTION_SPECIFIC_CHAT)
|
||||
{
|
||||
if ((activeChar.isGood() && activeChar.isGood()) || (activeChar.isEvil() && activeChar.isEvil()))
|
||||
{
|
||||
activeChar.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(msg);
|
||||
}
|
||||
activeChar.sendPacket(msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar, type, text);
|
||||
L2World.getInstance().getPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo);
|
||||
|
||||
activeChar.setWorldChatPoints(activeChar.getWorldChatPoints() - 1);
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT)
|
||||
{
|
||||
if (Config.FACTION_SPECIFIC_CHAT)
|
||||
if (activeChar.isGood())
|
||||
{
|
||||
if ((activeChar.isGood() && activeChar.isGood()) || (activeChar.isEvil() && activeChar.isEvil()))
|
||||
{
|
||||
activeChar.sendPacket(new ExWorldChatCnt(activeChar));
|
||||
}
|
||||
L2World.getInstance().getAllGoodPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo);
|
||||
}
|
||||
else
|
||||
if (activeChar.isEvil())
|
||||
{
|
||||
activeChar.sendPacket(new ExWorldChatCnt(activeChar));
|
||||
L2World.getInstance().getAllEvilPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(new ExWorldChatCnt(activeChar));
|
||||
L2World.getInstance().getPlayers().stream().filter(activeChar::isNotBlocked).forEach(cs::sendTo);
|
||||
}
|
||||
|
||||
activeChar.setWorldChatPoints(activeChar.getWorldChatPoints() - 1);
|
||||
activeChar.sendPacket(new ExWorldChatCnt(activeChar));
|
||||
if (Config.WORLD_CHAT_INTERVAL.getSeconds() > 0)
|
||||
{
|
||||
REUSE.put(activeChar.getObjectId(), now.plus(Config.WORLD_CHAT_INTERVAL));
|
||||
@ -131,8 +112,8 @@ public class ChatWorld implements IChatHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getChatTypeList()
|
||||
public ChatType[] getChatTypeList()
|
||||
{
|
||||
return COMMANDS;
|
||||
return CHAT_TYPES;
|
||||
}
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ package handlers.effecthandlers;
|
||||
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.datatables.SkillData;
|
||||
import com.l2jserver.gameserver.enums.SubclassInfoType;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
@ -81,7 +82,7 @@ public class ClassChange extends AbstractEffect
|
||||
player.sendPacket(msg);
|
||||
|
||||
player.broadcastUserInfo();
|
||||
player.sendPacket(new ExSubjobInfo(player));
|
||||
player.sendPacket(new ExSubjobInfo(player, SubclassInfoType.CLASS_CHANGED));
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ import java.net.Socket;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.AdminData;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.handler.ITelnetHandler;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.Say2;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
import com.l2jserver.gameserver.util.Broadcast;
|
||||
|
||||
@ -67,7 +67,7 @@ public class ChatsHandler implements ITelnetHandler
|
||||
String name = st.nextToken();
|
||||
String message = val.substring(name.length() + 1);
|
||||
L2PcInstance reciever = L2World.getInstance().getPlayer(name);
|
||||
CreatureSay cs = new CreatureSay(0, Say2.TELL, "Telnet Priv", message);
|
||||
CreatureSay cs = new CreatureSay(0, ChatType.TELL, "Telnet Priv", message);
|
||||
if (reciever != null)
|
||||
{
|
||||
reciever.sendPacket(cs);
|
||||
@ -89,7 +89,7 @@ public class ChatsHandler implements ITelnetHandler
|
||||
try
|
||||
{
|
||||
command = command.substring(7);
|
||||
CreatureSay cs = new CreatureSay(0, Say2.ALLIANCE, "Telnet GM Broadcast from " + _cSocket.getInetAddress().getHostAddress(), command);
|
||||
CreatureSay cs = new CreatureSay(0, ChatType.ALLIANCE, "Telnet GM Broadcast from " + _cSocket.getInetAddress().getHostAddress(), command);
|
||||
AdminData.getInstance().broadcastToGMs(cs);
|
||||
_print.println("Your Message Has Been Sent To " + getOnlineGMS() + " GM(s).");
|
||||
}
|
||||
|
@ -209,6 +209,8 @@ public class DebugHandler implements ITelnetHandler
|
||||
FastTable<Entry<Thread, StackTraceElement[]>> entries = new FastTable<>();
|
||||
entries.setValueComparator(new FastComparator<Entry<Thread, StackTraceElement[]>>()
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean areEqual(Entry<Thread, StackTraceElement[]> e1, Entry<Thread, StackTraceElement[]> e2)
|
||||
{
|
||||
|
Reference in New Issue
Block a user