Polished out the last bit of language tweaks, soon ready for update
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
/**
|
||||
* This file is for tutorial purposes made by ImproperIssues. Distribute if you want :)
|
||||
*/
|
||||
|
||||
package io.github.thetrouper.sentinel;
|
||||
|
||||
import io.github.thetrouper.sentinel.commands.*;
|
||||
@@ -20,11 +16,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* This is your main class, you register everything important here.
|
||||
*
|
||||
* To build the jar, go to terminal and run "./gradlew build"
|
||||
*/
|
||||
public final class Sentinel extends JavaPlugin {
|
||||
private static Sentinel instance;
|
||||
public static LanguageFile dict;
|
||||
@@ -43,16 +34,21 @@ public final class Sentinel extends JavaPlugin {
|
||||
|
||||
log.info("\n]======------ Pre-load started! ------======[");
|
||||
instance = this;
|
||||
log.info("Loading Config...");
|
||||
Config.loadConfiguration();
|
||||
log.info("Loading Dictionary (" + Config.lang + ")...");
|
||||
dict = JsonSerializable.load(LanguageFile.PATH,LanguageFile.class,new LanguageFile());
|
||||
log.info("Initializing Server ID...");
|
||||
String serverID = Authenticator.getServerID();
|
||||
identifier = serverID;
|
||||
log.info("\n]====---- Requesting Authentication (" + dict.get("example-message") + ") ----====[ \n- license Key: " + key + " \n- Server ID: " + serverID);
|
||||
log.info("Pre-load finished!\n]====---- Requesting Authentication (" + dict.get("example-message") + ") ----====[ \n- License Key: " + key + " \n- Server ID: " + serverID);
|
||||
String authStatus = "ERROR";
|
||||
try {
|
||||
authStatus = Authenticator.authorize(key, serverID);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info("WTFFFF ARE YOU DOING MAN??????");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
}
|
||||
switch (authStatus) {
|
||||
case "AUTHORIZED" -> {
|
||||
@@ -90,12 +86,13 @@ public final class Sentinel extends JavaPlugin {
|
||||
private void startup() {
|
||||
log.info("\n]======----- Auth Success! -----======[");
|
||||
// Init
|
||||
log.info("Verifying Config...");
|
||||
getConfig().options().copyDefaults();
|
||||
saveDefaultConfig();
|
||||
|
||||
|
||||
// Plugin startup logic
|
||||
log.info("Sentinel has loaded! (" + getDescription().getVersion() + ")");
|
||||
log.info("Starting Up! (" + getDescription().getVersion() + ")...");
|
||||
|
||||
// Enable Functions
|
||||
AntiSpam.enableAntiSpam();
|
||||
@@ -124,7 +121,7 @@ public final class Sentinel extends JavaPlugin {
|
||||
// Scheduled timers
|
||||
Bukkit.getScheduler().runTaskTimer(this, AntiSpam::decayHeat,0, 20);
|
||||
Bukkit.getScheduler().runTaskTimer(this, ProfanityFilter::decayScore,0,1200);
|
||||
log.info("\n" +
|
||||
log.info("Finished!\n" +
|
||||
" ____ __ ___ \n" +
|
||||
"/\\ _`\\ /\\ \\__ __ /\\_ \\ \n" +
|
||||
"\\ \\,\\L\\_\\ __ ___\\ \\ ,_\\/\\_\\ ___ __\\//\\ \\ \n" +
|
||||
@@ -142,7 +139,9 @@ public final class Sentinel extends JavaPlugin {
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
log.info("Sentinel has disabled! (" + getDescription().getVersion() + ") Your server is now no longer protected!");
|
||||
Telemetry.sendShutdownLog(identifier,key);
|
||||
if (usesDynamicIP) {
|
||||
Telemetry.sendShutdownLog(identifier,key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,9 +48,9 @@ public abstract class CustomCommand implements TabExecutor {
|
||||
else if (ex instanceof NullPointerException)
|
||||
msg = "command contains a null value";
|
||||
|
||||
sender.sendMessage(Text.prefix("§4Command Error: §cUnknown or incomplete command!"));
|
||||
sender.sendMessage(Text.prefix("§cCaused by: §8§o(" + ex.getClass().getSimpleName() + ") §7" + msg));
|
||||
sender.sendMessage(Text.prefix("§cCorrect Usage: §7" + command.getUsage()));
|
||||
sender.sendMessage(Text.prefix("\u00a74Command Error: \u00a7cUnknown or incomplete command!"));
|
||||
sender.sendMessage(Text.prefix("\u00a7cCaused by: \u00a78\u00a7o(" + ex.getClass().getSimpleName() + ") \u00a77" + msg));
|
||||
sender.sendMessage(Text.prefix("\u00a7cCorrect Usage: \u00a77" + command.getUsage()));
|
||||
|
||||
if (printStacktrace) {
|
||||
ex.printStackTrace();
|
||||
|
||||
@@ -23,7 +23,6 @@ public class LanguageFile implements JsonSerializable<LanguageFile> {
|
||||
return dictionary;
|
||||
}
|
||||
public String format(String input) {
|
||||
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,15 +207,15 @@ public class Action {
|
||||
body += "Block: " + block.getType().toString().toLowerCase().replace("_", " ") + "\n";
|
||||
body += "Location: " + loc.getX() + " " + loc.getY() + " " + loc.getZ() + "\n";
|
||||
}
|
||||
body += "Denied: " + (denied ? "§a\u2714" : "§c\u2718") + "\n";
|
||||
body += "Denied: " + (denied ? "\u00a7a\u2714" : "\u00a7c\u2718") + "\n";
|
||||
if (deoped) {
|
||||
player.setOp(false);
|
||||
}
|
||||
body += "Deoped: " + (deoped ? "§a\u2714" : "§c\u2718") + "\n";
|
||||
body += "Deoped: " + (deoped ? "\u00a7a\u2714" : "\u00a7c\u2718") + "\n";
|
||||
|
||||
body += "Punished: " + (punished ? "§a\u2714" : "§c\u2718") + "\n";
|
||||
if (revertGM) body += "RevertGM: " + "§a\u2714" + "\n";
|
||||
body += "Logged: " + (notifyDiscord ? "§a\u2714" : "§c\u2718");
|
||||
body += "Punished: " + (punished ? "\u00a7a\u2714" : "\u00a7c\u2718") + "\n";
|
||||
if (revertGM) body += "RevertGM: " + "\u00a7a\u2714" + "\n";
|
||||
body += "Logged: " + (notifyDiscord ? "\u00a7a\u2714" : "\u00a7c\u2718");
|
||||
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new net.md_5.bungee.api.chat.hover.content.Text(body)));
|
||||
ServerUtils.forEachPlayer(trusted -> {
|
||||
if (Sentinel.isTrusted(trusted)) {
|
||||
|
||||
@@ -131,8 +131,8 @@ public class ProfanityFilter {
|
||||
}
|
||||
|
||||
public static String highlightProfanity(String text) {
|
||||
String highlightedSwears = highlightSwears(fullSimplify(text), "§e", "§f");
|
||||
String highlightedText = highlightSlurs(highlightedSwears, "§c", "§f");
|
||||
String highlightedSwears = highlightSwears(fullSimplify(text), "\u00a7e", "\u00a7f");
|
||||
String highlightedText = highlightSlurs(highlightedSwears, "\u00a7c", "\u00a7f");
|
||||
return highlightedText;
|
||||
}
|
||||
public static String highlightProfanity(String text, String start, String end) {
|
||||
|
||||
@@ -25,7 +25,7 @@ public final class ArrayUtils {
|
||||
}
|
||||
|
||||
public static <T> String list2string(List<T> list) {
|
||||
return ("§7[§e" + String.join("§7, §e", ArrayUtils.toNewList(list, Object::toString)) + "§7]");
|
||||
return ("\u00a77[\u00a7e" + String.join("\u00a77, \u00a7e", ArrayUtils.toNewList(list, Object::toString)) + "\u00a77]");
|
||||
}
|
||||
|
||||
public static <T> List<T> bind(Iterable<T> tList, T... ts) {
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Text {
|
||||
return color(prefix + text);
|
||||
}
|
||||
public static String removeFirstColor(String input) {
|
||||
if (input.startsWith("§")) {
|
||||
if (input.startsWith("\u00a7")) {
|
||||
if (input.length() > 2) {
|
||||
return input.substring(2);
|
||||
} else {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
"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)",
|
||||
"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)",
|
||||
"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",
|
||||
@@ -27,7 +27,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)",
|
||||
"profanity-mute-notification" : "§b§n%1$s§7 has been auto-muted by the anti-swear! §8(§c%2$s§7/§4%3$s8)",
|
||||
"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)",
|
||||
|
||||
Reference in New Issue
Block a user