Skip to content

Commit 13dcc77

Browse files
committed
fix: dont render saving time on widget if worldplaytime is present
closes #70
1 parent 4b6e6ac commit 13dcc77

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/main/java/me/contaria/fastquit/FastQuit.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public final class FastQuit implements ClientModInitializer {
2828
private static final String LOG_PREFIX = "[" + FASTQUIT.getName() + "] ";
2929
public static final FastQuitConfig CONFIG = AutoConfig.register(FastQuitConfig.class, Toml4jConfigSerializer::new).getConfig();
3030

31+
public static final boolean HAS_WORLDPLAYTIME = FabricLoader.getInstance().isModLoaded("worldplaytime");
32+
3133
/**
3234
* Synchronized {@link Map} containing all currently saving {@link IntegratedServer}'s, with a {@link WorldInfo} with more information about the world.
3335
*/

src/main/java/me/contaria/fastquit/mixin/WorldListWidgetWorldEntryMixin.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,15 @@ public abstract class WorldListWidgetWorldEntryMixin extends WorldListWidget.Ent
7878
)
7979
)
8080
private void fastquit$renderSavingTimeOnWorldList(DrawContext context, int mouseX, int mouseY, boolean hovered, float deltaTicks, CallbackInfo ci) {
81-
if (FastQuit.CONFIG.showSavingTime == FastQuitConfig.ShowSavingTime.TRUE) {
82-
FastQuit.getSavingWorld(this.client.getLevelStorage().getSavesDirectory().resolve(this.level.getName())).ifPresent(server -> {
83-
WorldInfo info = FastQuit.savingWorlds.get(server);
84-
if (info != null) {
85-
String time = info.getTimeSaving() + " ⌛";
86-
context.drawText(this.client.textRenderer, time, this.getX() + this.getWidth() - this.client.textRenderer.getWidth(time) - 4, this.getY() + 1, -6939106, false);
87-
}
88-
});
81+
if (FastQuit.CONFIG.showSavingTime != FastQuitConfig.ShowSavingTime.TRUE || FastQuit.HAS_WORLDPLAYTIME) {
82+
return;
8983
}
84+
FastQuit.getSavingWorld(this.client.getLevelStorage().getSavesDirectory().resolve(this.level.getName())).ifPresent(server -> {
85+
WorldInfo info = FastQuit.savingWorlds.get(server);
86+
if (info != null) {
87+
String time = info.getTimeSaving() + " ⌛";
88+
context.drawText(this.client.textRenderer, time, this.getX() + this.getWidth() - this.client.textRenderer.getWidth(time) - 4, this.getY() + 1, -6939106, false);
89+
}
90+
});
9091
}
9192
}

0 commit comments

Comments
 (0)