1919import com .asdflj .nech .integration .nei .LuaToggleButton ;
2020import com .asdflj .nech .proxy .ClientProxy ;
2121
22+ import codechicken .nei .NEIClientConfig ;
2223import codechicken .nei .api .API ;
24+ import codechicken .nei .config .OptionList ;
2325import cpw .mods .fml .relauncher .FMLInjectionData ;
2426
2527public class LuaPlugin {
@@ -60,7 +62,10 @@ public static List<LuaObject> readLuaFiles(String directoryPath) {
6062 public static void loadLuaScript () {
6163 for (LuaObject luaObject : list ) {
6264 if (luaObject .getBtn () != null ) {
63- getOptionList ().optionList .remove (luaObject .getBtn ());
65+ OptionList optionList = getOptionList ("lua_scripts" , NEIClientConfig .getOptionList ());
66+ if (optionList != null ) {
67+ optionList .optionList .remove (luaObject .getBtn ());
68+ }
6469 }
6570 }
6671 list .clear ();
@@ -70,6 +75,25 @@ public static void loadLuaScript() {
7075 }
7176 }
7277
78+ public static OptionList getOptionList (String name , OptionList optionList ) {
79+ if (optionList == null ) {
80+ return null ;
81+ }
82+ for (var o : optionList .optionList ) {
83+ if (o instanceof OptionList l ) {
84+ if (l .name .equals (name )) {
85+ return l ;
86+ } else {
87+ OptionList result = getOptionList (name , l );
88+ if (result != null ) {
89+ return result ;
90+ }
91+ }
92+ }
93+ }
94+ return null ;
95+ }
96+
7397 public static void reloadLuaScript () {
7498 loadLuaScript ();
7599 Match .refresh ();
0 commit comments