File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/main/java/de/blazemcworld/jsscripts Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -32,15 +32,22 @@ public static void loadScripts() {
3232 if (!scriptDir .exists ()) scriptDir .mkdirs ();
3333
3434 injectMappings ();
35+ loadScriptsIn (scriptDir );
36+ }
3537
36- for (File scriptFile : scriptDir .listFiles ()) {
37- if (!scriptFile .getName ().endsWith (".js" )) {
38+ private static void loadScriptsIn (File dir ) {
39+ for (File file : dir .listFiles ()) {
40+ if (file .isDirectory ()) {
41+ loadScriptsIn (file );
42+ continue ;
43+ }
44+ if (!file .getName ().endsWith (".js" )) {
3845 continue ;
3946 }
4047 try {
41- scripts .add (new Script (scriptFile ));
48+ scripts .add (new Script (file ));
4249 } catch (Exception err ) {
43- JsScripts .LOGGER .error ("Error initializing " + scriptFile );
50+ JsScripts .LOGGER .error ("Error initializing " + file );
4451 err .printStackTrace ();
4552 }
4653 }
You can’t perform that action at this time.
0 commit comments