Fixed bug in the module generator config.

This commit is contained in:
Speiger 2022-12-04 08:00:31 +01:00
parent b29874189c
commit f53d61a5bc
4 changed files with 86 additions and 1 deletions

View File

@ -13,6 +13,87 @@
"Base": { "Base": {
"enabled": true "enabled": true
}, },
"Boolean": {
"enabled": true,
"Function": {
"enabled": true
},
"Pair": {
"enabled": true
}
},
"Byte": {
"enabled": true,
"Function": {
"enabled": true
},
"Pair": {
"enabled": true
}
},
"Short": {
"enabled": true,
"Function": {
"enabled": true
},
"Pair": {
"enabled": true
}
},
"Character": {
"enabled": true,
"Function": {
"enabled": true
},
"Pair": {
"enabled": true
}
},
"Integer": {
"enabled": true,
"Function": {
"enabled": true
},
"Pair": {
"enabled": true
}
},
"Long": {
"enabled": true,
"Function": {
"enabled": true
},
"Pair": {
"enabled": true
}
},
"Float": {
"enabled": true,
"Function": {
"enabled": true
},
"Pair": {
"enabled": true
}
},
"Double": {
"enabled": true,
"Function": {
"enabled": true
},
"Pair": {
"enabled": true
}
},
"Object": {
"enabled": true,
"Function": {
"enabled": true
},
"Pair": {
"enabled": true
}
},
"Collection": { "Collection": {
"enabled": true "enabled": true
}, },

View File

@ -54,8 +54,8 @@ public class SettingsManager
data.addProperty(moduleName, true); data.addProperty(moduleName, true);
if(module.isBiModule()) { if(module.isBiModule()) {
for(ClassType keyType : ModulePackage.TYPE) { for(ClassType keyType : ModulePackage.TYPE) {
if(keyType == ClassType.BOOLEAN) continue;
for(ClassType valueType : ModulePackage.TYPE) { for(ClassType valueType : ModulePackage.TYPE) {
if(!module.isModuleValid(keyType, valueType)) continue;
JsonObject obj = new JsonObject(); JsonObject obj = new JsonObject();
obj.addProperty("enabled", true); obj.addProperty("enabled", true);
for(String key : module.getModuleKeys(keyType, valueType)) { for(String key : module.getModuleKeys(keyType, valueType)) {
@ -67,6 +67,7 @@ public class SettingsManager
return; return;
} }
for(ClassType keyType : ModulePackage.TYPE) { for(ClassType keyType : ModulePackage.TYPE) {
if(!module.isModuleValid(keyType, keyType)) continue;
JsonObject obj = new JsonObject(); JsonObject obj = new JsonObject();
obj.addProperty("enabled", true); obj.addProperty("enabled", true);
for(String key : module.getModuleKeys(keyType, keyType)) { for(String key : module.getModuleKeys(keyType, keyType)) {

View File

@ -57,6 +57,7 @@ public abstract class BaseModule
public abstract String getModuleName(); public abstract String getModuleName();
public boolean isBiModule() { return false; } public boolean isBiModule() { return false; }
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) { return Collections.emptySet(); } public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) { return Collections.emptySet(); }
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return true; }
protected boolean isModuleEnabled() { protected boolean isModuleEnabled() {
return manager == null || manager.isModuleEnabled(this, keyType, valueType); return manager == null || manager.isModuleEnabled(this, keyType, valueType);

View File

@ -13,6 +13,8 @@ public class MapModule extends BaseModule
protected void loadVariables() {} protected void loadVariables() {}
@Override @Override
protected void loadFlags() {} protected void loadFlags() {}
@Override
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; }
@Override @Override
protected void loadBlockades() protected void loadBlockades()