mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-21 17:56:16 +01:00
Reoptimize the recycle cleaners
This commit is contained in:
parent
903b8a98d3
commit
d1cb53e0f5
@ -195,8 +195,8 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
if (recycle.isDirectory()) {
|
||||
int kept = 0;
|
||||
for (File file : recycle.listFiles()) {
|
||||
try {
|
||||
if (file.isDirectory()) {
|
||||
if (file.isDirectory()) {
|
||||
try {
|
||||
if (new File(recycle, file.getName() + "/info.json").exists()) {
|
||||
FileReader reader = new FileReader(new File(recycle, file.getName() + "/info.json"));
|
||||
YAMLSection info = new YAMLSection(new Gson().fromJson(Util.readAll(reader), Map.class));
|
||||
@ -208,16 +208,14 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
Directories.delete(file);
|
||||
} else {
|
||||
Files.delete(file.toPath());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Logger.get("SubServers").info("Removed ./SubServers/Recently Deleted/" + file.getName());
|
||||
} catch (Exception e) {
|
||||
Logger.get("SubServers").warning("Problem scanning ./SubServers/Recently Deleted/" + file.getName());
|
||||
e.printStackTrace();
|
||||
Directories.delete(file);
|
||||
} else {
|
||||
Files.delete(file.toPath());
|
||||
}
|
||||
Logger.get("SubServers").info("Removed ./SubServers/Recently Deleted/" + file.getName());
|
||||
}
|
||||
if (kept == 0) {
|
||||
Files.delete(recycle.toPath());
|
||||
|
@ -136,8 +136,8 @@ public final class ExHost {
|
||||
if (recycle.isDirectory()) {
|
||||
int kept = 0;
|
||||
for (File file : recycle.listFiles()) {
|
||||
try {
|
||||
if (file.isDirectory()) {
|
||||
if (file.isDirectory()) {
|
||||
try {
|
||||
if (new File(recycle, file.getName() + "/info.json").exists()) {
|
||||
FileReader reader = new FileReader(new File(recycle, file.getName() + "/info.json"));
|
||||
JSONObject info = new JSONObject(Util.readAll(reader));
|
||||
@ -149,16 +149,14 @@ public final class ExHost {
|
||||
}
|
||||
}
|
||||
}
|
||||
Directories.delete(file);
|
||||
} else {
|
||||
Files.delete(file.toPath());
|
||||
} catch (Exception e) {
|
||||
log.error.println(e);
|
||||
}
|
||||
log.info.println("Removed ./SubServers/Recently Deleted/" + file.getName());
|
||||
} catch (Exception e) {
|
||||
log.error.println("Problem scanning ./SubServers/Recently Deleted/" + file.getName());
|
||||
log.error.println(e);
|
||||
Directories.delete(file);
|
||||
} else {
|
||||
Files.delete(file.toPath());
|
||||
}
|
||||
log.info.println("Removed ./Recently Deleted/" + file.getName());
|
||||
}
|
||||
if (kept == 0) {
|
||||
Files.delete(recycle.toPath());
|
||||
|
Loading…
Reference in New Issue
Block a user