Skip to content

Commit e32fdc5

Browse files
committed
remove unused expiration time and rename class
1 parent 60a3f08 commit e32fdc5

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

src/main/java/me/xginko/betterworldstats/stats/WorldStats.java

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class WorldStats implements Runnable, Disableable {
2424

2525
private final ScheduledTask scheduledScan;
2626
private final AtomicInteger chunkCount, entityCount;
27-
private @Nullable FileScanResult fileScanResult;
27+
private @Nullable FileStatResult fileStatResult;
2828

2929
public WorldStats() {
3030
this.chunkCount = new AtomicInteger();
@@ -53,70 +53,68 @@ public void run() {
5353
});
5454
}
5555

56-
fileScanResult = new FileScanResult(BetterWorldStats.config().scanPaths, BetterWorldStats.config().filesizeUpdatePeriodMillis);
56+
fileStatResult = new FileStatResult(BetterWorldStats.config().scanPaths);
5757

5858
if (BetterWorldStats.config().doLogging) {
5959
BetterWorldStats.logger().info(Component.text("Updated file stats asynchronously.", Util.GUPPIE_GREEN));
6060
BetterWorldStats.logger().info(Component.text(
61-
"Size: " + BetterWorldStats.config().filesizeFormat.format(fileScanResult.sizeInGb) + "GB, " +
62-
"files: " + fileScanResult.fileCount + ", " +
63-
"folders: " + fileScanResult.folderCount + ", " +
61+
"Size: " + BetterWorldStats.config().filesizeFormat.format(fileStatResult.sizeInGb) + "GB, " +
62+
"files: " + fileStatResult.fileCount + ", " +
63+
"folders: " + fileStatResult.folderCount + ", " +
6464
"chunks: " + chunkCount + ", " +
6565
"entities: " + entityCount, Util.GUPPIE_GREEN));
6666
}
6767
}
6868

6969
public String getSize() {
70-
if (fileScanResult == null) return "";
70+
if (fileStatResult == null) return "";
7171

72-
return BetterWorldStats.config().filesizeFormat.format(fileScanResult.sizeInGb);
72+
return BetterWorldStats.config().filesizeFormat.format(fileStatResult.sizeInGb);
7373
}
7474

7575
public String getSpoofedSize() {
76-
if (fileScanResult == null) return "";
76+
if (fileStatResult == null) return "";
7777

7878
return BetterWorldStats.config().filesizeFormat
79-
.format(fileScanResult.sizeInGb + BetterWorldStats.config().additionalSpoofFilesize);
79+
.format(fileStatResult.sizeInGb + BetterWorldStats.config().additionalSpoofFilesize);
8080
}
8181

8282
public String getFolderCount() {
83-
if (fileScanResult == null) return "";
83+
if (fileStatResult == null) return "";
8484

85-
return Integer.toString(fileScanResult.folderCount);
85+
return Integer.toString(fileStatResult.folderCount);
8686
}
8787

8888
public String getFileCount() {
89-
if (fileScanResult == null) return "";
89+
if (fileStatResult == null) return "";
9090

91-
return Integer.toString(fileScanResult.fileCount);
91+
return Integer.toString(fileStatResult.fileCount);
9292
}
9393

9494
public String getChunkCount() {
95-
if (fileScanResult == null) return "";
95+
if (fileStatResult == null) return "";
9696

9797
return CAN_GET_CHUNK_COUNT ? chunkCount.toString() : "unsupported";
9898
}
9999

100100
public String getEntityCount() {
101-
if (fileScanResult == null) return "";
101+
if (fileStatResult == null) return "";
102102

103103
return CAN_GET_ENTITY_COUNT ? entityCount.toString() : "unsupported";
104104
}
105105

106-
private static class FileScanResult {
106+
private static class FileStatResult {
107107

108-
public final long expiration_time_millis;
109108
public final double sizeInGb;
110109
public int fileCount, folderCount;
111110

112-
protected FileScanResult(@NotNull Iterable<String> paths_to_scan, long cooldown_millis) {
111+
protected FileStatResult(@NotNull Iterable<String> paths_to_scan) {
113112
this.fileCount = this.folderCount = 0;
114113
long byteSize = 0L;
115114
for (String path : paths_to_scan) {
116115
byteSize += this.getByteSize(new File(path));
117116
}
118117
this.sizeInGb = byteSize / 1048576.0D / 1000.0D;
119-
this.expiration_time_millis = System.currentTimeMillis() + cooldown_millis;
120118
}
121119

122120
private long getByteSize(File file) {

0 commit comments

Comments
 (0)