Skip to content

Commit 4b6e6ac

Browse files
committed
new: print a warning to log when a user joins a world while another is still saving
also added ixeris to the mods that automatically disable allow multiple servers closes #69
1 parent eae9f97 commit 4b6e6ac

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
1010
import me.shedaniel.clothconfig2.gui.entries.SelectionListEntry;
1111
import net.fabricmc.loader.api.FabricLoader;
12+
import net.fabricmc.loader.api.ModContainer;
13+
import net.fabricmc.loader.api.metadata.ModMetadata;
1214
import net.minecraft.client.gui.screen.Screen;
1315
import net.minecraft.server.integrated.IntegratedServer;
1416
import net.minecraft.util.Formatting;
1517
import org.jetbrains.annotations.NotNull;
1618

17-
import java.util.HashSet;
18-
import java.util.Set;
19+
import java.util.List;
20+
import java.util.Optional;
21+
import java.util.stream.Stream;
1922

2023
@Config(name = "fastquit")
2124
public class FastQuitConfig implements ConfigData {
@@ -59,20 +62,16 @@ public class FastQuitConfig implements ConfigData {
5962
private boolean allowMultipleServers = true;
6063

6164
/**
62-
* This {@link Set} holds the names of all currently active mods that conflict with {@link FastQuitConfig#allowMultipleServers}.
65+
* This {@link List} holds the names of all currently active mods that conflict with {@link FastQuitConfig#allowMultipleServers}.
6366
* @see FastQuitConfig#allowMultipleServers()
6467
*/
6568
@ConfigEntry.Gui.Excluded
66-
private static final Set<String> MODS_THAT_CONFLICT_WITH_MULTIPLE_SERVERS = new HashSet<>();
67-
68-
static {
69-
// Put all conflicting Mod ID's in this set
70-
Set<String> incompatibleModIDs = Set.of("quilt_biome", "fastback");
71-
72-
for (String modID : incompatibleModIDs) {
73-
FabricLoader.getInstance().getModContainer(modID).ifPresent(modContainer -> MODS_THAT_CONFLICT_WITH_MULTIPLE_SERVERS.add(modContainer.getMetadata().getName()));
74-
}
75-
}
69+
private static final List<String> MODS_THAT_CONFLICT_WITH_MULTIPLE_SERVERS = Stream.of("quilt_biome", "fastback", "ixeris")
70+
.map(FabricLoader.getInstance()::getModContainer)
71+
.flatMap(Optional::stream)
72+
.map(ModContainer::getMetadata)
73+
.map(ModMetadata::getName)
74+
.toList();
7675

7776
/**
7877
* @return Returns {@code false} when Quilt Biome API is loaded, returns {@link FastQuitConfig#allowMultipleServers} otherwise.
@@ -161,7 +160,7 @@ public Screen createConfigScreen(Screen parent) {
161160
} else {
162161
modCompatCategory.addEntry(entryBuilder.startEnumSelector(TextHelper.translatable("text.autoconfig.fastquit.option.allowMultipleServers"), ModCompat.class, ModCompat.DISABLED)
163162
.setTooltip(TextHelper.translatable("text.autoconfig.fastquit.option.allowMultipleServers.@Tooltip").append("\n\n").append(TextHelper.translatable("fastquit.config.compat.allowMultipleServers.disabledForCompat", String.join(", ", MODS_THAT_CONFLICT_WITH_MULTIPLE_SERVERS))))
164-
.setEnumNameProvider(disabled -> TextHelper.translatable("addServer.resourcePack.disabled").styled(style -> style.withColor(Formatting.RED)))
163+
.setEnumNameProvider(disabled -> TextHelper.translatable("manageServer.resourcePack.disabled").styled(style -> style.withColor(Formatting.RED)))
165164
.build()
166165
);
167166
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ public abstract class LevelStorageMixin {
2828
FastQuit.wait(FastQuit.savingWorlds.keySet());
2929
}
3030
FastQuit.getSavingWorld(this.savesDirectory.resolve(levelName)).ifPresent(FastQuit::wait);
31+
if (!FastQuit.savingWorlds.isEmpty()) {
32+
FastQuit.warn(String.join(" ",
33+
"FastQuit is allowing a world to load while another is currently being saved, which may cause problems with mod compatibility.",
34+
"Try disabling \"Allow multiple running worlds\" in FastQuit settings if you are experiencing issues."
35+
));
36+
}
3137
}
3238

3339
// method_43418 - lambda in loadSummaries

0 commit comments

Comments
 (0)