More options for ModSyncing and Screen to display missmatching mods

This commit is contained in:
Frank 2021-08-25 15:10:51 +02:00
parent b959e17c18
commit 4692831007
9 changed files with 206 additions and 111 deletions

View file

@ -0,0 +1,41 @@
package ru.bclib.config;
import ru.bclib.BCLib;
import ru.bclib.api.dataexchange.handler.autosync.AutoSync;
public class ClientConfig extends NamedPathConfig {
public static final ConfigToken<Boolean> ENABLED = ConfigToken.Boolean(true, "enabled", AutoSync.SYNC_CATEGORY);
@ConfigUI(leftPadding = 8)
public static final DependendConfigToken<Boolean> ACCEPT_CONFIGS = DependendConfigToken.Boolean(true, "acceptConfigs", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
@ConfigUI(leftPadding = 8)
public static final DependendConfigToken<Boolean> ACCEPT_FILES = DependendConfigToken.Boolean(true, "acceptFiles", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
@ConfigUI(leftPadding = 8)
public static final DependendConfigToken<Boolean> ACCEPT_MODS = DependendConfigToken.Boolean(false, "acceptMods", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
@ConfigUI(topPadding = 12)
public static final ConfigToken<Boolean> DEBUG_HASHES = ConfigToken.Boolean(false, "debugHashes", AutoSync.SYNC_CATEGORY);
public ClientConfig() {
super(BCLib.MOD_ID, "client", false);
}
public boolean shouldPrintDebugHashes() {
return get(DEBUG_HASHES);
}
public boolean isAllowingAutoSync() {
return get(ENABLED);
}
public boolean isAcceptingMods() {
return get(ACCEPT_MODS) /*&& isAllowingAutoSync()*/;
}
public boolean isAcceptingConfigs() {
return get(ACCEPT_CONFIGS) /*&& isAllowingAutoSync()*/;
}
public boolean isAcceptingFiles() {
return get(ACCEPT_FILES) /*&& isAllowingAutoSync()*/;
}
}

View file

@ -3,8 +3,6 @@ package ru.bclib.config;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import ru.bclib.BCLib;
import ru.bclib.api.dataexchange.handler.autosync.AutoSync.ClientConfig;
import ru.bclib.api.dataexchange.handler.autosync.AutoSync.ServerConfig;
public class Configs {
// Client and Server-Config must be the first entries. They are not part of the Auto-Sync process

View file

@ -0,0 +1,52 @@
package ru.bclib.config;
import ru.bclib.BCLib;
import ru.bclib.api.dataexchange.handler.autosync.AutoSync;
import java.util.ArrayList;
import java.util.List;
public class ServerConfig extends NamedPathConfig {
public static final ConfigToken<Boolean> ENABLED = ConfigToken.Boolean(true, "enabled", AutoSync.SYNC_CATEGORY);
public static final DependendConfigToken<Boolean> OFFER_CONFIGS = DependendConfigToken.Boolean(true, "offerConfigs", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
public static final DependendConfigToken<Boolean> OFFER_FILES = DependendConfigToken.Boolean(true, "offerFiles", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
public static final DependendConfigToken<Boolean> OFFER_MODS = DependendConfigToken.Boolean(true, "offerMods", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
public static final DependendConfigToken<Boolean> OFFER_ALL_MODS = DependendConfigToken.Boolean(false, "offerAllMods", AutoSync.SYNC_CATEGORY, (config) -> config.get(OFFER_MODS));
public static final DependendConfigToken<Boolean> SEND_ALL_MOD_INFO = DependendConfigToken.Boolean(true, "sendAllModInfo", AutoSync.SYNC_CATEGORY, (config) -> config.get(ENABLED));
public static final ConfigToken<List<String>> ADDITIONAL_MODS = ConfigToken.StringArray(new ArrayList<>(0), "additionalMods", AutoSync.SYNC_CATEGORY);
public ServerConfig() {
super(BCLib.MOD_ID, "server", false);
}
public boolean isAllowingAutoSync() {
return get(ENABLED);
}
public boolean isOfferingConfigs() {
return get(OFFER_CONFIGS) /*&& isAllowingAutoSync()*/;
}
public boolean isOfferingFiles() {
return get(OFFER_FILES) /*&& isAllowingAutoSync()*/;
}
public boolean isOfferingMods() {
return get(OFFER_MODS) /*&& isAllowingAutoSync()*/;
}
public boolean isOfferingAllMods() {
return get(OFFER_ALL_MODS) /*&& isAllowingAutoSync()*/;
}
public boolean isOfferingInfosForMods() {
return get(SEND_ALL_MOD_INFO) /*&& isAllowingAutoSync()*/;
}
public String[] additionalModsForSync() {
return new String[0];
}
}