New messages/durations
This commit is contained in:
parent
c8a1035591
commit
ecef2fe9db
@ -81,6 +81,8 @@ import mineplex.core.preferences.Preference;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.punish.Category;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.punish.PunishClient;
|
||||
import mineplex.core.punish.Punishment;
|
||||
import mineplex.core.punish.PunishmentResponse;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
@ -212,7 +214,7 @@ public class AntiHack extends MiniPlugin
|
||||
CoreClient coreClient = _clientManager.Get(player);
|
||||
|
||||
String id = generateId();
|
||||
String finalMessage = "[GWEN] " + id;
|
||||
String finalMessage = "[GWEN] Cheat Detection\nToken: " + id;
|
||||
JsonObject custom = new JsonObject();
|
||||
custom.addProperty("ban-reason", CheckManager.getCheckSimpleName(cause));
|
||||
if (gep)
|
||||
@ -231,7 +233,7 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
_compromisedAccountManager.submitImmediateBan(player);
|
||||
|
||||
_punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, -1, true, after);
|
||||
_punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, getDaysBanned(player, cause), true, after);
|
||||
};
|
||||
|
||||
if (coreClient.GetRank().has(Rank.TWITCH))
|
||||
@ -270,7 +272,7 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
Consumer<Consumer<PunishmentResponse>> doPunish = after ->
|
||||
{
|
||||
_punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, -1, true, after);
|
||||
_punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, getDaysBanned(player, CheckManager.getCheckBySimpleName(info.getHackType())), true, after);
|
||||
};
|
||||
|
||||
if (coreClient.GetRank().has(Rank.TWITCH))
|
||||
@ -346,6 +348,60 @@ public class AntiHack extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
public int getPunishments(Player player)
|
||||
{
|
||||
PunishClient punishClient = require(Punish.class).GetClient(player.getName());
|
||||
|
||||
int totalPunishments = 0;
|
||||
|
||||
if (punishClient.GetPunishments().containsKey(Category.Hacking))
|
||||
{
|
||||
for (Punishment punishment : punishClient.GetPunishments().get(Category.Hacking))
|
||||
{
|
||||
if (punishment.GetAdmin().equalsIgnoreCase(NAME) && punishment.GetReason().contains("[GWEN]"))
|
||||
{
|
||||
totalPunishments++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return totalPunishments;
|
||||
}
|
||||
|
||||
public int getDaysBanned(Player player, Class<? extends Check> check)
|
||||
{
|
||||
if (check == null) // old banwaves
|
||||
{
|
||||
switch (getPunishments(player))
|
||||
{
|
||||
case 0:
|
||||
return 5;
|
||||
case 1:
|
||||
return 14;
|
||||
case 2:
|
||||
return 30;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
switch (check.getSimpleName())
|
||||
{
|
||||
default:
|
||||
switch (getPunishments(player))
|
||||
{
|
||||
case 0:
|
||||
return 5;
|
||||
case 1:
|
||||
return 14;
|
||||
case 2:
|
||||
return 30;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void announceBan(Player player)
|
||||
{
|
||||
Bukkit.getServer().broadcastMessage(String.format(USER_HAS_BEEN_BANNED, player.getName()));
|
||||
@ -433,7 +489,7 @@ public class AntiHack extends MiniPlugin
|
||||
.append("A").color(ChatColor.AQUA).obfuscated(true)
|
||||
.append(" GWEN > ", ComponentBuilder.FormatRetention.NONE).color(ChatColor.RED).bold(true)
|
||||
.append(violation.getPlayerName(), ComponentBuilder.FormatRetention.NONE).color(ChatColor.GOLD)
|
||||
.append(" failed " + violation.getHackType() + " VL" + violation.getViolations() + " in server", ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW)
|
||||
.append(" failed " + violation.getHackType() + " VL" + violation.getViolations() + " in server ", ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW)
|
||||
.append(violation.getOriginatingServer(), ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW)
|
||||
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/server " + violation.getOriginatingServer()))
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
|
@ -61,7 +61,7 @@ public class BanWaveManager extends MiniPlugin
|
||||
runAsync(() ->
|
||||
{
|
||||
String id = AntiHack.generateId();
|
||||
String newMessage = "[GWEN] [BanWave] " + id;
|
||||
String newMessage = "[GWEN] Cheat Detection (Banwave)\nToken: " + id;
|
||||
|
||||
CoreClient client = _clientManager.Get(player);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user