mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 02:08:27 +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()) {
|
if (recycle.isDirectory()) {
|
||||||
int kept = 0;
|
int kept = 0;
|
||||||
for (File file : recycle.listFiles()) {
|
for (File file : recycle.listFiles()) {
|
||||||
try {
|
if (file.isDirectory()) {
|
||||||
if (file.isDirectory()) {
|
try {
|
||||||
if (new File(recycle, file.getName() + "/info.json").exists()) {
|
if (new File(recycle, file.getName() + "/info.json").exists()) {
|
||||||
FileReader reader = new FileReader(new File(recycle, file.getName() + "/info.json"));
|
FileReader reader = new FileReader(new File(recycle, file.getName() + "/info.json"));
|
||||||
YAMLSection info = new YAMLSection(new Gson().fromJson(Util.readAll(reader), Map.class));
|
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);
|
} catch (Exception e) {
|
||||||
} else {
|
e.printStackTrace();
|
||||||
Files.delete(file.toPath());
|
|
||||||
}
|
}
|
||||||
Logger.get("SubServers").info("Removed ./SubServers/Recently Deleted/" + file.getName());
|
Directories.delete(file);
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
Logger.get("SubServers").warning("Problem scanning ./SubServers/Recently Deleted/" + file.getName());
|
|
||||||
e.printStackTrace();
|
|
||||||
Files.delete(file.toPath());
|
Files.delete(file.toPath());
|
||||||
}
|
}
|
||||||
|
Logger.get("SubServers").info("Removed ./SubServers/Recently Deleted/" + file.getName());
|
||||||
}
|
}
|
||||||
if (kept == 0) {
|
if (kept == 0) {
|
||||||
Files.delete(recycle.toPath());
|
Files.delete(recycle.toPath());
|
||||||
|
@ -136,8 +136,8 @@ public final class ExHost {
|
|||||||
if (recycle.isDirectory()) {
|
if (recycle.isDirectory()) {
|
||||||
int kept = 0;
|
int kept = 0;
|
||||||
for (File file : recycle.listFiles()) {
|
for (File file : recycle.listFiles()) {
|
||||||
try {
|
if (file.isDirectory()) {
|
||||||
if (file.isDirectory()) {
|
try {
|
||||||
if (new File(recycle, file.getName() + "/info.json").exists()) {
|
if (new File(recycle, file.getName() + "/info.json").exists()) {
|
||||||
FileReader reader = new FileReader(new File(recycle, file.getName() + "/info.json"));
|
FileReader reader = new FileReader(new File(recycle, file.getName() + "/info.json"));
|
||||||
JSONObject info = new JSONObject(Util.readAll(reader));
|
JSONObject info = new JSONObject(Util.readAll(reader));
|
||||||
@ -149,16 +149,14 @@ public final class ExHost {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Directories.delete(file);
|
} catch (Exception e) {
|
||||||
} else {
|
log.error.println(e);
|
||||||
Files.delete(file.toPath());
|
|
||||||
}
|
}
|
||||||
log.info.println("Removed ./SubServers/Recently Deleted/" + file.getName());
|
Directories.delete(file);
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
log.error.println("Problem scanning ./SubServers/Recently Deleted/" + file.getName());
|
|
||||||
log.error.println(e);
|
|
||||||
Files.delete(file.toPath());
|
Files.delete(file.toPath());
|
||||||
}
|
}
|
||||||
|
log.info.println("Removed ./Recently Deleted/" + file.getName());
|
||||||
}
|
}
|
||||||
if (kept == 0) {
|
if (kept == 0) {
|
||||||
Files.delete(recycle.toPath());
|
Files.delete(recycle.toPath());
|
||||||
|
Loading…
Reference in New Issue
Block a user