Skip to content

Commit

Permalink
Fix #873
Browse files Browse the repository at this point in the history
Use Bukkit API for plugin Directory
  • Loading branch information
KleinCrafter authored and Brokkonaut committed Sep 29, 2023
1 parent a6b37c0 commit 337a050
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/main/java/de/diddiz/LogBlock/Consumer.java
Expand Up @@ -521,8 +521,9 @@ public void writeToFile() throws FileNotFoundException {
final long time = System.currentTimeMillis();
final Set<Actor> insertedPlayers = new HashSet<>();
int counter = 0;
new File("plugins/LogBlock/import/").mkdirs();
PrintWriter writer = new PrintWriter(new File("plugins/LogBlock/import/queue-" + time + "-0.sql"));
final File importDir = new File(logblock.getDataFolder(), "import");
importDir.mkdirs();
PrintWriter writer = new PrintWriter(new File(importDir, "queue-" + time + "-0.sql"));
while (!isQueueEmpty()) {
final Row r = pollQueueFirst();
if (r == null) {
Expand All @@ -541,7 +542,7 @@ public void writeToFile() throws FileNotFoundException {
counter++;
if (counter % 1000 == 0) {
writer.close();
writer = new PrintWriter(new File("plugins/LogBlock/import/queue-" + time + "-" + counter / 1000 + ".sql"));
writer = new PrintWriter(new File(importDir, "queue-" + time + "-" + counter / 1000 + ".sql"));
}
}
writer.close();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/de/diddiz/LogBlock/WorldEditor.java
Expand Up @@ -182,8 +182,9 @@ public synchronized void run() {
logblock.getServer().getScheduler().cancelTask(taskID);
if (errorList.size() > 0) {
try {
final File file = new File("plugins/LogBlock/error/WorldEditor-" + new SimpleDateFormat("yy-MM-dd-HH-mm-ss").format(System.currentTimeMillis()) + ".log");
file.getParentFile().mkdirs();
final File errorDir = new File(logblock.getDataFolder(), "error");
errorDir.mkdir();
final File file = new File(errorDir, "WorldEditor-" + new SimpleDateFormat("yy-MM-dd-HH-mm-ss").format(System.currentTimeMillis()) + ".log");
final PrintWriter writer = new PrintWriter(file);
for (final WorldEditorException err : errorList) {
writer.println(BaseComponent.toPlainText(err.getLogMessage()));
Expand Down

0 comments on commit 337a050

Please sign in to comment.