I am stuck at two parts really. A) I need the program to find the directory of the RUNNING JAR FILE and check if there is a file called "credits.txt" in the same directory. B) If not, it would create the file in the SAME DIRECTORY.
The main issue is not being able to get the path of my file.
Say the running jar file was in a folder called "Server", the program would save the name "Server" in a string and then check if a file exists in that string. If so, do nothing, otherwise create the file.
@Override
public void onEnable(){
getLogger().info(ChatColor.GREEN + "Credits has been enabled!");
File file = new File("Credits.txt");
//HERE I NEED THE PROGRAM TO CHECK WHAT DIRECTORY THE RUNNING JAR FILE IS FROM
if (file.exists(//IN THE SAME DIRECTORY AS THE RUNNING JAR FILE)){
getLogger().info(ChatColor.DARK_GREEN + "Credits File Exists");
}else{
getLogger().info(ChatColor.DARK_RED + "Credits File Doesn't Exist!");
//HERE IT NEEDS TO CREATE THE FILE IN THE SAME DIRECTORY OF THE JAR FILE "credits.txt"
}