diff --git a/server/logs/2024-02-21-1.log.gz b/server/logs/2024-02-21-1.log.gz new file mode 100644 index 0000000..3df9f07 Binary files /dev/null and b/server/logs/2024-02-21-1.log.gz differ diff --git a/server/logs/2024-02-21-2.log.gz b/server/logs/2024-02-21-2.log.gz new file mode 100644 index 0000000..e1de73c Binary files /dev/null and b/server/logs/2024-02-21-2.log.gz differ diff --git a/src/main/java/io/github/thetrouper/sentinel/data/FilterActionType.java b/src/main/java/io/github/thetrouper/sentinel/data/FilterActionType.java new file mode 100644 index 0000000..f7d96b1 --- /dev/null +++ b/src/main/java/io/github/thetrouper/sentinel/data/FilterActionType.java @@ -0,0 +1,14 @@ +package io.github.thetrouper.sentinel.data; + +import io.github.thetrouper.sentinel.Sentinel; + +public record FilterActionType(String logTitle, String logName, String chatWarning, String chatWarningHover, String chatNotification, String chatNotificationHover, String punishmentCommand, int embedColor) { + public static final FilterActionType UNICODE_BLOCK = new FilterActionType("Sentinel Anti-Unicode Log","Anti-Unicode","unicode-warn","action-automatic-reportable","unicode-notification","unicode-notification-hover", null,0xFF0000); + public static final FilterActionType URL_BLOCK = new FilterActionType("Sentinel Anti-URL Log","Anti-URL","url-warn","action-automatic-reportable","url-notification","url-notification-hover", null,0xFF0000); + public static final FilterActionType SPAM_BLOCK = new FilterActionType("Sentinel Anti-Spam Log","Anti-Spam","spam-warn","action-automatic-reportable","spam-notification","spam-notification-hover", null,0xFF0000); + public static final FilterActionType SPAM_PUNISH = new FilterActionType("Sentinel Anti-Spam Log","Anti-Spam","spam-mute-warn","action-automatic-reportable","spam-mute-notification","spam-notification-hover", Sentinel.mainConfig.chat.antiSpam.spamPunishCommand,0xFF0000); + public static final FilterActionType SWEAR_BLOCK = new FilterActionType("Sentinel Profanity Filter Log","Anti-Swear","profanity-warn","action-automatic-reportable","profanity-notification","profanity-notification-hover", null,0xFF0000); + public static final FilterActionType SWEAR_PUNISH = new FilterActionType("Sentinel Profanity Filter Log","Anti-Swear","profanity-mute-warn","action-automatic-reportable","profanity-mute-notification","profanity-notification-hover", Sentinel.mainConfig.chat.antiSwear.swearPunishCommand,0xFF0000); + public static final FilterActionType SLUR_PUNISH = new FilterActionType("Sentinel Profanity Filter Log","Anti-Slur","slur-mute-warn","action-automatic-reportable","slur-mute-notification","profanity-notification-hover", Sentinel.mainConfig.chat.antiSwear.strictPunishCommand,0xFF0000); + public static final FilterActionType SAFE = new FilterActionType("ERROR",null,null,null,null,null,null,0x00AA00); +} diff --git a/src/main/java/io/github/thetrouper/sentinel/data/config/LanguageFile.java b/src/main/java/io/github/thetrouper/sentinel/data/config/LanguageFile.java index 039fa84..41a5833 100644 --- a/src/main/java/io/github/thetrouper/sentinel/data/config/LanguageFile.java +++ b/src/main/java/io/github/thetrouper/sentinel/data/config/LanguageFile.java @@ -30,17 +30,17 @@ public class LanguageFile implements JsonSerializable { put("message-received", "§d§lMessage §8» §b[§f%1$s §e>§f You§b] §7%2$s"); put("spy-message", "§d§lSpy §8» §b§n%1$s§7 has messaged §b§n%2$s§7."); put("spy-message-hover", "§8]==-- §d§lSocialSpy §8--==[\n§bSender: §f%1$S\n§bReceiver: §f%2$S\n§bMessage: §f%3$S"); - put("profanity-block-notification", "§b§n%1$s§7 has triggered the anti-swear! §8(§c%2$s§7/§4%3$s§8)"); - put("profanity-block-warn", "§cPlease do not swear in chat! Attempting to bypass this filter will result in a mute! §7§o(Hover for more info)"); + put("profanity-notification", "§b§n%1$s§7 has triggered the anti-swear! §8(§c%2$s§7/§4%3$s§8)"); + put("profanity-warn", "§cPlease do not swear in chat! Attempting to bypass this filter will result in a mute! §7§o(Hover for more info)"); put("profanity-mute-warn", "You have been auto-muted for repeated violation of the profanity filter! §7§o(Hover for more info)"); put("profanity-mute-notification", "§b§n%1$s§7 has been auto-muted by the anti-swear! §8(§c%2$s§7/§4%3$s§8)"); - put("profanity-filter-notification-hover", "§8]==-- §d§lSentinel §8--==[\n§bOriginal: §f%1$s\n§bSanitized: §f%2$s\n§8§o(Click to report false positive)"); + put("profanity-notification-hover", "§8]==-- §d§lSentinel §8--==[\n§bOriginal: §f%1$s\n§bSanitized: §f%2$s\n§8§o(Click to report false positive)"); put("severity-notification-hover", "§8]==-- §d§lSentinel §8--==[\n§bOriginal: §f%1$s\n§bSanitized: §f%2$s\n§bSeverity: §c%3$s\n§7§o(click to report false positive)"); put("slur-mute-warn", "§cYou have been insta-punished by the anti-slur! §7§o(Hover for more info)"); put("slur-mute-notification", "§b§n%1$s§7 has been insta-muted by the anti-swear! §8(§c%2$s§7/§4%3$s§8)"); put("spam-notification", "§b§n%1$s§7 might be spamming! §8(§c%2$s§7/§4%3$s§8)"); put("spam-notification-hover", "§8]==-- §d§lSentinel §8--==[\n§bPrevious: §f%1$s\n§bCurrent: §f%2$s\n§bSimilarity §f%3$s"); - put("spam-block-warn", "Do not spam in chat! Please wait before sending another message."); + put("spam-warn", "Do not spam in chat! Please wait before sending another message."); put("spam-mute-warn", "§cYou have been auto-punished for violating the anti-spam repetitively!"); put("spam-mute-notification", "§b§n%1$s§7 has been auto-muted by the anti spam! §8(§c%2$s§7/§4%3$s§8)"); put("url-warn", "§cDo not send urls in chat!"); diff --git a/src/main/java/io/github/thetrouper/sentinel/server/NewFilterAction.java b/src/main/java/io/github/thetrouper/sentinel/server/NewFilterAction.java new file mode 100644 index 0000000..1acf0f3 --- /dev/null +++ b/src/main/java/io/github/thetrouper/sentinel/server/NewFilterAction.java @@ -0,0 +1,39 @@ +package io.github.thetrouper.sentinel.server; + +import io.github.thetrouper.sentinel.data.FilterActionType; +import io.github.thetrouper.sentinel.data.FilterSeverity; +import io.github.thetrouper.sentinel.data.Report; +import io.github.thetrouper.sentinel.server.util.ServerUtils; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.event.ClickEvent; +import org.bukkit.entity.Player; +import org.bukkit.event.player.AsyncPlayerChatEvent; + +public class NewFilterAction { + + public static void takeAction(AsyncPlayerChatEvent e, FilterActionType type, Report report, double similarity, FilterSeverity severity) { + if (type.equals(FilterActionType.SAFE)) return; + sendWarnings(e.getPlayer(),type,report.id()); + + } + + public static void sendConsoleLog(AsyncPlayerChatEvent e, FilterActionType type) { + + } + + public static void sendWarnings(Player offender, FilterActionType type, long report) { + TextComponent warning = Component.text(type.chatWarning()) + .hoverEvent(Component.text(type.chatWarningHover())) + .clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND,"sentinelcallback fpreport " + report)); + TextComponent notification = Component.text(type.chatNotification()) + .hoverEvent(Component.text(type.chatNotificationHover())) + .clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND,"sentinelcallback fpreport " + report)); + if (type.punishmentCommand() != null) { + ServerUtils.forEachStaff(staff->{ + staff.sendMessage(notification); + }); + } + offender.sendMessage(warning); + } +} diff --git a/src/main/java/io/github/thetrouper/sentinel/server/functions/ReportFalsePositives.java b/src/main/java/io/github/thetrouper/sentinel/server/functions/ReportFalsePositives.java index 73224f8..ef66fd0 100644 --- a/src/main/java/io/github/thetrouper/sentinel/server/functions/ReportFalsePositives.java +++ b/src/main/java/io/github/thetrouper/sentinel/server/functions/ReportFalsePositives.java @@ -24,7 +24,7 @@ public class ReportFalsePositives { final long reportID = Randomizer.generateID(); LinkedHashMap steps = new LinkedHashMap<>(); steps.put("Original Message", "`%s`".formatted(event.getMessage())); - SchedulerUtils.later(60000,()->{ + SchedulerUtils.later(1200,()->{ reports.remove(reportID); }); return new Report(reportID,event,steps);