Chat ban command fixed and upgraded.
This commit is contained in:
parent
2881989633
commit
217c85eedd
@ -27,6 +27,8 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
|||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
import com.l2jmobius.gameserver.util.BuilderUtil;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
public class ChatAdmin implements IVoicedCommandHandler
|
public class ChatAdmin implements IVoicedCommandHandler
|
||||||
@ -34,7 +36,9 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
private static final String[] VOICED_COMMANDS =
|
private static final String[] VOICED_COMMANDS =
|
||||||
{
|
{
|
||||||
"banchat",
|
"banchat",
|
||||||
"unbanchat"
|
"chatban",
|
||||||
|
"unbanchat",
|
||||||
|
"chatunban"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,113 +49,120 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.equals(VOICED_COMMANDS[0])) // banchat
|
switch (command)
|
||||||
{
|
{
|
||||||
if (params == null)
|
case "banchat":
|
||||||
|
case "chatban":
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Usage: .banchat name [minutes]");
|
if (params == null)
|
||||||
return true;
|
{
|
||||||
}
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .banchat name [minutes]");
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
return true;
|
||||||
if (st.hasMoreTokens())
|
}
|
||||||
{
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
final String name = st.nextToken();
|
|
||||||
long expirationTime = 0;
|
|
||||||
if (st.hasMoreTokens())
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String token = st.nextToken();
|
final String name = st.nextToken();
|
||||||
if (Util.isDigit(token))
|
long expirationTime = 0;
|
||||||
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
expirationTime = System.currentTimeMillis() + (Integer.parseInt(st.nextToken()) * 60 * 1000);
|
final String token = st.nextToken();
|
||||||
}
|
if (Util.isDigit(token))
|
||||||
}
|
{
|
||||||
|
expirationTime = Integer.parseInt(token);
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
}
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isChatBanned())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player is already punished !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player == activeChar)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban yourself !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isGM())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban GM !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban moderator !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, expirationTime, "Chat banned by moderator", activeChar.getName()));
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
if (objId > 0)
|
||||||
|
|
||||||
if (expirationTime > 0)
|
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is already punished!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player == activeChar)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban yourself!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isGM())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban a GM!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban moderator!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, System.currentTimeMillis() + (expirationTime * 1000 * 60), "Chat banned by moderator", activeChar.getName()));
|
||||||
|
if (expirationTime > 0)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned forever.");
|
||||||
|
}
|
||||||
|
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned forever.");
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (command.equals(VOICED_COMMANDS[1])) // unbanchat
|
|
||||||
{
|
|
||||||
if (params == null)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Usage: .unbanchat name");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
|
||||||
if (st.hasMoreTokens())
|
|
||||||
{
|
|
||||||
final String name = st.nextToken();
|
|
||||||
|
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!player.isChatBanned())
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "unbanchat":
|
||||||
|
case "chatunban":
|
||||||
|
{
|
||||||
|
if (params == null)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .unbanchat name");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
|
if (st.hasMoreTokens())
|
||||||
|
{
|
||||||
|
final String name = st.nextToken();
|
||||||
|
|
||||||
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
|
if (objId > 0)
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player is not chat banned !");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is not chat banned!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat unbanned.");
|
||||||
|
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
|
||||||
|
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat unbanned.");
|
|
||||||
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2527,7 +2527,7 @@ public final class Config
|
|||||||
// Load ChatModeration config file (if exists)
|
// Load ChatModeration config file (if exists)
|
||||||
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
||||||
|
|
||||||
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", false);
|
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", true);
|
||||||
|
|
||||||
// Load CommunityBoard config file (if exists)
|
// Load CommunityBoard config file (if exists)
|
||||||
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
||||||
|
@ -30,6 +30,9 @@ import com.l2jmobius.commons.database.DatabaseFactory;
|
|||||||
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||||
|
import com.l2jmobius.gameserver.model.L2World;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid
|
||||||
@ -234,6 +237,15 @@ public class PunishmentTask implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_type.equals(PunishmentType.CHAT_BAN) && _affect.equals(PunishmentAffect.CHARACTER))
|
||||||
|
{
|
||||||
|
final L2PcInstance player = L2World.getInstance().getPlayer(Integer.valueOf(_key));
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
@ -263,6 +263,12 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Chat banned icon.
|
||||||
|
if (activeChar.isChatBanned())
|
||||||
|
{
|
||||||
|
activeChar.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
|
||||||
// Set dead status if applies
|
// Set dead status if applies
|
||||||
if (activeChar.getCurrentHp() < 0.5)
|
if (activeChar.getCurrentHp() < 0.5)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,8 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
|||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
import com.l2jmobius.gameserver.util.BuilderUtil;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
public class ChatAdmin implements IVoicedCommandHandler
|
public class ChatAdmin implements IVoicedCommandHandler
|
||||||
@ -34,7 +36,9 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
private static final String[] VOICED_COMMANDS =
|
private static final String[] VOICED_COMMANDS =
|
||||||
{
|
{
|
||||||
"banchat",
|
"banchat",
|
||||||
"unbanchat"
|
"chatban",
|
||||||
|
"unbanchat",
|
||||||
|
"chatunban"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,113 +49,120 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.equals(VOICED_COMMANDS[0])) // banchat
|
switch (command)
|
||||||
{
|
{
|
||||||
if (params == null)
|
case "banchat":
|
||||||
|
case "chatban":
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Usage: .banchat name [minutes]");
|
if (params == null)
|
||||||
return true;
|
{
|
||||||
}
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .banchat name [minutes]");
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
return true;
|
||||||
if (st.hasMoreTokens())
|
}
|
||||||
{
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
final String name = st.nextToken();
|
|
||||||
long expirationTime = 0;
|
|
||||||
if (st.hasMoreTokens())
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String token = st.nextToken();
|
final String name = st.nextToken();
|
||||||
if (Util.isDigit(token))
|
long expirationTime = 0;
|
||||||
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
expirationTime = System.currentTimeMillis() + (Integer.parseInt(st.nextToken()) * 60 * 1000);
|
final String token = st.nextToken();
|
||||||
}
|
if (Util.isDigit(token))
|
||||||
}
|
{
|
||||||
|
expirationTime = Integer.parseInt(token);
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
}
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isChatBanned())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player is already punished !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player == activeChar)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban yourself !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isGM())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban GM !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban moderator !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, expirationTime, "Chat banned by moderator", activeChar.getName()));
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
if (objId > 0)
|
||||||
|
|
||||||
if (expirationTime > 0)
|
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is already punished!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player == activeChar)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban yourself!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isGM())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban a GM!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban moderator!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, System.currentTimeMillis() + (expirationTime * 1000 * 60), "Chat banned by moderator", activeChar.getName()));
|
||||||
|
if (expirationTime > 0)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned forever.");
|
||||||
|
}
|
||||||
|
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned forever.");
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (command.equals(VOICED_COMMANDS[1])) // unbanchat
|
|
||||||
{
|
|
||||||
if (params == null)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Usage: .unbanchat name");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
|
||||||
if (st.hasMoreTokens())
|
|
||||||
{
|
|
||||||
final String name = st.nextToken();
|
|
||||||
|
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!player.isChatBanned())
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "unbanchat":
|
||||||
|
case "chatunban":
|
||||||
|
{
|
||||||
|
if (params == null)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .unbanchat name");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
|
if (st.hasMoreTokens())
|
||||||
|
{
|
||||||
|
final String name = st.nextToken();
|
||||||
|
|
||||||
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
|
if (objId > 0)
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player is not chat banned !");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is not chat banned!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat unbanned.");
|
||||||
|
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
|
||||||
|
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat unbanned.");
|
|
||||||
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2543,7 +2543,7 @@ public final class Config
|
|||||||
// Load ChatModeration config file (if exists)
|
// Load ChatModeration config file (if exists)
|
||||||
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
||||||
|
|
||||||
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", false);
|
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", true);
|
||||||
|
|
||||||
// Load CommunityBoard config file (if exists)
|
// Load CommunityBoard config file (if exists)
|
||||||
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
||||||
|
@ -30,6 +30,9 @@ import com.l2jmobius.commons.database.DatabaseFactory;
|
|||||||
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||||
|
import com.l2jmobius.gameserver.model.L2World;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid
|
||||||
@ -234,6 +237,15 @@ public class PunishmentTask implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_type.equals(PunishmentType.CHAT_BAN) && _affect.equals(PunishmentAffect.CHARACTER))
|
||||||
|
{
|
||||||
|
final L2PcInstance player = L2World.getInstance().getPlayer(Integer.valueOf(_key));
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
@ -268,6 +268,12 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Chat banned icon.
|
||||||
|
if (activeChar.isChatBanned())
|
||||||
|
{
|
||||||
|
activeChar.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
|
||||||
// Set dead status if applies
|
// Set dead status if applies
|
||||||
if (activeChar.getCurrentHp() < 0.5)
|
if (activeChar.getCurrentHp() < 0.5)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,8 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
|||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
import com.l2jmobius.gameserver.util.BuilderUtil;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
public class ChatAdmin implements IVoicedCommandHandler
|
public class ChatAdmin implements IVoicedCommandHandler
|
||||||
@ -34,7 +36,9 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
private static final String[] VOICED_COMMANDS =
|
private static final String[] VOICED_COMMANDS =
|
||||||
{
|
{
|
||||||
"banchat",
|
"banchat",
|
||||||
"unbanchat"
|
"chatban",
|
||||||
|
"unbanchat",
|
||||||
|
"chatunban"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,113 +49,120 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.equals(VOICED_COMMANDS[0])) // banchat
|
switch (command)
|
||||||
{
|
{
|
||||||
if (params == null)
|
case "banchat":
|
||||||
|
case "chatban":
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Usage: .banchat name [minutes]");
|
if (params == null)
|
||||||
return true;
|
{
|
||||||
}
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .banchat name [minutes]");
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
return true;
|
||||||
if (st.hasMoreTokens())
|
}
|
||||||
{
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
final String name = st.nextToken();
|
|
||||||
long expirationTime = 0;
|
|
||||||
if (st.hasMoreTokens())
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String token = st.nextToken();
|
final String name = st.nextToken();
|
||||||
if (Util.isDigit(token))
|
long expirationTime = 0;
|
||||||
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
expirationTime = System.currentTimeMillis() + (Integer.parseInt(st.nextToken()) * 60 * 1000);
|
final String token = st.nextToken();
|
||||||
}
|
if (Util.isDigit(token))
|
||||||
}
|
{
|
||||||
|
expirationTime = Integer.parseInt(token);
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
}
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isChatBanned())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player is already punished !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player == activeChar)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban yourself !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isGM())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban GM !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban moderator !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, expirationTime, "Chat banned by moderator", activeChar.getName()));
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
if (objId > 0)
|
||||||
|
|
||||||
if (expirationTime > 0)
|
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is already punished!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player == activeChar)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban yourself!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isGM())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban a GM!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban moderator!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, System.currentTimeMillis() + (expirationTime * 1000 * 60), "Chat banned by moderator", activeChar.getName()));
|
||||||
|
if (expirationTime > 0)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned forever.");
|
||||||
|
}
|
||||||
|
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned forever.");
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (command.equals(VOICED_COMMANDS[1])) // unbanchat
|
|
||||||
{
|
|
||||||
if (params == null)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Usage: .unbanchat name");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
|
||||||
if (st.hasMoreTokens())
|
|
||||||
{
|
|
||||||
final String name = st.nextToken();
|
|
||||||
|
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!player.isChatBanned())
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "unbanchat":
|
||||||
|
case "chatunban":
|
||||||
|
{
|
||||||
|
if (params == null)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .unbanchat name");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
|
if (st.hasMoreTokens())
|
||||||
|
{
|
||||||
|
final String name = st.nextToken();
|
||||||
|
|
||||||
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
|
if (objId > 0)
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player is not chat banned !");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is not chat banned!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat unbanned.");
|
||||||
|
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
|
||||||
|
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat unbanned.");
|
|
||||||
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2560,7 +2560,7 @@ public final class Config
|
|||||||
// Load ChatModeration config file (if exists)
|
// Load ChatModeration config file (if exists)
|
||||||
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
||||||
|
|
||||||
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", false);
|
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", true);
|
||||||
|
|
||||||
// Load CommunityBoard config file (if exists)
|
// Load CommunityBoard config file (if exists)
|
||||||
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
||||||
|
@ -30,6 +30,9 @@ import com.l2jmobius.commons.database.DatabaseFactory;
|
|||||||
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||||
|
import com.l2jmobius.gameserver.model.L2World;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid
|
||||||
@ -234,6 +237,15 @@ public class PunishmentTask implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_type.equals(PunishmentType.CHAT_BAN) && _affect.equals(PunishmentAffect.CHARACTER))
|
||||||
|
{
|
||||||
|
final L2PcInstance player = L2World.getInstance().getPlayer(Integer.valueOf(_key));
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
@ -268,6 +268,12 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Chat banned icon.
|
||||||
|
if (activeChar.isChatBanned())
|
||||||
|
{
|
||||||
|
activeChar.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
|
||||||
// Set dead status if applies
|
// Set dead status if applies
|
||||||
if (activeChar.getCurrentHp() < 0.5)
|
if (activeChar.getCurrentHp() < 0.5)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,8 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
|||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
import com.l2jmobius.gameserver.util.BuilderUtil;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
public class ChatAdmin implements IVoicedCommandHandler
|
public class ChatAdmin implements IVoicedCommandHandler
|
||||||
@ -34,7 +36,9 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
private static final String[] VOICED_COMMANDS =
|
private static final String[] VOICED_COMMANDS =
|
||||||
{
|
{
|
||||||
"banchat",
|
"banchat",
|
||||||
"unbanchat"
|
"chatban",
|
||||||
|
"unbanchat",
|
||||||
|
"chatunban"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,113 +49,120 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.equals(VOICED_COMMANDS[0])) // banchat
|
switch (command)
|
||||||
{
|
{
|
||||||
if (params == null)
|
case "banchat":
|
||||||
|
case "chatban":
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Usage: .banchat name [minutes]");
|
if (params == null)
|
||||||
return true;
|
{
|
||||||
}
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .banchat name [minutes]");
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
return true;
|
||||||
if (st.hasMoreTokens())
|
}
|
||||||
{
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
final String name = st.nextToken();
|
|
||||||
long expirationTime = 0;
|
|
||||||
if (st.hasMoreTokens())
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String token = st.nextToken();
|
final String name = st.nextToken();
|
||||||
if (Util.isDigit(token))
|
long expirationTime = 0;
|
||||||
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
expirationTime = System.currentTimeMillis() + (Integer.parseInt(st.nextToken()) * 60 * 1000);
|
final String token = st.nextToken();
|
||||||
}
|
if (Util.isDigit(token))
|
||||||
}
|
{
|
||||||
|
expirationTime = Integer.parseInt(token);
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
}
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isChatBanned())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player is already punished !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player == activeChar)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban yourself !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isGM())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban GM !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban moderator !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, expirationTime, "Chat banned by moderator", activeChar.getName()));
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
if (objId > 0)
|
||||||
|
|
||||||
if (expirationTime > 0)
|
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is already punished!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player == activeChar)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban yourself!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isGM())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban a GM!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban moderator!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, System.currentTimeMillis() + (expirationTime * 1000 * 60), "Chat banned by moderator", activeChar.getName()));
|
||||||
|
if (expirationTime > 0)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned forever.");
|
||||||
|
}
|
||||||
|
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned forever.");
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (command.equals(VOICED_COMMANDS[1])) // unbanchat
|
|
||||||
{
|
|
||||||
if (params == null)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Usage: .unbanchat name");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
|
||||||
if (st.hasMoreTokens())
|
|
||||||
{
|
|
||||||
final String name = st.nextToken();
|
|
||||||
|
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!player.isChatBanned())
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "unbanchat":
|
||||||
|
case "chatunban":
|
||||||
|
{
|
||||||
|
if (params == null)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .unbanchat name");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
|
if (st.hasMoreTokens())
|
||||||
|
{
|
||||||
|
final String name = st.nextToken();
|
||||||
|
|
||||||
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
|
if (objId > 0)
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player is not chat banned !");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is not chat banned!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat unbanned.");
|
||||||
|
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
|
||||||
|
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat unbanned.");
|
|
||||||
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2558,7 +2558,7 @@ public final class Config
|
|||||||
// Load ChatModeration config file (if exists)
|
// Load ChatModeration config file (if exists)
|
||||||
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
||||||
|
|
||||||
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", false);
|
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", true);
|
||||||
|
|
||||||
// Load CommunityBoard config file (if exists)
|
// Load CommunityBoard config file (if exists)
|
||||||
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
||||||
|
@ -30,6 +30,9 @@ import com.l2jmobius.commons.database.DatabaseFactory;
|
|||||||
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||||
|
import com.l2jmobius.gameserver.model.L2World;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid
|
||||||
@ -234,6 +237,15 @@ public class PunishmentTask implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_type.equals(PunishmentType.CHAT_BAN) && _affect.equals(PunishmentAffect.CHARACTER))
|
||||||
|
{
|
||||||
|
final L2PcInstance player = L2World.getInstance().getPlayer(Integer.valueOf(_key));
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
@ -268,6 +268,12 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Chat banned icon.
|
||||||
|
if (activeChar.isChatBanned())
|
||||||
|
{
|
||||||
|
activeChar.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
|
||||||
// Set dead status if applies
|
// Set dead status if applies
|
||||||
if (activeChar.getCurrentHp() < 0.5)
|
if (activeChar.getCurrentHp() < 0.5)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
|||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||||
|
import com.l2jmobius.gameserver.util.BuilderUtil;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
public class ChatAdmin implements IVoicedCommandHandler
|
public class ChatAdmin implements IVoicedCommandHandler
|
||||||
@ -34,7 +35,9 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
private static final String[] VOICED_COMMANDS =
|
private static final String[] VOICED_COMMANDS =
|
||||||
{
|
{
|
||||||
"banchat",
|
"banchat",
|
||||||
"unbanchat"
|
"chatban",
|
||||||
|
"unbanchat",
|
||||||
|
"chatunban"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,113 +48,118 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.equals(VOICED_COMMANDS[0])) // banchat
|
switch (command)
|
||||||
{
|
{
|
||||||
if (params == null)
|
case "banchat":
|
||||||
|
case "chatban":
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Usage: .banchat name [minutes]");
|
if (params == null)
|
||||||
return true;
|
{
|
||||||
}
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .banchat name [minutes]");
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
return true;
|
||||||
if (st.hasMoreTokens())
|
}
|
||||||
{
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
final String name = st.nextToken();
|
|
||||||
long expirationTime = 0;
|
|
||||||
if (st.hasMoreTokens())
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String token = st.nextToken();
|
final String name = st.nextToken();
|
||||||
if (Util.isDigit(token))
|
long expirationTime = 0;
|
||||||
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
expirationTime = System.currentTimeMillis() + (Integer.parseInt(st.nextToken()) * 60 * 1000);
|
final String token = st.nextToken();
|
||||||
}
|
if (Util.isDigit(token))
|
||||||
}
|
{
|
||||||
|
expirationTime = Integer.parseInt(token);
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
}
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isChatBanned())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player is already punished !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player == activeChar)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban yourself !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isGM())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban GM !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban moderator !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, expirationTime, "Chat banned by moderator", activeChar.getName()));
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
if (objId > 0)
|
||||||
|
|
||||||
if (expirationTime > 0)
|
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is already punished!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player == activeChar)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban yourself!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isGM())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban a GM!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban moderator!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, System.currentTimeMillis() + (expirationTime * 1000 * 60), "Chat banned by moderator", activeChar.getName()));
|
||||||
|
if (expirationTime > 0)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned forever.");
|
||||||
|
}
|
||||||
|
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned forever.");
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (command.equals(VOICED_COMMANDS[1])) // unbanchat
|
|
||||||
{
|
|
||||||
if (params == null)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Usage: .unbanchat name");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
|
||||||
if (st.hasMoreTokens())
|
|
||||||
{
|
|
||||||
final String name = st.nextToken();
|
|
||||||
|
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!player.isChatBanned())
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "unbanchat":
|
||||||
|
case "chatunban":
|
||||||
|
{
|
||||||
|
if (params == null)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .unbanchat name");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
|
if (st.hasMoreTokens())
|
||||||
|
{
|
||||||
|
final String name = st.nextToken();
|
||||||
|
|
||||||
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
|
if (objId > 0)
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player is not chat banned !");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is not chat banned!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat unbanned.");
|
||||||
|
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
|
||||||
|
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat unbanned.");
|
|
||||||
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2702,7 +2702,7 @@ public final class Config
|
|||||||
// Load ChatModeration config file (if exists)
|
// Load ChatModeration config file (if exists)
|
||||||
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
||||||
|
|
||||||
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", false);
|
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", true);
|
||||||
|
|
||||||
// Load CommunityBoard config file (if exists)
|
// Load CommunityBoard config file (if exists)
|
||||||
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
||||||
|
@ -27,6 +27,8 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
|||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
import com.l2jmobius.gameserver.util.BuilderUtil;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
public class ChatAdmin implements IVoicedCommandHandler
|
public class ChatAdmin implements IVoicedCommandHandler
|
||||||
@ -34,7 +36,9 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
private static final String[] VOICED_COMMANDS =
|
private static final String[] VOICED_COMMANDS =
|
||||||
{
|
{
|
||||||
"banchat",
|
"banchat",
|
||||||
"unbanchat"
|
"chatban",
|
||||||
|
"unbanchat",
|
||||||
|
"chatunban"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,113 +49,120 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.equals(VOICED_COMMANDS[0])) // banchat
|
switch (command)
|
||||||
{
|
{
|
||||||
if (params == null)
|
case "banchat":
|
||||||
|
case "chatban":
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Usage: .banchat name [minutes]");
|
if (params == null)
|
||||||
return true;
|
{
|
||||||
}
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .banchat name [minutes]");
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
return true;
|
||||||
if (st.hasMoreTokens())
|
}
|
||||||
{
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
final String name = st.nextToken();
|
|
||||||
long expirationTime = 0;
|
|
||||||
if (st.hasMoreTokens())
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String token = st.nextToken();
|
final String name = st.nextToken();
|
||||||
if (Util.isDigit(token))
|
long expirationTime = 0;
|
||||||
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
expirationTime = System.currentTimeMillis() + (Integer.parseInt(st.nextToken()) * 60 * 1000);
|
final String token = st.nextToken();
|
||||||
}
|
if (Util.isDigit(token))
|
||||||
}
|
{
|
||||||
|
expirationTime = Integer.parseInt(token);
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
}
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isChatBanned())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player is already punished !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player == activeChar)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban yourself !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isGM())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban GM !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban moderator !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, expirationTime, "Chat banned by moderator", activeChar.getName()));
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
if (objId > 0)
|
||||||
|
|
||||||
if (expirationTime > 0)
|
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is already punished!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player == activeChar)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban yourself!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isGM())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban a GM!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban moderator!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, System.currentTimeMillis() + (expirationTime * 1000 * 60), "Chat banned by moderator", activeChar.getName()));
|
||||||
|
if (expirationTime > 0)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned forever.");
|
||||||
|
}
|
||||||
|
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned forever.");
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (command.equals(VOICED_COMMANDS[1])) // unbanchat
|
|
||||||
{
|
|
||||||
if (params == null)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Usage: .unbanchat name");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
|
||||||
if (st.hasMoreTokens())
|
|
||||||
{
|
|
||||||
final String name = st.nextToken();
|
|
||||||
|
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!player.isChatBanned())
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "unbanchat":
|
||||||
|
case "chatunban":
|
||||||
|
{
|
||||||
|
if (params == null)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .unbanchat name");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
|
if (st.hasMoreTokens())
|
||||||
|
{
|
||||||
|
final String name = st.nextToken();
|
||||||
|
|
||||||
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
|
if (objId > 0)
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player is not chat banned !");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is not chat banned!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat unbanned.");
|
||||||
|
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
|
||||||
|
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat unbanned.");
|
|
||||||
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2431,7 +2431,7 @@ public final class Config
|
|||||||
// Load ChatModeration config file (if exists)
|
// Load ChatModeration config file (if exists)
|
||||||
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
||||||
|
|
||||||
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", false);
|
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", true);
|
||||||
|
|
||||||
// Load CommunityBoard config file (if exists)
|
// Load CommunityBoard config file (if exists)
|
||||||
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
||||||
|
@ -30,6 +30,9 @@ import com.l2jmobius.commons.database.DatabaseFactory;
|
|||||||
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||||
|
import com.l2jmobius.gameserver.model.L2World;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid
|
||||||
@ -234,6 +237,15 @@ public class PunishmentTask implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_type.equals(PunishmentType.CHAT_BAN) && _affect.equals(PunishmentAffect.CHARACTER))
|
||||||
|
{
|
||||||
|
final L2PcInstance player = L2World.getInstance().getPlayer(Integer.valueOf(_key));
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
@ -267,6 +267,12 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Chat banned icon.
|
||||||
|
if (activeChar.isChatBanned())
|
||||||
|
{
|
||||||
|
activeChar.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
|
||||||
// Set dead status if applies
|
// Set dead status if applies
|
||||||
if (activeChar.getCurrentHp() < 0.5)
|
if (activeChar.getCurrentHp() < 0.5)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,8 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
|||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
import com.l2jmobius.gameserver.util.BuilderUtil;
|
||||||
import com.l2jmobius.gameserver.util.Util;
|
import com.l2jmobius.gameserver.util.Util;
|
||||||
|
|
||||||
public class ChatAdmin implements IVoicedCommandHandler
|
public class ChatAdmin implements IVoicedCommandHandler
|
||||||
@ -34,7 +36,9 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
private static final String[] VOICED_COMMANDS =
|
private static final String[] VOICED_COMMANDS =
|
||||||
{
|
{
|
||||||
"banchat",
|
"banchat",
|
||||||
"unbanchat"
|
"chatban",
|
||||||
|
"unbanchat",
|
||||||
|
"chatunban"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,113 +49,120 @@ public class ChatAdmin implements IVoicedCommandHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.equals(VOICED_COMMANDS[0])) // banchat
|
switch (command)
|
||||||
{
|
{
|
||||||
if (params == null)
|
case "banchat":
|
||||||
|
case "chatban":
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Usage: .banchat name [minutes]");
|
if (params == null)
|
||||||
return true;
|
{
|
||||||
}
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .banchat name [minutes]");
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
return true;
|
||||||
if (st.hasMoreTokens())
|
}
|
||||||
{
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
final String name = st.nextToken();
|
|
||||||
long expirationTime = 0;
|
|
||||||
if (st.hasMoreTokens())
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final String token = st.nextToken();
|
final String name = st.nextToken();
|
||||||
if (Util.isDigit(token))
|
long expirationTime = 0;
|
||||||
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
expirationTime = System.currentTimeMillis() + (Integer.parseInt(st.nextToken()) * 60 * 1000);
|
final String token = st.nextToken();
|
||||||
}
|
if (Util.isDigit(token))
|
||||||
}
|
{
|
||||||
|
expirationTime = Integer.parseInt(token);
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
}
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isChatBanned())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player is already punished !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player == activeChar)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban yourself !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (player.isGM())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban GM !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("You can't ban moderator !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, expirationTime, "Chat banned by moderator", activeChar.getName()));
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
if (objId > 0)
|
||||||
|
|
||||||
if (expirationTime > 0)
|
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is already punished!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player == activeChar)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban yourself!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (player.isGM())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban a GM!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (AdminData.getInstance().hasAccess(command, player.getAccessLevel()))
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You can't ban moderator!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, System.currentTimeMillis() + (expirationTime * 1000 * 60), "Chat banned by moderator", activeChar.getName()));
|
||||||
|
if (expirationTime > 0)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned forever.");
|
||||||
|
}
|
||||||
|
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat banned forever.");
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (command.equals(VOICED_COMMANDS[1])) // unbanchat
|
|
||||||
{
|
|
||||||
if (params == null)
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Usage: .unbanchat name");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final StringTokenizer st = new StringTokenizer(params);
|
|
||||||
if (st.hasMoreTokens())
|
|
||||||
{
|
|
||||||
final String name = st.nextToken();
|
|
||||||
|
|
||||||
final int objId = CharNameTable.getInstance().getIdByName(name);
|
|
||||||
if (objId > 0)
|
|
||||||
{
|
|
||||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
|
||||||
if ((player == null) || !player.isOnline())
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not online !");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!player.isChatBanned())
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "unbanchat":
|
||||||
|
case "chatunban":
|
||||||
|
{
|
||||||
|
if (params == null)
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Usage: .unbanchat name");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final StringTokenizer st = new StringTokenizer(params);
|
||||||
|
if (st.hasMoreTokens())
|
||||||
|
{
|
||||||
|
final String name = st.nextToken();
|
||||||
|
|
||||||
|
final int objId = CharNameTable.getInstance().getIdByName(name);
|
||||||
|
if (objId > 0)
|
||||||
{
|
{
|
||||||
activeChar.sendMessage("Player is not chat banned !");
|
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||||
|
if ((player == null) || !player.isOnline())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not online!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!player.isChatBanned())
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player is not chat banned!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat unbanned.");
|
||||||
|
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Player not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
|
||||||
|
|
||||||
activeChar.sendMessage("Player " + player.getName() + " chat unbanned.");
|
|
||||||
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendMessage("Player not found !");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2438,7 +2438,7 @@ public final class Config
|
|||||||
// Load ChatModeration config file (if exists)
|
// Load ChatModeration config file (if exists)
|
||||||
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
final PropertiesParser ChatModeration = new PropertiesParser(CUSTOM_CHAT_MODERATION_CONFIG_FILE);
|
||||||
|
|
||||||
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", false);
|
CHAT_ADMIN = ChatModeration.getBoolean("ChatAdmin", true);
|
||||||
|
|
||||||
// Load CommunityBoard config file (if exists)
|
// Load CommunityBoard config file (if exists)
|
||||||
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
final PropertiesParser CommunityBoard = new PropertiesParser(CUSTOM_COMMUNITY_BOARD_CONFIG_FILE);
|
||||||
|
@ -30,6 +30,9 @@ import com.l2jmobius.commons.database.DatabaseFactory;
|
|||||||
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
||||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||||
|
import com.l2jmobius.gameserver.model.L2World;
|
||||||
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author UnAfraid
|
* @author UnAfraid
|
||||||
@ -234,6 +237,15 @@ public class PunishmentTask implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_type.equals(PunishmentType.CHAT_BAN) && _affect.equals(PunishmentAffect.CHARACTER))
|
||||||
|
{
|
||||||
|
final L2PcInstance player = L2World.getInstance().getPlayer(Integer.valueOf(_key));
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
player.getEffectList().stopAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
final IPunishmentHandler handler = PunishmentHandler.getInstance().getHandler(_type);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
@ -267,6 +267,12 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Chat banned icon.
|
||||||
|
if (activeChar.isChatBanned())
|
||||||
|
{
|
||||||
|
activeChar.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.NO_CHAT);
|
||||||
|
}
|
||||||
|
|
||||||
// Set dead status if applies
|
// Set dead status if applies
|
||||||
if (activeChar.getCurrentHp() < 0.5)
|
if (activeChar.getCurrentHp() < 0.5)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user