Code improvements.
This commit is contained in:
@@ -58,7 +58,6 @@ public final class ChatGeneral implements IChatHandler
|
||||
{
|
||||
command = st.nextToken().substring(1);
|
||||
params = text.substring(command.length() + 2);
|
||||
vch = VoicedCommandHandler.getInstance().getHandler(command);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -67,8 +66,8 @@ public final class ChatGeneral implements IChatHandler
|
||||
{
|
||||
_log.info("Command: " + command);
|
||||
}
|
||||
vch = VoicedCommandHandler.getInstance().getHandler(command);
|
||||
}
|
||||
vch = VoicedCommandHandler.getInstance().getHandler(command);
|
||||
if (vch != null)
|
||||
{
|
||||
vch.useVoicedCommand(command, activeChar, params);
|
||||
|
@@ -39,39 +39,41 @@ public class ChatPartyMatchRoom implements IChatHandler
|
||||
@Override
|
||||
public void handleChat(ChatType type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.isInPartyMatchRoom())
|
||||
if (!activeChar.isInPartyMatchRoom())
|
||||
{
|
||||
final PartyMatchRoom _room = PartyMatchRoomList.getInstance().getPlayerRoom(activeChar);
|
||||
if (_room != null)
|
||||
return;
|
||||
}
|
||||
final PartyMatchRoom _room = PartyMatchRoomList.getInstance().getPlayerRoom(activeChar);
|
||||
if (_room == null)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
for (L2PcInstance _member : _room.getPartyMembers())
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
|
||||
if (Config.FACTION_SPECIFIC_CHAT)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
|
||||
for (L2PcInstance _member : _room.getPartyMembers())
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
if (Config.FACTION_SPECIFIC_CHAT)
|
||||
{
|
||||
if ((activeChar.isGood() && _member.isGood()) || (activeChar.isEvil() && _member.isEvil()))
|
||||
{
|
||||
_member.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_member.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
else
|
||||
if ((activeChar.isGood() && _member.isGood()) || (activeChar.isEvil() && _member.isEvil()))
|
||||
{
|
||||
_member.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_member.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_member.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -37,18 +37,16 @@ public final class ChatPartyRoomAll implements IChatHandler
|
||||
@Override
|
||||
public void handleChat(ChatType type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.isInParty())
|
||||
if (!activeChar.isInParty() || !activeChar.getParty().isInCommandChannel() || !activeChar.getParty().isLeader(activeChar))
|
||||
{
|
||||
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
|
||||
{
|
||||
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().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
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().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -37,18 +37,16 @@ public final class ChatPartyRoomCommander implements IChatHandler
|
||||
@Override
|
||||
public void handleChat(ChatType type, L2PcInstance activeChar, String target, String text)
|
||||
{
|
||||
if (activeChar.isInParty())
|
||||
if (!activeChar.isInParty() || !activeChar.getParty().isInCommandChannel() || !activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
|
||||
{
|
||||
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
|
||||
{
|
||||
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().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
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().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -60,20 +60,13 @@ public final class ChatShout implements IChatHandler
|
||||
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()))
|
||||
if ((region == MapRegionManager.getInstance().getMapRegionLocId(player)) && !BlockList.isBlocked(player, activeChar) && (player.getInstanceId() == activeChar.getInstanceId()) && !BlockList.isBlocked(player, activeChar))
|
||||
{
|
||||
if (!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,6 +76,10 @@ public final class ChatShout implements IChatHandler
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -68,27 +68,27 @@ public final class ChatWhisper implements IChatHandler
|
||||
activeChar.sendMessage("Player is in jail.");
|
||||
return;
|
||||
}
|
||||
else if (receiver.isChatBanned())
|
||||
if (receiver.isChatBanned())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THAT_PERSON_IS_IN_MESSAGE_REFUSAL_MODE);
|
||||
return;
|
||||
}
|
||||
else if ((receiver.getClient() == null) || receiver.getClient().isDetached())
|
||||
if ((receiver.getClient() == null) || receiver.getClient().isDetached())
|
||||
{
|
||||
activeChar.sendMessage("Player is in offline mode.");
|
||||
return;
|
||||
}
|
||||
else if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_SPECIFIC_CHAT && ((activeChar.isGood() && receiver.isEvil()) || (activeChar.isEvil() && receiver.isGood())))
|
||||
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;
|
||||
}
|
||||
else if ((activeChar.getLevel() < Config.MINIMUM_CHAT_LEVEL) && !activeChar.getWhisperers().contains(receiver.getObjectId()) && !activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))
|
||||
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))
|
||||
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())
|
||||
|
Reference in New Issue
Block a user