fixed for one file

This commit is contained in:
minster586
2025-07-23 19:54:39 -04:00
parent 119e5a792c
commit 9ac8713782

View File

@@ -18,13 +18,12 @@ public class LogWriter {
private final String fileExtension; private final String fileExtension;
public LogWriter(Plugin plugin) { public LogWriter(Plugin plugin) {
// Load config values // Load values from config.yml
String formatString = plugin.getConfig().getString("timestamp-format", "h:mm a | MM-dd-yyyy"); String formatString = plugin.getConfig().getString("timestamp-format", "h:mm a | MM-dd-yyyy");
this.timestampFormatter = new SimpleDateFormat(formatString); this.timestampFormatter = new SimpleDateFormat(formatString);
this.fileExtension = plugin.getConfig().getString("log-extension", "csv").replace(".", ""); this.fileExtension = plugin.getConfig().getString("log-extension", "csv").replace(".", "");
// Create folder structure
createFolder(baseFolder); createFolder(baseFolder);
createFolder(zipFolder); createFolder(zipFolder);
} }
@@ -33,7 +32,7 @@ public class LogWriter {
String folderPath = baseFolder + category + "/"; String folderPath = baseFolder + category + "/";
createFolder(folderPath); createFolder(folderPath);
String fileName = "log_" + getTimeStamp("yyyy-MM-dd_HH-mm-ss") + "." + fileExtension; String fileName = category + "." + fileExtension;
File file = new File(folderPath, fileName); File file = new File(folderPath, fileName);
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file, true))) { try (BufferedWriter writer = new BufferedWriter(new FileWriter(file, true))) {
@@ -72,7 +71,7 @@ public class LogWriter {
} }
}); });
System.out.println("[ServerDevMode] Logs zipped to: " + zipName); System.out.println("[ServerDevMode] Logs zipped to: " + zipFile.getName());
} catch (IOException e) { } catch (IOException e) {
System.err.println("Zip creation failed: " + e.getMessage()); System.err.println("Zip creation failed: " + e.getMessage());
} }