Skip to content

Commit

Permalink
Add EnumClasses as LoadableSalvables
Browse files Browse the repository at this point in the history
  • Loading branch information
EverNife committed Nov 12, 2024
1 parent c4ede1e commit 256fdf3
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ public static <O> SmartLoadSave<O> addLoadableSalvable(Class<O> clazz){
smartLoadSave.setOnConfigLoad(onConfigLoadOptional.get());
shouldRegister = true;
}

if (shouldRegister == false){
if (clazz.isEnum()){
smartLoadSave.setOnConfigSave((configSection, o) -> configSection.setValue(o.toString()));
smartLoadSave.setOnConfigLoad(configSection -> (O) Enum.valueOf((Class<Enum>) clazz, configSection.getString("")));
shouldRegister = true;
}
}
}


Expand Down

0 comments on commit 256fdf3

Please sign in to comment.