Everything has errors cuz i gotta make something not static
This commit is contained in:
@@ -50,15 +50,16 @@ public final class Sentinel extends JavaPlugin {
|
|||||||
instance = this;
|
instance = this;
|
||||||
log.info("Loading Config...");
|
log.info("Loading Config...");
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
log.info("Language Status: (" + dict.get("if-you-see-this-lang-is-broken") + ")");
|
||||||
log.info("Initializing Server ID...");
|
log.info("Initializing Server ID...");
|
||||||
String serverID = Authenticator.getServerID();
|
String serverID = Authenticator.getServerID();
|
||||||
identifier = serverID;
|
identifier = serverID;
|
||||||
log.info("Pre-load finished!\n]====---- Requesting Authentication (" + dict.get("if-you-see-this-lang-is-broken") + ") ----====[ \n- License Key: " + key + " \n- Server ID: " + serverID);
|
log.info("Pre-load finished!\n]====---- Requesting Authentication ----====[ \n- License Key: " + key + " \n- Server ID: " + serverID);
|
||||||
String authStatus = "ERROR";
|
String authStatus = "ERROR";
|
||||||
String authstatus = "ERROR";
|
String authstatus = "ERROR";
|
||||||
try {
|
try {
|
||||||
authStatus = Authenticator.authorize(key, serverID);
|
authStatus = Authenticator.authorize(key, serverID);
|
||||||
authstatus = Auth.authorize(key,serverID);
|
authstatus = Auth.authorize(key, serverID);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -154,9 +155,18 @@ public final class Sentinel extends JavaPlugin {
|
|||||||
strictConfig = JsonSerializable.load(strctcfg,StrictConfig.class,new StrictConfig());
|
strictConfig = JsonSerializable.load(strctcfg,StrictConfig.class,new StrictConfig());
|
||||||
swearConfig = JsonSerializable.load(swrcfg,SwearsConfig.class,new SwearsConfig());
|
swearConfig = JsonSerializable.load(swrcfg,SwearsConfig.class,new SwearsConfig());
|
||||||
nbtConfig = JsonSerializable.load(nbtcfg,NBTConfig.class,new NBTConfig());
|
nbtConfig = JsonSerializable.load(nbtcfg,NBTConfig.class,new NBTConfig());
|
||||||
|
dict = JsonSerializable.load(LanguageFile.PATH,LanguageFile.class,new LanguageFile());
|
||||||
|
|
||||||
|
// Save
|
||||||
|
mainConfig.save();
|
||||||
|
advConfig.save();
|
||||||
|
fpConfig.save();
|
||||||
|
strictConfig.save();
|
||||||
|
swearConfig.save();
|
||||||
|
nbtConfig.save();
|
||||||
|
dict.save();
|
||||||
|
|
||||||
log.info("Loading Dictionary (" + MainConfig.Plugin.lang + ")...");
|
log.info("Loading Dictionary (" + MainConfig.Plugin.lang + ")...");
|
||||||
dict = JsonSerializable.load(LanguageFile.PATH,LanguageFile.class,new LanguageFile());
|
|
||||||
|
|
||||||
log.info("Verifying Config...");
|
log.info("Verifying Config...");
|
||||||
//getConfig().options().copyDefaults();
|
//getConfig().options().copyDefaults();
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class FilterAction {
|
|||||||
sendDiscordLog(offender,e,type);
|
sendDiscordLog(offender,e,type);
|
||||||
sendConsoleLog(offender,e,type);
|
sendConsoleLog(offender,e,type);
|
||||||
}
|
}
|
||||||
if (type == FAT.SPAM && MainConfig.Chat.AntiSpam.logSpam) {
|
if (type == FAT.SPAM && Sentinel.mainConfig) {
|
||||||
sendDiscordLog(offender,e,type);
|
sendDiscordLog(offender,e,type);
|
||||||
sendConsoleLog(offender,e,type);
|
sendConsoleLog(offender,e,type);
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ public class FilterAction {
|
|||||||
String title = offender.getName() + " has triggered the " + type.getName() + "!";
|
String title = offender.getName() + " has triggered the " + type.getName() + "!";
|
||||||
String executed = type.getExecutedCommand() != null ? type.getExecutedCommand() : "Nothing, its a standard flag. You shouldn't be seeing this, please report it.";
|
String executed = type.getExecutedCommand() != null ? type.getExecutedCommand() : "Nothing, its a standard flag. You shouldn't be seeing this, please report it.";
|
||||||
|
|
||||||
DiscordWebhook webhook = new DiscordWebhook(MainConfig.Plugin.webhook);
|
DiscordWebhook webhook = new DiscordWebhook(Sentinel.mainConfig.);
|
||||||
webhook.setAvatarUrl("https://r2.e-z.host/d440b58a-ba90-4839-8df6-8bba298cf817/3lwit5nt.png");
|
webhook.setAvatarUrl("https://r2.e-z.host/d440b58a-ba90-4839-8df6-8bba298cf817/3lwit5nt.png");
|
||||||
webhook.setUsername("Sentinel Anti-Nuke | Logs");
|
webhook.setUsername("Sentinel Anti-Nuke | Logs");
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ public class AdvancedConfig implements JsonSerializable<AdvancedConfig> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
return new File("plugins/Sentinel/advanced-config.json");
|
File file = new File("plugins/Sentinel/advanced-config.json");
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, String> leetPatterns = new HashMap<>() {{
|
public static Map<String, String> leetPatterns = new HashMap<>() {{
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ public class FPConfig implements JsonSerializable<FPConfig> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
return new File("plugins/Sentinel/false-positives.json");
|
File file = new File("plugins/Sentinel/false-positives.json");
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> swearWhitelist = new ArrayList<>(Arrays.asList(
|
public static List<String> swearWhitelist = new ArrayList<>(Arrays.asList(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package io.github.thetrouper.sentinel.server.config;
|
package io.github.thetrouper.sentinel.server.config;
|
||||||
|
|
||||||
import io.github.thetrouper.sentinel.Sentinel;
|
|
||||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||||
|
import io.github.thetrouper.sentinel.Sentinel;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -25,4 +25,4 @@ public class LanguageFile implements JsonSerializable<LanguageFile> {
|
|||||||
public String format(String input) {
|
public String format(String input) {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,25 +10,29 @@ public class MainConfig implements JsonSerializable<MainConfig> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
return new File("plugins/Sentinel/main-config.json");
|
File file = new File("plugins/Sentinel/main-config.json");
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
return file;
|
||||||
}
|
}
|
||||||
|
public Plugin plugin = new Plugin();
|
||||||
|
public Chat chat = new Chat();
|
||||||
|
|
||||||
public static class Plugin {
|
public class Plugin {
|
||||||
public static String prefix = "§d§lSentinel §8» §7";
|
public String prefix = "§d§lSentinel §8» §7";
|
||||||
public static String webhook = "https://discord.com/api/webhooks/id/token";
|
public String webhook = "https://discord.com/api/webhooks/id/token";
|
||||||
public static String lang = "en-us.json";
|
public String lang = "en-us.json";
|
||||||
public static List<String> trustedPlayers = new ArrayList<>() {{
|
public List<String> trustedPlayers = new ArrayList<>() {{
|
||||||
add("049460f7-21cb-42f5-8059-d42752bf406f");
|
add("049460f7-21cb-42f5-8059-d42752bf406f");
|
||||||
}};
|
}};
|
||||||
public static boolean blockSpecific = true;
|
public boolean blockSpecific = true;
|
||||||
public static boolean preventNBT = true;
|
public boolean preventNBT = true;
|
||||||
public static boolean preventCmdBlockPlace = true;
|
public boolean preventCmdBlockPlace = true;
|
||||||
public static boolean preventCmdBlockUse = true;
|
public boolean preventCmdBlockUse = true;
|
||||||
public static boolean preventCmdBlockChange = true;
|
public boolean preventCmdBlockChange = true;
|
||||||
public static boolean preventCmdCartPlace = true;
|
public boolean preventCmdCartPlace = true;
|
||||||
public static boolean preventCmdCartUse = true;
|
public boolean preventCmdCartUse = true;
|
||||||
public static boolean cmdBlockOpCheck = true;
|
public boolean cmdBlockOpCheck = true;
|
||||||
public static List<String> dangerous = new ArrayList<>() {{
|
public List<String> dangerous = new ArrayList<>() {{
|
||||||
add("op");
|
add("op");
|
||||||
add("deop");
|
add("deop");
|
||||||
add("stop");
|
add("stop");
|
||||||
@@ -41,56 +45,58 @@ public class MainConfig implements JsonSerializable<MainConfig> {
|
|||||||
add("data");
|
add("data");
|
||||||
add("whitelist");
|
add("whitelist");
|
||||||
}};
|
}};
|
||||||
public static boolean logDangerous = true;
|
public boolean logDangerous = true;
|
||||||
public static boolean logCmdBlocks = true;
|
public boolean logCmdBlocks = true;
|
||||||
public static boolean logNBT = true;
|
public boolean logNBT = true;
|
||||||
public static boolean logSpecific = false;
|
public boolean logSpecific = false;
|
||||||
public static List<String> logged = new ArrayList<>() {{
|
public List<String> logged = new ArrayList<>() {{
|
||||||
add("give");
|
add("give");
|
||||||
add("item");
|
add("item");
|
||||||
}};
|
}};
|
||||||
public static boolean deop = true;
|
public boolean deop = true;
|
||||||
public static boolean nbtPunish = false;
|
public boolean nbtPunish = false;
|
||||||
public static boolean cmdBlockPunish = false;
|
public boolean cmdBlockPunish = false;
|
||||||
public static boolean commandPunish = false;
|
public boolean commandPunish = false;
|
||||||
public static boolean specificPunish = false;
|
public boolean specificPunish = false;
|
||||||
public static List<String> punishCommands = new ArrayList<>() {{
|
public List<String> punishCommands = new ArrayList<>() {{
|
||||||
add("smite %player%");
|
add("smite %player%");
|
||||||
add("ban %player% ]=- Sentinel -=[ You have been banned for attempting a dangerous action. If you believe this to be a mistake, please contact the server owner.");
|
add("ban %player% ]=- Sentinel -=[ You have been banned for attempting a dangerous action. If you believe this to be a mistake, please contact the server owner.");
|
||||||
}};
|
}};
|
||||||
public static boolean reopCommand = false;
|
public boolean reopCommand = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Chat {
|
public class Chat {
|
||||||
public static boolean antiUnicode = true;
|
public AntiSwear antiSwear = new AntiSwear();
|
||||||
|
public AntiSpam antiSpam = new AntiSpam();
|
||||||
|
public boolean antiUnicode = true;
|
||||||
|
|
||||||
public static class AntiSpam {
|
public class AntiSpam {
|
||||||
public static boolean antiSpamEnabled = true;
|
public boolean antiSpamEnabled = true;
|
||||||
public static int defaultGain = 1;
|
public int defaultGain = 1;
|
||||||
public static int lowGain = 2;
|
public int lowGain = 2;
|
||||||
public static int mediumGain = 4;
|
public int mediumGain = 4;
|
||||||
public static int highGain = 6;
|
public int highGain = 6;
|
||||||
public static int heatDecay = 1;
|
public int heatDecay = 1;
|
||||||
public static int blockHeat = 10;
|
public int blockHeat = 10;
|
||||||
public static int punishHeat = 25;
|
public int punishHeat = 25;
|
||||||
public static boolean clearChat = true;
|
public boolean clearChat = true;
|
||||||
public static String chatClearCommand = "cc";
|
public String chatClearCommand = "cc";
|
||||||
public static String spamPunishCommand = "mute %player% 1m Please refrain from spamming!";
|
public String spamPunishCommand = "mute %player% 1m Please refrain from spamming!";
|
||||||
public static boolean logSpam = true;
|
public boolean logSpam = true;
|
||||||
}
|
}
|
||||||
public static class AntiSwear {
|
public class AntiSwear {
|
||||||
public static boolean antiSwearEnabled = true;
|
public boolean antiSwearEnabled = true;
|
||||||
public static int lowScore = 0;
|
public int lowScore = 0;
|
||||||
public static int mediumLowScore = 1;
|
public int mediumLowScore = 1;
|
||||||
public static int mediumScore = 3;
|
public int mediumScore = 3;
|
||||||
public static int mediumHighScore = 5;
|
public int mediumHighScore = 5;
|
||||||
public static int highScore = 7;
|
public int highScore = 7;
|
||||||
public static int scoreDecay = 3;
|
public int scoreDecay = 3;
|
||||||
public static int punishScore = 20;
|
public int punishScore = 20;
|
||||||
public static boolean strictInstaPunish = true;
|
public boolean strictInstaPunish = true;
|
||||||
public static String swearPunishCommand = "mute %player% 15m Do not attempt to bypass the Profanity Filter";
|
public String swearPunishCommand = "mute %player% 15m Do not attempt to bypass the Profanity Filter";
|
||||||
public static String strictPunishCommand = "mute %player% 1h Discriminatory speech is not tolerated on this server!";
|
public String strictPunishCommand = "mute %player% 1h Discriminatory speech is not tolerated on this server!";
|
||||||
public static boolean logSwears = true;
|
public boolean logSwears = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ import java.io.FileWriter;
|
|||||||
public class NBTConfig implements JsonSerializable<NBTConfig> {
|
public class NBTConfig implements JsonSerializable<NBTConfig> {
|
||||||
@Override
|
@Override
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
return new File("plugins/Sentinel/NBTConfig.json");
|
File file = new File("plugins/Sentinel/nbt-config.json");
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean allowName = true;
|
public static boolean allowName = true;
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ import java.util.List;
|
|||||||
public class StrictConfig implements JsonSerializable<StrictConfig> {
|
public class StrictConfig implements JsonSerializable<StrictConfig> {
|
||||||
@Override
|
@Override
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
return new File("plugins/Sentinel/strict.json");
|
File file = new File("plugins/Sentinel/strict.json");
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> strict = new ArrayList<>() {{
|
public static List<String> strict = new ArrayList<>() {{
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ import java.util.List;
|
|||||||
public class SwearsConfig implements JsonSerializable<SwearsConfig> {
|
public class SwearsConfig implements JsonSerializable<SwearsConfig> {
|
||||||
@Override
|
@Override
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
return new File("plugins/Sentinel/swears.json");
|
File file = new File("plugins/Sentinel/swears.json");
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> swears = new ArrayList<>() {{
|
public static List<String> swears = new ArrayList<>() {{
|
||||||
|
|||||||
38
src/main/resources/en_us.json
Normal file
38
src/main/resources/en_us.json
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"dictionary" : {
|
||||||
|
"if-you-see-this-lang-is-broken" : "Sentinel language is working!",
|
||||||
|
"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!",
|
||||||
|
"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!",
|
||||||
|
"spy-enabled" : "SocialSpy is now enabled.",
|
||||||
|
"spy-disabled" : "SocialSpy is now disabled.",
|
||||||
|
"action-automatic" : "§7This action was preformed automatically\n§7by the §bSentinel Anti-Spam§7 algorithm.",
|
||||||
|
"action-automatic-reportable" : "§7This action was preformed automatically \n§7by the §bSentinel Profanity Filter§7 algorithm!\n§8§o(Click to report false positive)",
|
||||||
|
"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",
|
||||||
|
"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$s§7 has been auto-muted by the anti-swear! §8(§c%2$s§7/§4%3$s§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)",
|
||||||
|
"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-block-warn" : "Do not spam in chat! Please wait before sending another message.",
|
||||||
|
"spam-mute-warn" : "§cYou have been auto-punished for violating the anti-spam repetitively!",
|
||||||
|
"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)",
|
||||||
|
"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)",
|
||||||
|
"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)"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user