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;
|
||||
log.info("Loading Config...");
|
||||
loadConfig();
|
||||
log.info("Language Status: (" + dict.get("if-you-see-this-lang-is-broken") + ")");
|
||||
log.info("Initializing Server ID...");
|
||||
String serverID = Authenticator.getServerID();
|
||||
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";
|
||||
try {
|
||||
authStatus = Authenticator.authorize(key, serverID);
|
||||
authstatus = Auth.authorize(key,serverID);
|
||||
authstatus = Auth.authorize(key, serverID);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -154,9 +155,18 @@ public final class Sentinel extends JavaPlugin {
|
||||
strictConfig = JsonSerializable.load(strctcfg,StrictConfig.class,new StrictConfig());
|
||||
swearConfig = JsonSerializable.load(swrcfg,SwearsConfig.class,new SwearsConfig());
|
||||
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 + ")...");
|
||||
dict = JsonSerializable.load(LanguageFile.PATH,LanguageFile.class,new LanguageFile());
|
||||
|
||||
log.info("Verifying Config...");
|
||||
//getConfig().options().copyDefaults();
|
||||
|
||||
@@ -62,7 +62,7 @@ public class FilterAction {
|
||||
sendDiscordLog(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);
|
||||
sendConsoleLog(offender,e,type);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class FilterAction {
|
||||
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.";
|
||||
|
||||
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.setUsername("Sentinel Anti-Nuke | Logs");
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ public class AdvancedConfig implements JsonSerializable<AdvancedConfig> {
|
||||
|
||||
@Override
|
||||
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<>() {{
|
||||
|
||||
@@ -11,7 +11,9 @@ public class FPConfig implements JsonSerializable<FPConfig> {
|
||||
|
||||
@Override
|
||||
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(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.github.thetrouper.sentinel.server.config;
|
||||
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||
import io.github.thetrouper.sentinel.Sentinel;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
@@ -25,4 +25,4 @@ public class LanguageFile implements JsonSerializable<LanguageFile> {
|
||||
public String format(String input) {
|
||||
return input;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,25 +10,29 @@ public class MainConfig implements JsonSerializable<MainConfig> {
|
||||
|
||||
@Override
|
||||
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 static String prefix = "§d§lSentinel §8» §7";
|
||||
public static String webhook = "https://discord.com/api/webhooks/id/token";
|
||||
public static String lang = "en-us.json";
|
||||
public static List<String> trustedPlayers = new ArrayList<>() {{
|
||||
public class Plugin {
|
||||
public String prefix = "§d§lSentinel §8» §7";
|
||||
public String webhook = "https://discord.com/api/webhooks/id/token";
|
||||
public String lang = "en-us.json";
|
||||
public List<String> trustedPlayers = new ArrayList<>() {{
|
||||
add("049460f7-21cb-42f5-8059-d42752bf406f");
|
||||
}};
|
||||
public static boolean blockSpecific = true;
|
||||
public static boolean preventNBT = true;
|
||||
public static boolean preventCmdBlockPlace = true;
|
||||
public static boolean preventCmdBlockUse = true;
|
||||
public static boolean preventCmdBlockChange = true;
|
||||
public static boolean preventCmdCartPlace = true;
|
||||
public static boolean preventCmdCartUse = true;
|
||||
public static boolean cmdBlockOpCheck = true;
|
||||
public static List<String> dangerous = new ArrayList<>() {{
|
||||
public boolean blockSpecific = true;
|
||||
public boolean preventNBT = true;
|
||||
public boolean preventCmdBlockPlace = true;
|
||||
public boolean preventCmdBlockUse = true;
|
||||
public boolean preventCmdBlockChange = true;
|
||||
public boolean preventCmdCartPlace = true;
|
||||
public boolean preventCmdCartUse = true;
|
||||
public boolean cmdBlockOpCheck = true;
|
||||
public List<String> dangerous = new ArrayList<>() {{
|
||||
add("op");
|
||||
add("deop");
|
||||
add("stop");
|
||||
@@ -41,56 +45,58 @@ public class MainConfig implements JsonSerializable<MainConfig> {
|
||||
add("data");
|
||||
add("whitelist");
|
||||
}};
|
||||
public static boolean logDangerous = true;
|
||||
public static boolean logCmdBlocks = true;
|
||||
public static boolean logNBT = true;
|
||||
public static boolean logSpecific = false;
|
||||
public static List<String> logged = new ArrayList<>() {{
|
||||
public boolean logDangerous = true;
|
||||
public boolean logCmdBlocks = true;
|
||||
public boolean logNBT = true;
|
||||
public boolean logSpecific = false;
|
||||
public List<String> logged = new ArrayList<>() {{
|
||||
add("give");
|
||||
add("item");
|
||||
}};
|
||||
public static boolean deop = true;
|
||||
public static boolean nbtPunish = false;
|
||||
public static boolean cmdBlockPunish = false;
|
||||
public static boolean commandPunish = false;
|
||||
public static boolean specificPunish = false;
|
||||
public static List<String> punishCommands = new ArrayList<>() {{
|
||||
public boolean deop = true;
|
||||
public boolean nbtPunish = false;
|
||||
public boolean cmdBlockPunish = false;
|
||||
public boolean commandPunish = false;
|
||||
public boolean specificPunish = false;
|
||||
public List<String> punishCommands = new ArrayList<>() {{
|
||||
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.");
|
||||
}};
|
||||
public static boolean reopCommand = false;
|
||||
public boolean reopCommand = false;
|
||||
}
|
||||
|
||||
public static class Chat {
|
||||
public static boolean antiUnicode = true;
|
||||
public class Chat {
|
||||
public AntiSwear antiSwear = new AntiSwear();
|
||||
public AntiSpam antiSpam = new AntiSpam();
|
||||
public boolean antiUnicode = true;
|
||||
|
||||
public static class AntiSpam {
|
||||
public static boolean antiSpamEnabled = true;
|
||||
public static int defaultGain = 1;
|
||||
public static int lowGain = 2;
|
||||
public static int mediumGain = 4;
|
||||
public static int highGain = 6;
|
||||
public static int heatDecay = 1;
|
||||
public static int blockHeat = 10;
|
||||
public static int punishHeat = 25;
|
||||
public static boolean clearChat = true;
|
||||
public static String chatClearCommand = "cc";
|
||||
public static String spamPunishCommand = "mute %player% 1m Please refrain from spamming!";
|
||||
public static boolean logSpam = true;
|
||||
public class AntiSpam {
|
||||
public boolean antiSpamEnabled = true;
|
||||
public int defaultGain = 1;
|
||||
public int lowGain = 2;
|
||||
public int mediumGain = 4;
|
||||
public int highGain = 6;
|
||||
public int heatDecay = 1;
|
||||
public int blockHeat = 10;
|
||||
public int punishHeat = 25;
|
||||
public boolean clearChat = true;
|
||||
public String chatClearCommand = "cc";
|
||||
public String spamPunishCommand = "mute %player% 1m Please refrain from spamming!";
|
||||
public boolean logSpam = true;
|
||||
}
|
||||
public static class AntiSwear {
|
||||
public static boolean antiSwearEnabled = true;
|
||||
public static int lowScore = 0;
|
||||
public static int mediumLowScore = 1;
|
||||
public static int mediumScore = 3;
|
||||
public static int mediumHighScore = 5;
|
||||
public static int highScore = 7;
|
||||
public static int scoreDecay = 3;
|
||||
public static int punishScore = 20;
|
||||
public static boolean strictInstaPunish = true;
|
||||
public static 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 static boolean logSwears = true;
|
||||
public class AntiSwear {
|
||||
public boolean antiSwearEnabled = true;
|
||||
public int lowScore = 0;
|
||||
public int mediumLowScore = 1;
|
||||
public int mediumScore = 3;
|
||||
public int mediumHighScore = 5;
|
||||
public int highScore = 7;
|
||||
public int scoreDecay = 3;
|
||||
public int punishScore = 20;
|
||||
public boolean strictInstaPunish = true;
|
||||
public String swearPunishCommand = "mute %player% 15m Do not attempt to bypass the Profanity Filter";
|
||||
public String strictPunishCommand = "mute %player% 1h Discriminatory speech is not tolerated on this server!";
|
||||
public boolean logSwears = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@ import java.io.FileWriter;
|
||||
public class NBTConfig implements JsonSerializable<NBTConfig> {
|
||||
@Override
|
||||
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;
|
||||
|
||||
@@ -9,7 +9,9 @@ import java.util.List;
|
||||
public class StrictConfig implements JsonSerializable<StrictConfig> {
|
||||
@Override
|
||||
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<>() {{
|
||||
|
||||
@@ -9,7 +9,9 @@ import java.util.List;
|
||||
public class SwearsConfig implements JsonSerializable<SwearsConfig> {
|
||||
@Override
|
||||
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<>() {{
|
||||
|
||||
Reference in New Issue
Block a user