mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
write correctly group on the api
This commit is contained in:
parent
007f6be7f1
commit
c9d95b69af
1 changed files with 15 additions and 2 deletions
|
|
@ -105,7 +105,9 @@ public class MaterialGroupApi {
|
|||
if (group instanceof IncludeGroup includeGroup) {
|
||||
changed = writeKnownGroup("include", includeGroup);
|
||||
} else if (group instanceof ExcludeGroup excludeGroup) {
|
||||
changed = writeKnownGroup("exclude", excludeGroup);
|
||||
throw new UnsupportedOperationException("exclude group is temporarily disable for the time being. sorry");
|
||||
// This code do not do what is intended ? idk why do it exist
|
||||
//changed = writeKnownGroup("exclude", excludeGroup);
|
||||
} else {
|
||||
changed = writeUnknownGroup(group);
|
||||
}
|
||||
|
|
@ -124,13 +126,24 @@ public class MaterialGroupApi {
|
|||
Set<Material> materialSet = group.getNonGroupInheritedMaterials();
|
||||
Set<AbstractMaterialGroup> groupSet = group.getGroups();
|
||||
|
||||
boolean empty = true;
|
||||
if (!materialSet.isEmpty()) {
|
||||
config.set(basePath + ItemGroupManager.MATERIAL_LIST_PATH, materialSetToStringList(materialSet));
|
||||
empty = false;
|
||||
} else {
|
||||
config.set(basePath + ItemGroupManager.MATERIAL_LIST_PATH, null);
|
||||
}
|
||||
if (!groupSet.isEmpty()) {
|
||||
config.set(basePath + ItemGroupManager.GROUP_LIST_PATH, materialGroupSetToStringList(groupSet));
|
||||
empty = false;
|
||||
} else {
|
||||
config.set(basePath + ItemGroupManager.GROUP_LIST_PATH, null);
|
||||
}
|
||||
|
||||
if (empty) {
|
||||
config.set(basePath + ItemGroupManager.GROUP_TYPE_PATH, null);
|
||||
return false;
|
||||
}
|
||||
if (!config.isConfigurationSection(group.getName())) return false;
|
||||
|
||||
config.set(basePath + ItemGroupManager.GROUP_TYPE_PATH, groupType);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue