package dev.deeve.containeraudit; import org.bukkit.plugin.java.JavaPlugin; import java.util.logging.Logger; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.sql.SQLException; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Plugin extends JavaPlugin { public static Logger logger; public void onEnable() { logger = getLogger(); getDataFolder().mkdirs(); try { Database.connect(new File(getDataFolder(), "database.db").getPath(), logger); List ignores = new ArrayList(); Path okay = Paths.get(getDataFolder().getPath(), "okay.txt"); if (Files.exists(okay)) { ignores = Files.readAllLines(okay); } getServer().getPluginManager().registerEvents(new ChestListener(ignores), this); Database.createTables(); } catch (SQLException | IOException ex) { logger.log(Level.SEVERE, "Database error: (not enabling plugin)"); ex.printStackTrace(); return; } } }