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 {
|
||||
|
||||
Reference in New Issue
Block a user