Add config to exclude mods from syncing/info

This commit is contained in:
Frank 2021-11-06 20:58:41 +01:00
parent 8233174487
commit 2cbfbe8047
3 changed files with 9 additions and 5 deletions

View file

@ -135,7 +135,7 @@ public class AutoSync {
}
private static boolean didRegisterAdditionalMods = false;
//we call this from HelloClient on the Srver to prepare transfer
//we call this from HelloClient on the Server to prepare transfer
protected static void loadSyncFolder() {
if (Configs.SERVER_CONFIG.isOfferingFiles()) {
syncFolderDescriptions.forEach(desc -> desc.loadCache());

View file

@ -16,6 +16,7 @@ import ru.bclib.api.dataexchange.DataHandlerDescriptor;
import ru.bclib.api.dataexchange.handler.autosync.AutoSyncID.WithContentOverride;
import ru.bclib.api.dataexchange.handler.autosync.SyncFolderDescriptor.SubFile;
import ru.bclib.config.Configs;
import ru.bclib.config.ServerConfig;
import ru.bclib.gui.screens.ModListScreen;
import ru.bclib.gui.screens.ProgressScreen;
import ru.bclib.gui.screens.SyncFilesScreen;
@ -92,6 +93,11 @@ public class HelloClient extends DataHandler.FromServer {
);
}
mods = mods
.stream()
.filter(entry -> !Configs.SERVER_CONFIG.get(ServerConfig.EXCLUDED_MODS).contains(entry))
.collect(Collectors.toList());
//write Plugin Versions
buf.writeInt(mods.size());
for (String modID : mods) {

View file

@ -16,6 +16,7 @@ public class ServerConfig extends NamedPathConfig {
public static final ConfigToken<List<String>> ADDITIONAL_MODS = ConfigToken.StringArray(new ArrayList<>(0), "additionalMods", AutoSync.SYNC_CATEGORY);
public static final ConfigToken<List<String>> EXCLUDED_MODS = ConfigToken.StringArray(new ArrayList<>(0), "excludeMods", AutoSync.SYNC_CATEGORY);
public ServerConfig() {
@ -46,7 +47,4 @@ public class ServerConfig extends NamedPathConfig {
return get(SEND_ALL_MOD_INFO) /*&& isAllowingAutoSync()*/;
}
public String[] additionalModsForSync() {
return new String[0];
}
}