Implemented HWID punishment affect.
This commit is contained in:
@@ -54,6 +54,8 @@ public class AdminPunishment implements IAdminCommandHandler
|
||||
"admin_punishment_remove",
|
||||
"admin_ban_acc",
|
||||
"admin_unban_acc",
|
||||
"admin_ban_hwid",
|
||||
"admin_unban_hwid",
|
||||
"admin_ban_chat",
|
||||
"admin_unban_chat",
|
||||
"admin_ban_char",
|
||||
@@ -182,6 +184,7 @@ public class AdminPunishment implements IAdminCommandHandler
|
||||
content = content.replace("%acc%", target.getAccountName());
|
||||
content = content.replace("%char%", target.getName());
|
||||
content = content.replace("%ip%", target.getIPAddress());
|
||||
content = content.replace("%hwid%", (target.getClient() == null) || (target.getClient().getHardwareInfo() == null) ? "Unknown" : target.getClient().getHardwareInfo().getMacAddress());
|
||||
activeChar.sendPacket(new NpcHtmlMessage(0, 1, content));
|
||||
}
|
||||
else
|
||||
@@ -355,6 +358,22 @@ public class AdminPunishment implements IAdminCommandHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "admin_ban_hwid":
|
||||
{
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
return useAdminCommand(String.format("admin_punishment_add %s %s %s %s %s", st.nextToken(), PunishmentAffect.HWID, PunishmentType.BAN, 0, "Banned by admin"), activeChar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "admin_unban_hwid":
|
||||
{
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
return useAdminCommand(String.format("admin_punishment_remove %s %s %s", st.nextToken(), PunishmentAffect.HWID, PunishmentType.BAN), activeChar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "admin_ban_chat":
|
||||
{
|
||||
if (st.hasMoreTokens())
|
||||
|
@@ -76,6 +76,19 @@ public class BanHandler implements IPunishmentHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWID:
|
||||
{
|
||||
final String hwid = String.valueOf(task.getKey());
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
final GameClient client = player.getClient();
|
||||
if ((client != null) && client.getHardwareInfo().getMacAddress().equals(hwid))
|
||||
{
|
||||
applyToPlayer(player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -73,6 +73,19 @@ public class ChatBanHandler implements IPunishmentHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWID:
|
||||
{
|
||||
final String hwid = String.valueOf(task.getKey());
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
final GameClient client = player.getClient();
|
||||
if ((client != null) && client.getHardwareInfo().getMacAddress().equals(hwid))
|
||||
{
|
||||
applyToPlayer(task, player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +130,19 @@ public class ChatBanHandler implements IPunishmentHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWID:
|
||||
{
|
||||
final String hwid = String.valueOf(task.getKey());
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
final GameClient client = player.getClient();
|
||||
if ((client != null) && client.getHardwareInfo().getMacAddress().equals(hwid))
|
||||
{
|
||||
removeFromPlayer(player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +153,7 @@ public class ChatBanHandler implements IPunishmentHandler
|
||||
*/
|
||||
private void applyToPlayer(PunishmentTask task, PlayerInstance player)
|
||||
{
|
||||
final long delay = ((task.getExpirationTime() - Chronos.currentTimeMillis()) / 1000);
|
||||
final long delay = (task.getExpirationTime() - Chronos.currentTimeMillis()) / 1000;
|
||||
if (delay > 0)
|
||||
{
|
||||
player.sendMessage("You've been chat banned for " + (delay > 60 ? ((delay / 60) + " minutes.") : delay + " seconds."));
|
||||
|
@@ -102,6 +102,19 @@ public class JailHandler implements IPunishmentHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWID:
|
||||
{
|
||||
final String hwid = String.valueOf(task.getKey());
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
final GameClient client = player.getClient();
|
||||
if ((client != null) && client.getHardwareInfo().getMacAddress().equals(hwid))
|
||||
{
|
||||
applyToPlayer(task, player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +159,19 @@ public class JailHandler implements IPunishmentHandler
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HWID:
|
||||
{
|
||||
final String hwid = String.valueOf(task.getKey());
|
||||
for (PlayerInstance player : World.getInstance().getPlayers())
|
||||
{
|
||||
final GameClient client = player.getClient();
|
||||
if ((client != null) && client.getHardwareInfo().getMacAddress().equals(hwid))
|
||||
{
|
||||
removeFromPlayer(player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +207,7 @@ public class JailHandler implements IPunishmentHandler
|
||||
player.sendPacket(msg);
|
||||
if (task != null)
|
||||
{
|
||||
final long delay = ((task.getExpirationTime() - Chronos.currentTimeMillis()) / 1000);
|
||||
final long delay = (task.getExpirationTime() - Chronos.currentTimeMillis()) / 1000;
|
||||
if (delay > 0)
|
||||
{
|
||||
player.sendMessage("You've been jailed for " + (delay > 60 ? ((delay / 60) + " minutes.") : delay + " seconds."));
|
||||
|
Reference in New Issue
Block a user