Handle multiple bans when ranked TWITCH+
This commit is contained in:
parent
63d0481dcf
commit
fcaf4538bd
@ -184,56 +184,56 @@ public class AntiHack extends MiniPlugin
|
||||
require(BanWaveManager.class);
|
||||
}
|
||||
|
||||
public void runBanAnimation(Player player, Runnable after)
|
||||
private void runBanAnimation(Player player, Runnable after)
|
||||
{
|
||||
if (_pendingBan.add(player))
|
||||
{
|
||||
new BanwaveAnimationSpin().run(this, player, () ->
|
||||
{
|
||||
after.run();
|
||||
_pendingBan.remove(player);
|
||||
});
|
||||
}
|
||||
new BanwaveAnimationSpin().run(this, player, after);
|
||||
}
|
||||
|
||||
public void doBan(Player player, Class<? extends Check> cause)
|
||||
{
|
||||
runSync(() ->
|
||||
{
|
||||
CoreClient coreClient = _clientManager.Get(player);
|
||||
|
||||
Consumer<Consumer<PunishmentResponse>> doPunish = after ->
|
||||
if (_pendingBan.add(player))
|
||||
{
|
||||
JsonObject custom = new JsonObject();
|
||||
custom.addProperty("ban-reason", CheckManager.getCheckSimpleName(cause));
|
||||
CoreClient coreClient = _clientManager.Get(player);
|
||||
|
||||
String id = generateId(ID_LENGTH);
|
||||
String finalMessage = "[GWEN] " + id + "";
|
||||
_logger.saveMetadata(player, id, () ->
|
||||
Consumer<Consumer<PunishmentResponse>> doPunish = after ->
|
||||
{
|
||||
_logger.resetViolations(player, () ->
|
||||
{
|
||||
require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, -1, true, after);
|
||||
});
|
||||
}, custom);
|
||||
};
|
||||
JsonObject custom = new JsonObject();
|
||||
custom.addProperty("ban-reason", CheckManager.getCheckSimpleName(cause));
|
||||
|
||||
if (coreClient.GetRank().has(Rank.TWITCH))
|
||||
{
|
||||
doPunish.accept(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
runBanAnimation(player, () ->
|
||||
String id = generateId(ID_LENGTH);
|
||||
String finalMessage = "[GWEN] " + id + "";
|
||||
_logger.saveMetadata(player, id, () ->
|
||||
{
|
||||
_logger.resetViolations(player, () ->
|
||||
{
|
||||
require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, -1, true, after);
|
||||
});
|
||||
}, custom);
|
||||
};
|
||||
|
||||
if (coreClient.GetRank().has(Rank.TWITCH))
|
||||
{
|
||||
doPunish.accept(result ->
|
||||
{
|
||||
if (result == PunishmentResponse.Punished)
|
||||
{
|
||||
announceBan(player);
|
||||
}
|
||||
_pendingBan.remove(player);
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
runBanAnimation(player, () ->
|
||||
{
|
||||
doPunish.accept(result ->
|
||||
{
|
||||
if (result == PunishmentResponse.Punished)
|
||||
{
|
||||
announceBan(player);
|
||||
}
|
||||
_pendingBan.remove(player);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -253,8 +253,13 @@ public class AntiHack extends MiniPlugin
|
||||
{
|
||||
runBanAnimation(player, () ->
|
||||
{
|
||||
require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, totalPunishments + 1, true, daysBanned == -1 ? -1 : TimeUnit.DAYS.toHours(daysBanned), true);
|
||||
announceBanwave(player);
|
||||
require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, totalPunishments + 1, true, daysBanned == -1 ? -1 : TimeUnit.DAYS.toHours(daysBanned), true, result ->
|
||||
{
|
||||
if (result == PunishmentResponse.Punished)
|
||||
{
|
||||
announceBanwave(player);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user