|
9 | 9 | import me.shedaniel.clothconfig2.api.ConfigEntryBuilder; |
10 | 10 | import me.shedaniel.clothconfig2.gui.entries.SelectionListEntry; |
11 | 11 | import net.fabricmc.loader.api.FabricLoader; |
| 12 | +import net.fabricmc.loader.api.ModContainer; |
| 13 | +import net.fabricmc.loader.api.metadata.ModMetadata; |
12 | 14 | import net.minecraft.client.gui.screen.Screen; |
13 | 15 | import net.minecraft.server.integrated.IntegratedServer; |
14 | 16 | import net.minecraft.util.Formatting; |
15 | 17 | import org.jetbrains.annotations.NotNull; |
16 | 18 |
|
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; |
19 | 22 |
|
20 | 23 | @Config(name = "fastquit") |
21 | 24 | public class FastQuitConfig implements ConfigData { |
@@ -59,20 +62,16 @@ public class FastQuitConfig implements ConfigData { |
59 | 62 | private boolean allowMultipleServers = true; |
60 | 63 |
|
61 | 64 | /** |
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}. |
63 | 66 | * @see FastQuitConfig#allowMultipleServers() |
64 | 67 | */ |
65 | 68 | @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(); |
76 | 75 |
|
77 | 76 | /** |
78 | 77 | * @return Returns {@code false} when Quilt Biome API is loaded, returns {@link FastQuitConfig#allowMultipleServers} otherwise. |
@@ -161,7 +160,7 @@ public Screen createConfigScreen(Screen parent) { |
161 | 160 | } else { |
162 | 161 | modCompatCategory.addEntry(entryBuilder.startEnumSelector(TextHelper.translatable("text.autoconfig.fastquit.option.allowMultipleServers"), ModCompat.class, ModCompat.DISABLED) |
163 | 162 | .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))) |
165 | 164 | .build() |
166 | 165 | ); |
167 | 166 | } |
|
0 commit comments