mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-24 00:26:16 +02:00
Made material group api remove return if success
This commit is contained in:
parent
b0f695e0ed
commit
94677b58ff
1 changed files with 5 additions and 4 deletions
|
|
@ -125,7 +125,7 @@ public class MaterialGroupApi {
|
||||||
config.set(basePath + ItemGroupManager.MATERIAL_LIST_PATH, materialSetToStringList(materialSet));
|
config.set(basePath + ItemGroupManager.MATERIAL_LIST_PATH, materialSetToStringList(materialSet));
|
||||||
}
|
}
|
||||||
if(!groupSet.isEmpty()){
|
if(!groupSet.isEmpty()){
|
||||||
config.set(basePath + ItemGroupManager.GROUP_LIST_PATH, materialGroupSEtToStringList(groupSet));
|
config.set(basePath + ItemGroupManager.GROUP_LIST_PATH, materialGroupSetToStringList(groupSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -147,7 +147,7 @@ public class MaterialGroupApi {
|
||||||
return materials.stream().map(material -> material.getKey().getKey().toLowerCase()).toList();
|
return materials.stream().map(material -> material.getKey().getKey().toLowerCase()).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> materialGroupSEtToStringList(@NotNull Set<AbstractMaterialGroup> groups){
|
public static List<String> materialGroupSetToStringList(@NotNull Set<AbstractMaterialGroup> groups){
|
||||||
return groups.stream().map(AbstractMaterialGroup::getName).toList();
|
return groups.stream().map(AbstractMaterialGroup::getName).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,11 +157,12 @@ public class MaterialGroupApi {
|
||||||
* For that reason, it is not recommended to use this function.
|
* For that reason, it is not recommended to use this function.
|
||||||
*
|
*
|
||||||
* @param group The recipe to remove
|
* @param group The recipe to remove
|
||||||
* @return True if successful.
|
* @return True if the group was present.
|
||||||
*/
|
*/
|
||||||
public static boolean removeGroup(@NotNull AbstractMaterialGroup group){
|
public static boolean removeGroup(@NotNull AbstractMaterialGroup group){
|
||||||
// Remove from registry
|
// Remove from registry
|
||||||
ConfigHolder.ITEM_GROUP_HOLDER.getItemGroupsManager().groupMap.remove(group.getName());
|
AbstractMaterialGroup removed = ConfigHolder.ITEM_GROUP_HOLDER.getItemGroupsManager().groupMap.remove(group.getName());
|
||||||
|
if(removed == null) return false;
|
||||||
|
|
||||||
// Delete and save to file
|
// Delete and save to file
|
||||||
ConfigHolder.ITEM_GROUP_HOLDER.delete(group.getName());
|
ConfigHolder.ITEM_GROUP_HOLDER.delete(group.getName());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue