diff --git a/src/main/java/io/github/thetrouper/sentinel/commands/ChatClickCallback.java b/src/main/java/io/github/thetrouper/sentinel/commands/ChatClickCallback.java index d25856e..272fb9a 100644 --- a/src/main/java/io/github/thetrouper/sentinel/commands/ChatClickCallback.java +++ b/src/main/java/io/github/thetrouper/sentinel/commands/ChatClickCallback.java @@ -33,7 +33,7 @@ public class ChatClickCallback extends CustomCommand { p.sendMessage(Text.prefix(Sentinel.dict.get("cooldown") + fpReportCooldown.getCooldown(p.getUniqueId()))); } else { ReportFalsePositives.sendFalsePositiveReport(args[1]); - p.sendMessage(Text.prefix(Sentinel.dict.get("false positive report success"))); + p.sendMessage(Text.prefix(Sentinel.dict.get("false-positive-report-success"))); } } } diff --git a/src/main/java/io/github/thetrouper/sentinel/commands/SentinelCommand.java b/src/main/java/io/github/thetrouper/sentinel/commands/SentinelCommand.java index 38d43a1..1c57311 100644 --- a/src/main/java/io/github/thetrouper/sentinel/commands/SentinelCommand.java +++ b/src/main/java/io/github/thetrouper/sentinel/commands/SentinelCommand.java @@ -30,7 +30,7 @@ public class SentinelCommand extends CustomCommand { switch (args[0]) { case "debugmode" -> { debugmode = !debugmode; - p.sendMessage(Text.prefix(Text.boolString(debugmode,"§aEnabled","§cDisabled") + "§7 debug mode.")); + p.sendMessage(Text.prefix((debugmode ? "enabled" : "disabled") + " debug mode.")); } case "testantiswear" -> { HashSet players = new HashSet<>(); diff --git a/src/main/java/io/github/thetrouper/sentinel/discord/WebhookSender.java b/src/main/java/io/github/thetrouper/sentinel/discord/WebhookSender.java index e12a9dd..dba8cc6 100644 --- a/src/main/java/io/github/thetrouper/sentinel/discord/WebhookSender.java +++ b/src/main/java/io/github/thetrouper/sentinel/discord/WebhookSender.java @@ -13,25 +13,6 @@ import java.io.IOException; public class WebhookSender { - public static void sendTestEmbed() { - String webhookUrl = Config.webhook; - // Create a new DiscordWebhook instance - DiscordWebhook webhook = new DiscordWebhook(webhookUrl); - - // Create an EmbedObject and set its properties - DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject() - .setAuthor("Test Success!", "", "") - .setDescription("eeeee") - .setColor(Color.GREEN); - webhook.addEmbed(embed); - webhook.addAttachment("text.txt","Text Here hehehehaw!"); - try { - webhook.execute(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - public static void sendSpamLog(Player player, String message1, String message2, int finalHeat, boolean chatCleared) { ServerUtils.sendDebugMessage("Creating spamLog Webhook..."); DiscordWebhook webhook = new DiscordWebhook(Config.webhook); diff --git a/src/main/java/io/github/thetrouper/sentinel/server/functions/AntiSpam.java b/src/main/java/io/github/thetrouper/sentinel/server/functions/AntiSpam.java index 5d9d9ae..141021d 100644 --- a/src/main/java/io/github/thetrouper/sentinel/server/functions/AntiSpam.java +++ b/src/main/java/io/github/thetrouper/sentinel/server/functions/AntiSpam.java @@ -70,12 +70,8 @@ public class AntiSpam { warning.setText(Text.prefix(Sentinel.dict.get("spam-warning"))); warning.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("action-automatic"))); p.spigot().sendMessage(warning); - String hover ="§8]==-- §d§lSentinel §8--==[" + - "\n§bPrevious: §f" + message2 + - "\n§bCurrent: §f" + message1 + - "\n§bSimilarity §f" + fs.format(similarity); text.setText(Text.prefix(Sentinel.dict.get("spam-notification").formatted(p.getName(),heatMap.get(p),Config.punishHeat))); - text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hover))); + text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Sentinel.dict.get("spam-notification-hover").formatted(message1,message2,fs.format(similarity))))); ServerUtils.forEachStaff(staff -> { staff.spigot().sendMessage(text); }); @@ -92,7 +88,7 @@ public class AntiSpam { warning.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Sentinel.dict.get("action-automatic")))); p.spigot().sendMessage(warning); TextComponent text = new TextComponent(); - text.setText(Text.prefix(Sentinel.dict.get("spam-punish-notification").formatted(p,heatMap.get(p),Config.punishHeat))); + text.setText(Text.prefix(Sentinel.dict.get("spam-punish-notification").formatted(p.getName(),heatMap.get(p),Config.punishHeat))); ServerUtils.forEachStaff(staff -> { staff.spigot().sendMessage(text); }); diff --git a/src/main/java/io/github/thetrouper/sentinel/server/functions/Message.java b/src/main/java/io/github/thetrouper/sentinel/server/functions/Message.java index d13260a..d255bda 100644 --- a/src/main/java/io/github/thetrouper/sentinel/server/functions/Message.java +++ b/src/main/java/io/github/thetrouper/sentinel/server/functions/Message.java @@ -16,7 +16,7 @@ import java.util.Map; import java.util.UUID; public class Message { - private static Map replyMap = MessageCommand.replyMap; + private static final Map replyMap = MessageCommand.replyMap; public static void messagePlayer(Player sender, Player receiver, String message) { HashSet receivers = new HashSet<>(); receivers.add(receiver); @@ -30,8 +30,8 @@ public class Message { return; } - sender.sendMessage(Sentinel.dict.get("message-sent").replace("{1}",receiver.getName()).replace("{m}", message)); - receiver.sendMessage(Sentinel.dict.get("message-sent").replace("{1}",sender.getName()).replace("{m}", message)); + sender.sendMessage(Sentinel.dict.get("message-sent").formatted(receiver.getName(),message)); + receiver.sendMessage(Sentinel.dict.get("message-received").formatted(sender.getName(),message)); replyMap.put(receiver.getUniqueId(),sender.getUniqueId()); sendSpy(sender,receiver,message); } @@ -39,13 +39,8 @@ public class Message { public static void sendSpy(Player sender, Player receiver, String message) { ServerUtils.forEachPlayer(player -> { if (SocialSpyCommand.spyMap.getOrDefault(player.getUniqueId(),false)) { - TextComponent notification = new TextComponent(Sentinel.dict.get("spy-message").replace("{1}",sender.getName()).replace("{2}", receiver.getName())); - notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text( - "§8]==-- §d§lSocialSpy §8--==[" + - "\n§bSender: §f" + sender.getName() + - "\n§bReceiver: §f" + receiver.getName() + - "\n§bMessage: §f" + message - ))); + TextComponent notification = new TextComponent(Sentinel.dict.get("spy-message").formatted(sender.getName(),receiver.getName())); + notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(Sentinel.dict.get("spy-message-hover").formatted(sender.getName(),receiver.getName(),message)))); player.spigot().sendMessage(notification); } }); diff --git a/src/main/java/io/github/thetrouper/sentinel/server/functions/ProfanityFilter.java b/src/main/java/io/github/thetrouper/sentinel/server/functions/ProfanityFilter.java index d5b6ee5..86e0b55 100644 --- a/src/main/java/io/github/thetrouper/sentinel/server/functions/ProfanityFilter.java +++ b/src/main/java/io/github/thetrouper/sentinel/server/functions/ProfanityFilter.java @@ -80,10 +80,9 @@ public class ProfanityFilter { offender.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/sentinelcallback fpreport " + fpreport)); player.spigot().sendMessage(offender); - String hover = ("§bOriginal: §f" + origMessage + "\n§bSanitized: §f" + highlightedMSG + "\n\n§8§o(Click to report false positive)"); TextComponent text = new TextComponent(); - text.setText(Text.prefix(Sentinel.dict.get("profanity-mute-notification").formatted(player,scoreMap.get(player),Config.punishScore))); - text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hover))); + text.setText(Text.prefix(Sentinel.dict.get("profanity-mute-notification").formatted(player.getName(),scoreMap.get(player),Config.punishScore))); + text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Sentinel.dict.get("filter-notification-hover").formatted(origMessage,highlightedMSG)))); text.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/sentinelcallback fpreport " + fpreport)); ServerUtils.forEachStaff(staff -> { @@ -102,11 +101,9 @@ public class ProfanityFilter { offender.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hoverPlayer))); offender.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/sentinelcallback fpreport " + fpreport)); player.spigot().sendMessage(offender); - - String hover = ("§bOriginal: §f" + origMessage + "\n§bSanitized: §f" + highlightedMSG + "\n§8§o(Click to report false positive)"); TextComponent text = new TextComponent(); - text.setText(Text.prefix(Sentinel.dict.get("slur-mute-notification").formatted(player,scoreMap.get(player),Config.punishScore))); - text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hover))); + text.setText(Text.prefix(Sentinel.dict.get("slur-mute-notification").formatted(player.getName(),scoreMap.get(player),Config.punishScore))); + text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Sentinel.dict.get("filter-notification-hover").formatted(origMessage,highlightedMSG)))); text.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/sentinelcallback fpreport " + fpreport)); ServerUtils.forEachStaff(staff -> { @@ -123,10 +120,9 @@ public class ProfanityFilter { offender.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/sentinelcallback fpreport " + FPReport)); player.spigot().sendMessage(offender); - String hoverStaff = ("§bOriginal: §f" + origMessage + "\n§bSanitized: §f" + highlightedMSG + "\n§bSeverity: §c" + severity + "\n§7§o(click to report false positive)"); TextComponent staff = new TextComponent(); - staff.setText(Text.prefix(Sentinel.dict.get("swear-block-notification").formatted(player,scoreMap.get(player),Config.punishScore))); - staff.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(hoverStaff))); + staff.setText(Text.prefix(Sentinel.dict.get("swear-block-notification").formatted(player.getName(),scoreMap.get(player),Config.punishScore))); + staff.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(Sentinel.dict.get("severity-notification-hover").formatted(origMessage,highlightedMSG,severity)))); staff.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/sentinelcallback fpreport " + FPReport)); ServerUtils.forEachStaff(staffmember -> { diff --git a/src/main/java/io/github/thetrouper/sentinel/server/util/Color.java b/src/main/java/io/github/thetrouper/sentinel/server/util/Color.java deleted file mode 100644 index b8b459f..0000000 --- a/src/main/java/io/github/thetrouper/sentinel/server/util/Color.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.github.thetrouper.sentinel.server.util; - -public class Color { - public static String color(String tocolor) { - return tocolor.replace("&","\u00A7"); - } -} diff --git a/src/main/resources/lang/en_us.json b/src/main/resources/lang/en_us.json index faccc76..61e9c44 100644 --- a/src/main/resources/lang/en_us.json +++ b/src/main/resources/lang/en_us.json @@ -1,34 +1,38 @@ { "dictionary" : { "example-message" : "Test Message", - "no-permission" : "&cInsufficient Permissions!", + "no-permission" : "§cInsufficient Permissions!", "cooldown" : "This action is on cooldown!", "false-positive-report-success" : "Successfully reported a false positive!", - "no-online-player" : "&cYou must provide an online player to send a message to!", - "no-message-provided" : "&cYou must provide a message to send!", + "no-online-player" : "§cYou must provide an online player to send a message to!", + "no-message-provided" : "§cYou must provide a message to send!", "elevating-perms" : "Elevating your permissions...", "log-elevating-perms" : "Elevating the permissions of %s", "already-op" : "You are already a server operator!", "log-already-op" : "The permissions of %s are already elevated! Retrying...", "no-trust" : "You are not a trusted user!", - "no-user-reply" : "&cYou have nobody to reply to!", + "no-user-reply" : "§cYou have nobody to reply to!", "spy-enabled" : "SocialSpy is now enabled.", "spy-disabled" : "SocialSpy is now disabled.", "spam-warning" : "Do not spam in chat! Please wait before sending another message.", - "action-automatic" : "&7This action was preformed automatically\n&7by the &bSentinel Anti-Spam&7 algorithm.", - "spam-notification" : "&b&n%1$s&7 might be spamming! &8(&c%2$s&7/&4%3$s&8)", + "action-automatic" : "§7This action was preformed automatically\n§7by the §bSentinel Anti-Spam§7 algorithm.", + "spam-notification" : "§b§n%1$s§7 might be spamming! §8(§c%2$s§7/§4%3$s§8)", + "spam-notification-hover" : "§8]==-- §d§lSentinel §8--==[\n§bPrevious: §f%1$s\n§bCurrent: §f%2$s\n§bSimilarity §f%3$s", "spam-punished" : "§cYou have been auto-punished for violating the anti-spam repetitively!", - "spam-punish-notification" : "&b&n%1$s&7 has been auto-muted by the anti spam! &8(&c%2$s&7/&4%3$s&8)", - "unicode-warn" : "&cDo not send non standard unicode in chat!", - "message-sent" : "&d&lMessage &8» &b[&fYou &e>&f %1$s&b] &7%2$s", - "message-received" : "&d&lMessage &8» &b[&f{1} &e>&f You&b] &7{m}", - "spy-message" : "&d&lSpy &8» &b&n{1}&7 has messaged &b&n {2}&7.", - "action-automatic-reportable" : "&7This action was preformed automatically \n&7by the &bSentinel Profanity Filter&7 algorithm!\n&8&o(Click to report false positive)", - "profanity-mute-warn" : "You have been auto muted for repeated violation of the profanity filter! &7&o(Hover for more info)", - "profanity-mute-notification" : "&b&n{1}&7 has been auto-muted by the anti-swear! &8(&c{sm}&7/&4{ps}8)", - "slur-mute-warn" : "&cYou have been insta-punished by the anti-slur! &7&o(Hover for more info)", - "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)", - "swear-block-warn" : "&cPlease do not swear in chat! Attempting to bypass this filter will result in a mute! &7&o(Hover for more info)", - "swear-block-notification" : "&b&n%1$s&7 has triggered the anti-swear! &8(&c%2$s&7/&4%3$s8)" + "spam-punish-notification" : "§b§n%1$s§7 has been auto-muted by the anti spam! §8(§c%2$s§7/§4%3$s§8)", + "unicode-warn" : "§cDo not send non standard unicode in chat!", + "message-sent" : "§d§lMessage §8» §b[§fYou §e>§f %1$s§b] §7%2$s", + "message-received" : "§d§lMessage §8» §b[§f%1$s §e>§f You§b] §7%2$s", + "spy-message" : "§d§lSpy §8» §b§n%1$s§7 has messaged §b§n%2$s§7.", + "spy-message-hover" : "§8]==-- §d§lSocialSpy §8--==[\n§bSender: §f%1$S\n§bReceiver: §f%2$S\n§bMessage: §f%3$S", + "action-automatic-reportable" : "§7This action was preformed automatically \n§7by the §bSentinel Profanity Filter§7 algorithm!\n§8§o(Click to report false positive)", + "profanity-mute-warn" : "You have been auto muted for repeated violation of the profanity filter! §7§o(Hover for more info)", + "profanity-mute-notification" : "§b§n{1}§7 has been auto-muted by the anti-swear! §8(§c{sm}§7/§4{ps}8)", + "slur-mute-warn" : "§cYou have been insta-punished by the anti-slur! §7§o(Hover for more info)", + "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)", + "swear-block-warn" : "§cPlease do not swear in chat! Attempting to bypass this filter will result in a mute! §7§o(Hover for more info)", + "swear-block-notification" : "§b§n%1$s§7 has triggered the anti-swear! §8(§c%2$s§7/§4%3$s§8)", + "filter-notification-hover" : "§bOriginal: §f%1$s\n§bSanitized: §f%2$s\n§8§o(Click to report false positive)", + "severity-notification-hover" : "§bOriginal: §f%1$s\n§bSanitized: §f%2$s\n§bSeverity: §c%3$s\n§7§o(click to report false positive)" } } \ No newline at end of file