2020public class DiskHUDLogger extends AbstractHUDLogger {
2121
2222 public static final DiskHUDLogger INSTANCE ;
23+ private static final long TO_GB = 1024 *1024 *1024 ;
2324
2425 static {
2526 try {
@@ -35,8 +36,6 @@ protected DiskHUDLogger(Field acceleratorField, String logName, String def, Stri
3536
3637 @ Override
3738 public void updateHUD (MinecraftServer server ) {
38- long toGB = 1024 *1024 *1024 ;
39-
4039 if (LoggerRegister .__disk ) {
4140 //#if MC >= 11900
4241 //$$ List<Text> list = new ArrayList<>();
@@ -47,18 +46,18 @@ public void updateHUD(MinecraftServer server) {
4746 //#if MC >= 11900
4847 //$$ for (File f : File.listRoots()) {
4948 //$$ if (f.getPath().equals("/")) {
50- //$$ list.add(Text.of(Messenger.c("g %s %sGB/%sGB".formatted("RootFileSystem", (f.getTotalSpace() - f.getFreeSpace()) / toGB , f.getTotalSpace() / toGB ))));
49+ //$$ list.add(Text.of(Messenger.c("g %s %sGB/%sGB".formatted("RootFileSystem", (f.getTotalSpace() - f.getFreeSpace()) / TO_GB , f.getTotalSpace() / TO_GB ))));
5150 //$$ } else {
52- //$$ list.add(Text.of(Messenger.c("g %s %sGB/%sGB".formatted(f.getPath(), (f.getTotalSpace() - f.getFreeSpace()) / toGB , f.getTotalSpace() / toGB ))));
51+ //$$ list.add(Text.of(Messenger.c("g %s %sGB/%sGB".formatted(f.getPath(), (f.getTotalSpace() - f.getFreeSpace()) / TO_GB , f.getTotalSpace() / TO_GB ))));
5352 //$$ }
5453 //$$ }
5554 //$$ LoggerRegistry.getLogger("disk").log(() -> list.toArray(new Text[0]));
5655 //#else
5756 for (File f : File .listRoots ()) {
5857 if (f .getPath ().equals ("/" )) {
59- list .add (new LiteralText ("%s %sGB/%sGB" .formatted ("RootFileSystem" , (f .getTotalSpace () - f .getFreeSpace ()) / toGB , f .getTotalSpace () / toGB )));
58+ list .add (new LiteralText ("%s %sGB/%sGB" .formatted ("RootFileSystem" , (f .getTotalSpace () - f .getFreeSpace ()) / TO_GB , f .getTotalSpace () / TO_GB )));
6059 } else {
61- list .add (new LiteralText ("%s %sGB/%sGB" .formatted (f .getPath (), (f .getTotalSpace () - f .getFreeSpace ()) / toGB , f .getTotalSpace () / toGB )));
60+ list .add (new LiteralText ("%s %sGB/%sGB" .formatted (f .getPath (), (f .getTotalSpace () - f .getFreeSpace ()) / TO_GB , f .getTotalSpace () / TO_GB )));
6261 }
6362 }
6463 LoggerRegistry .getLogger ("disk" ).log (() -> list .toArray (new BaseText [0 ]));
0 commit comments