Added Minehut (Dynamic IP) auth and redid config

This commit is contained in:
trouper
2023-09-03 19:58:31 -05:00
parent 3b2ebe4170
commit 97d395a750
9 changed files with 287 additions and 66 deletions

View File

@@ -1,7 +1,7 @@
# Plugin # Plugin
group = 'io.github.thetrouper' group = 'io.github.thetrouper'
version = 0.1.8 version = 0.1.9
# Minecraft # Minecraft
mc_version = 1.19.4 mc_version = 1.19.4

View File

@@ -10,8 +10,10 @@ import io.github.thetrouper.sentinel.events.*;
import io.github.thetrouper.sentinel.server.functions.AntiSpam; import io.github.thetrouper.sentinel.server.functions.AntiSpam;
import io.github.thetrouper.sentinel.server.functions.Authenticator; import io.github.thetrouper.sentinel.server.functions.Authenticator;
import io.github.thetrouper.sentinel.server.functions.ProfanityFilter; import io.github.thetrouper.sentinel.server.functions.ProfanityFilter;
import io.github.thetrouper.sentinel.server.functions.Telemetry;
import io.github.thetrouper.sentinel.server.util.FileUtils; import io.github.thetrouper.sentinel.server.util.FileUtils;
import io.github.thetrouper.sentinel.server.util.Randomizer; import io.github.thetrouper.sentinel.server.util.Randomizer;
import net.md_5.bungee.api.chat.ClickEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
@@ -32,6 +34,8 @@ public final class Sentinel extends JavaPlugin {
public static String prefix = ""; public static String prefix = "";
public static String key = ""; public static String key = "";
public static final Logger log = Bukkit.getLogger(); public static final Logger log = Bukkit.getLogger();
public static String identifier = "";
public static boolean usesDynamicIP;
/** /**
* Plugin startup logic * Plugin startup logic
@@ -42,6 +46,7 @@ public final class Sentinel extends JavaPlugin {
instance = this; instance = this;
Config.loadConfiguration(); Config.loadConfiguration();
String serverID = Authenticator.getServerID(); String serverID = Authenticator.getServerID();
identifier = serverID;
log.info("\n]====---- Requesting Authentication ----====[ \n- license Key: " + key + " \n- Server ID: " + serverID); log.info("\n]====---- Requesting Authentication ----====[ \n- license Key: " + key + " \n- Server ID: " + serverID);
String authStatus = "ERROR"; String authStatus = "ERROR";
try { try {
@@ -51,54 +56,21 @@ public final class Sentinel extends JavaPlugin {
} }
switch (authStatus) { switch (authStatus) {
case "AUTHORIZED" -> { case "AUTHORIZED" -> {
log.info("]======----- Auth Success! -----======["); startup();
// Init }
getConfig().options().copyDefaults(); case "MINEHUT" -> {
saveResource("nbt-config.yml", false); usesDynamicIP = true;
saveResource("false-positives.yml", false); String minehutStatus = Telemetry.loadTelemetryHook(serverID, key);
saveResource("strict.yml", false); switch (minehutStatus) {
saveResource("swears.yml", false); case "SUCCESS" -> {
saveDefaultConfig(); log.info("Dynamic IP auth Success!");
startup();
}
// Plugin startup logic case "FAILURE" -> {
log.info("Sentinel has loaded! (" + getDescription().getVersion() + ")"); log.info("Dynamic IP Failure. Webhook Error possible? Please contact obvwolf to fix this.");
getServer().getPluginManager().disablePlugin(this);
// Enable Functions }
AntiSpam.enableAntiSpam(); }
ProfanityFilter.enableAntiSwear();
prefix = Config.Plugin.getPrefix();
// Commands -> BE SURE TO REGISTER ANY NEW COMMANDS IN PLUGIN.YML (src/main/java/resources/plugin.yml)!
new SentinelCommand().register();
new MessageCommand().register();
new ReplyCommand().register();
new ReopCommand().register();
new SocialSpyCommand().register();
// Events
manager.registerEvents(new CommandEvent(),this);
manager.registerEvents(new CMDBlockExecute(), this);
manager.registerEvents(new CMDBlockPlace(), this);
manager.registerEvents(new CMDBlockUse(), this);
manager.registerEvents(new CMDMinecartPlace(), this);
manager.registerEvents(new CMDMinecartUse(), this);
manager.registerEvents(new NBTEvents(), this);
manager.registerEvents(new ChatEvent(),this);
// Scheduled timers
Bukkit.getScheduler().runTaskTimer(this, AntiSpam::decayHeat,0, 20);
Bukkit.getScheduler().runTaskTimer(this, ProfanityFilter::decayScore,0,1200);
log.info("\n" +
" ____ __ ___ \n" +
"/\\ _`\\ /\\ \\__ __ /\\_ \\ \n" +
"\\ \\,\\L\\_\\ __ ___\\ \\ ,_\\/\\_\\ ___ __\\//\\ \\ \n" +
" \\/_\\__ \\ /'__`\\/' _ `\\ \\ \\/\\/\\ \\ /' _ `\\ /'__`\\\\ \\ \\ \n" +
" /\\ \\L\\ \\/\\ __//\\ \\/\\ \\ \\ \\_\\ \\ \\/\\ \\/\\ \\/\\ __/ \\_\\ \\_ \n" +
" \\ `\\____\\ \\____\\ \\_\\ \\_\\ \\__\\\\ \\_\\ \\_\\ \\_\\ \\____\\/\\____\\\n" +
" \\/_____/\\/____/\\/_/\\/_/\\/__/ \\/_/\\/_/\\/_/\\/____/\\/____/\n" +
" ]====---- Advanced Anti-Grief & Chat Filter ----====[");
} }
case "INVALID-ID" -> { case "INVALID-ID" -> {
log.info("Authentication Failure, You have not whitelisted this server ID yet."); log.info("Authentication Failure, You have not whitelisted this server ID yet.");
@@ -115,6 +87,53 @@ public final class Sentinel extends JavaPlugin {
} }
} }
private void startup() {
log.info("\n]======----- Auth Success! -----======[");
// Init
getConfig().options().copyDefaults();
saveDefaultConfig();
// Plugin startup logic
log.info("Sentinel has loaded! (" + getDescription().getVersion() + ")");
// Enable Functions
AntiSpam.enableAntiSpam();
ProfanityFilter.enableAntiSwear();
prefix = Config.Plugin.getPrefix();
// Commands -> BE SURE TO REGISTER ANY NEW COMMANDS IN PLUGIN.YML (src/main/java/resources/plugin.yml)!
new SentinelCommand().register();
new MessageCommand().register();
new ReplyCommand().register();
new ReopCommand().register();
new SocialSpyCommand().register();
// Events
manager.registerEvents(new CommandEvent(),this);
manager.registerEvents(new CMDBlockExecute(), this);
manager.registerEvents(new CMDBlockPlace(), this);
manager.registerEvents(new CMDBlockUse(), this);
manager.registerEvents(new CMDMinecartPlace(), this);
manager.registerEvents(new CMDMinecartUse(), this);
manager.registerEvents(new NBTEvents(), this);
manager.registerEvents(new ChatEvent(),this);
// Scheduled timers
Bukkit.getScheduler().runTaskTimer(this, AntiSpam::decayHeat,0, 20);
Bukkit.getScheduler().runTaskTimer(this, ProfanityFilter::decayScore,0,1200);
log.info("\n" +
" ____ __ ___ \n" +
"/\\ _`\\ /\\ \\__ __ /\\_ \\ \n" +
"\\ \\,\\L\\_\\ __ ___\\ \\ ,_\\/\\_\\ ___ __\\//\\ \\ \n" +
" \\/_\\__ \\ /'__`\\/' _ `\\ \\ \\/\\/\\ \\ /' _ `\\ /'__`\\\\ \\ \\ \n" +
" /\\ \\L\\ \\/\\ __//\\ \\/\\ \\ \\ \\_\\ \\ \\/\\ \\/\\ \\/\\ __/ \\_\\ \\_ \n" +
" \\ `\\____\\ \\____\\ \\_\\ \\_\\ \\__\\\\ \\_\\ \\_\\ \\_\\ \\____\\/\\____\\\n" +
" \\/_____/\\/____/\\/_/\\/_/\\/__/ \\/_/\\/_/\\/_/\\/____/\\/____/\n" +
" ]====---- Advanced Anti-Grief & Chat Filter ----====[");
}
/** /**
* Plugin shutdown logic * Plugin shutdown logic
*/ */
@@ -122,9 +141,7 @@ public final class Sentinel extends JavaPlugin {
public void onDisable() { public void onDisable() {
// Plugin shutdown logic // Plugin shutdown logic
log.info("Sentinel has disabled! (" + getDescription().getVersion() + ") Your server is now no longer protected!"); log.info("Sentinel has disabled! (" + getDescription().getVersion() + ") Your server is now no longer protected!");
} Telemetry.sendShutdownLog(identifier,key);
public static File getDF() {
return getInstance().getDataFolder();
} }
/** /**

View File

@@ -4,12 +4,16 @@
package io.github.thetrouper.sentinel.data; package io.github.thetrouper.sentinel.data;
import com.google.common.base.Charsets;
import io.github.thetrouper.sentinel.Sentinel; import io.github.thetrouper.sentinel.Sentinel;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -18,12 +22,12 @@ import java.util.Map;
* Config loader * Config loader
*/ */
public abstract class Config { public abstract class Config {
private static final FileConfiguration mainConfig = Sentinel.getInstance().getConfig();
private static final FileConfiguration nbtConfig = YamlConfiguration.loadConfiguration(new File(Sentinel.getDF() + "nbt-config.yml"));
private static final FileConfiguration falsePositives = YamlConfiguration.loadConfiguration(new File(Sentinel.getDF() + "false-positives.yml"));
private static final FileConfiguration strictWords = YamlConfiguration.loadConfiguration(new File(Sentinel.getDF() + "strict.yml"));
private static final FileConfiguration swearWords = YamlConfiguration.loadConfiguration(new File(Sentinel.getDF() + "swears"));
private static final FileConfiguration mainConfig = Sentinel.getInstance().getConfig();
private static final FileConfiguration nbtConfig = getConfig("nbt-config.yml");
private static final FileConfiguration falsePositives = getConfig("false-positives.yml");
private static final FileConfiguration strictWords = getConfig("strict.yml");
private static final FileConfiguration swearWords = getConfig("swears.yml");
public static List<String> getPunishCommands() { public static List<String> getPunishCommands() {
return punishCommands; return punishCommands;
@@ -137,7 +141,15 @@ public abstract class Config {
public static List<String> swearBlacklist; public static List<String> swearBlacklist;
public static List<String> slurs; public static List<String> slurs;
public static Map<String, String> leetPatterns; public static Map<String, String> leetPatterns;
public static FileConfiguration getConfig(String fileName) {
File configFile = new File(Sentinel.getInstance().getDataFolder(), fileName);
if (!configFile.exists()) {
Sentinel.getInstance().saveResource(fileName, false);
}
return YamlConfiguration.loadConfiguration(configFile);
}
public static void loadConfiguration() { public static void loadConfiguration() {
Sentinel.prefix = mainConfig.getString("config.plugin.prefix"); Sentinel.prefix = mainConfig.getString("config.plugin.prefix");

View File

@@ -14,8 +14,23 @@ public class ChatEvent implements Listener {
@EventHandler @EventHandler
public static void onChat(AsyncPlayerChatEvent e) { public static void onChat(AsyncPlayerChatEvent e) {
if (e.isCancelled()) return; if (e.isCancelled()) return;
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antiswear.bypass")) if (Config.antiSwearEnabled) ProfanityFilter.handleProfanityFilter(e); if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antiunicode.bypass")) {
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antispam.bypass")) if (Config.antiSpamEnabled) AntiSpam.handleAntiSpam(e); if (Config.antiUnicode) {
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antiunicode.bypass")) if (Config.antiUnicode) AntiUnicode.handleAntiUnicode(e); AntiUnicode.handleAntiUnicode(e);
return;
}
}
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antiswear.bypass")) {
if (Config.antiSwearEnabled) {
ProfanityFilter.handleProfanityFilter(e);
return;
}
}
if (!Sentinel.isTrusted(e.getPlayer()) || !e.getPlayer().hasPermission("sentinel.chat.antispam.bypass")) {
if (Config.antiSpamEnabled) {
AntiSpam.handleAntiSpam(e);
return;
}
}
} }
} }

View File

@@ -58,16 +58,22 @@ public class Authenticator {
if (key.equals(licenseKey)) { if (key.equals(licenseKey)) {
if (Arrays.asList(allowedArr).contains(serverID)) { if (Arrays.asList(allowedArr).contains(serverID)) {
authStatus = "AUTHORIZED"; authStatus = "AUTHORIZED";
return authStatus;
} else { } else {
if (Arrays.asList(allowedArr).contains("minehut")) {
authStatus = "MINEHUT";
return authStatus;
}
authStatus = "INVALID-ID"; authStatus = "INVALID-ID";
return authStatus;
} }
break;
} }
} }
} }
if (authStatus.isEmpty()) { if (authStatus.isEmpty()) {
authStatus = "UNREGISTERED"; authStatus = "UNREGISTERED";
return authStatus;
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();

View File

@@ -1,19 +1,33 @@
package io.github.thetrouper.sentinel.server.functions; package io.github.thetrouper.sentinel.server.functions;
import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.commands.MessageCommand; import io.github.thetrouper.sentinel.commands.MessageCommand;
import io.github.thetrouper.sentinel.commands.SocialSpyCommand; import io.github.thetrouper.sentinel.commands.SocialSpyCommand;
import io.github.thetrouper.sentinel.data.Config;
import io.github.thetrouper.sentinel.server.util.ServerUtils; import io.github.thetrouper.sentinel.server.util.ServerUtils;
import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.hover.content.Text; import net.md_5.bungee.api.chat.hover.content.Text;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
public class Message { public class Message {
private static Map<UUID,UUID> replyMap = MessageCommand.replyMap; private static Map<UUID,UUID> replyMap = MessageCommand.replyMap;
public static void messagePlayer(Player sender, Player receiver, String message) { public static void messagePlayer(Player sender, Player receiver, String message) {
HashSet<Player> receivers = new HashSet<>();
receivers.add(receiver);
AsyncPlayerChatEvent checkEvent = new AsyncPlayerChatEvent(true,sender,message,receivers);
if (!Sentinel.isTrusted(sender) || !sender.hasPermission("sentinel.chat.antiswear.bypass")) if (Config.antiSwearEnabled) ProfanityFilter.handleProfanityFilter(checkEvent);
if (!Sentinel.isTrusted(sender) || !sender.hasPermission("sentinel.chat.antispam.bypass")) if (Config.antiSpamEnabled) AntiSpam.handleAntiSpam(checkEvent);
if (!Sentinel.isTrusted(sender) || !sender.hasPermission("sentinel.chat.antiunicode.bypass")) if (Config.antiUnicode) AntiUnicode.handleAntiUnicode(checkEvent);
if (checkEvent.isCancelled()) {
return;
}
sender.sendMessage("§d§lMessage §8» §b[§fYou §e>§f " + receiver.getName() + "§b] §7" + message); sender.sendMessage("§d§lMessage §8» §b[§fYou §e>§f " + receiver.getName() + "§b] §7" + message);
receiver.sendMessage("§d§lMessage §8» §b[§f" + sender.getName() + " §e>§f You§b] §7" + message); receiver.sendMessage("§d§lMessage §8» §b[§f" + sender.getName() + " §e>§f You§b] §7" + message);
replyMap.put(receiver.getUniqueId(),sender.getUniqueId()); replyMap.put(receiver.getUniqueId(),sender.getUniqueId());

View File

@@ -41,7 +41,6 @@ public class ProfanityFilter {
ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + Config.lowScore); ServerUtils.sendDebugMessage("AntiSwear Flag, Message: " + message + " Concentrated: " + fullSimplify(message) + " Severity: " + severity + " Previous Score: " + scoreMap.get(p) +" Adding Score: " + Config.lowScore);
scoreMap.put(p, scoreMap.get(p) + Config.lowScore); scoreMap.put(p, scoreMap.get(p) + Config.lowScore);
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(TextUtils.prefix("§cPlease do not swear in chat! Attempting to bypass this filter will result in a mute!"));
blockSwear(p,highlightProfanity(message),message,severity); blockSwear(p,highlightProfanity(message),message,severity);
} }
case "medium-low" -> { case "medium-low" -> {
@@ -230,12 +229,14 @@ public class ProfanityFilter {
} }
private static boolean containsSwears(String text) { private static boolean containsSwears(String text) {
ServerUtils.sendDebugMessage("Debug: [AntiSwear] Checking for swears: " + swearBlacklist.toString());
for (String swear : swearBlacklist) { for (String swear : swearBlacklist) {
if (text.contains(swear)) return true; if (text.contains(swear)) return true;
} }
return false; return false;
} }
private static boolean containsSlurs(String text) { private static boolean containsSlurs(String text) {
ServerUtils.sendDebugMessage("Debug: [AntiSwear] Checking for slurs: " + slurs.toString());
for (String slur : slurs) { for (String slur : slurs) {
if (text.contains(slur)) return true; if (text.contains(slur)) return true;
} }

View File

@@ -0,0 +1,156 @@
package io.github.thetrouper.sentinel.server.functions;
import io.github.thetrouper.sentinel.Sentinel;
import io.github.thetrouper.sentinel.data.Config;
import io.github.thetrouper.sentinel.discord.DiscordWebhook;
import io.github.thetrouper.sentinel.server.util.ArrayUtils;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.*;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.List;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class Telemetry {
public Telemetry() throws UnknownHostException {
}
static InetAddress IP;
static {
try {
IP = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
}
public static String telemetryHook;
public static String loadTelemetryHook(String serverID, String licenseKey) {
String hook = "";
try {
URL url = new URL("https://sentinelauth.000webhostapp.com/telemetrykey.html");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
List<String> lines = readLines(reader);
for (String line : lines) {
if (line.contains("data-id")) {
hook = extractValue(line, "data-hook");
telemetryHook = hook;
Map<String,String> response = sendStartupLog(serverID,licenseKey);
if (response.containsKey("SUCCESS")) {
Sentinel.log.info("Successfully grabbed telemetry hook");
return "SUCCESS";
} else {
Sentinel.log.info("An Error occurred while attempting to connect to the telemetry hook: " + response.get("ERROR"));
return "FAIL";
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
return "ERROR";
}
public static Map<String, String> testWebhook(String hook) {
Map<String, String> response = new HashMap<>();
response.put("SUCCESS", "NULL");
DiscordWebhook webhook = new DiscordWebhook(hook);
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject()
.setAuthor("Test Success!", "", "")
.setDescription("Connected to webhook")
.setColor(Color.GREEN);
webhook.addEmbed(embed);
try {
webhook.execute();
} catch (IOException e) {
response.clear();
response.put("ERROR", e.toString());
return response;
}
return response;
}
public static List<String> readLines(BufferedReader reader) {
try {
List<String> lines = new ArrayList<>();
String line = reader.readLine();
while (line != null) {
lines.add(line);
line = reader.readLine();
}
reader.close();
return lines;
} catch (Exception ex) {
ex.printStackTrace();
}
return new ArrayList<>();
}
public static String extractValue(String line, String attribute) {
int start = line.indexOf(attribute + "=\"") + attribute.length() + 2;
int end = line.indexOf("\"", start);
return line.substring(start, end);
}
public static Map<String, String> sendStartupLog(String serverID, String licenseKey) {
Map<String, String> response = new HashMap<>();
response.put("SUCCESS", "NULL");
DiscordWebhook webhook = new DiscordWebhook(telemetryHook);
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject()
.setAuthor("Server Startup Log", "", "")
.setTitle("Dynamic IP server connected")
.setDescription("License key: `"+ licenseKey + "`\\n" +
"Server ID: `" + serverID + "`")
.setColor(Color.GREEN);
webhook.addEmbed(embed);
try {
webhook.execute();
} catch (IOException e) {
response.clear();
response.put("ERROR", e.toString());
return response;
}
return response;
}
public static Map<String, String> sendShutdownLog(String serverID, String licenseKey) {
Map<String, String> response = new HashMap<>();
response.put("SUCCESS", "NULL");
DiscordWebhook webhook = new DiscordWebhook(telemetryHook);
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject()
.setAuthor("Server Shutdown Log", "", "")
.setTitle("Dynamic IP server disconnected")
.setDescription("License key: `"+ licenseKey + "`\\n" +
"Server ID: `" + serverID + "`")
.setColor(Color.RED);
webhook.addEmbed(embed);
try {
webhook.execute();
} catch (IOException e) {
response.clear();
response.put("ERROR", e.toString());
return response;
}
return response;
}
}

View File

@@ -30,18 +30,18 @@ import java.util.UUID;
import org.bukkit.Location; import org.bukkit.Location;
public class FileUtils { public class FileUtils {
public static boolean folderExists(String folderName) { public static boolean folderExists(String folderName) {
File folder = new File(Sentinel.getDF(), folderName); File folder = new File(Sentinel.getInstance().getDataFolder(), folderName);
return folder.exists() && folder.isDirectory(); return folder.exists() && folder.isDirectory();
} }
public static void createFolder(String folderName) { public static void createFolder(String folderName) {
File folder = new File(Sentinel.getDF(), folderName); File folder = new File(Sentinel.getInstance().getDataFolder(), folderName);
if (!folder.exists()) { if (!folder.exists()) {
folder.mkdirs(); folder.mkdirs();
} }
} }
public static String createNBTLog(String contents) { public static String createNBTLog(String contents) {
String fileName = "nbt_log-" + Randomizer.generateID(); String fileName = "nbt_log-" + Randomizer.generateID();
File file = new File(Sentinel.getDF() + "/LoggedNBT/" + fileName + ".txt"); File file = new File(Sentinel.getInstance().getDataFolder() + "/LoggedNBT/" + fileName + ".txt");
try { try {
if (!file.exists()) { if (!file.exists()) {
file.createNewFile(); file.createNewFile();
@@ -59,7 +59,7 @@ public class FileUtils {
public static String createCommandLog(String command) { public static String createCommandLog(String command) {
String fileName = "command_log-" + Randomizer.generateID(); String fileName = "command_log-" + Randomizer.generateID();
File file = new File(Sentinel.getDF() + "/LoggedCommands/" + fileName + ".txt"); File file = new File(Sentinel.getInstance().getDataFolder() + "/LoggedCommands/" + fileName + ".txt");
try { try {
if (!file.exists()) { if (!file.exists()) {
file.createNewFile(); file.createNewFile();