@@ -45,7 +45,7 @@ public PluginData(String modId, String resourcePath, IOreSpawnPlugin plugin) {
4545 }
4646 }
4747
48- private List <PluginData > dataStore = new ArrayList <>();
48+ private static List <PluginData > dataStore = new ArrayList <>();
4949
5050 private String getAnnotationItem (String item , final ASMData asmData ) {
5151 if (asmData .getAnnotationInfo ().get (item ) != null ) {
@@ -60,16 +60,13 @@ public void load(FMLPreInitializationEvent event) {
6060 final String modId = getAnnotationItem ("modid" , asmDataItem );
6161 final String resourceBase = getAnnotationItem ("resourcePath" , asmDataItem );
6262 final String clazz = asmDataItem .getClassName ();
63-
64- if ( event .getModMetadata ().modId .equals (modId ) ) {
65- IOreSpawnPlugin integration ;
66- try {
67- integration = Class .forName (clazz ).asSubclass (IOreSpawnPlugin .class ).newInstance ();
68- PluginData pd = new PluginData ( modId , resourceBase , integration );
69- dataStore .add (pd );
70- } catch (final Exception ex ) {
71- OreSpawn .LOGGER .error ("Couldn't load integrations for " + modId , ex );
72- }
63+ IOreSpawnPlugin integration ;
64+ try {
65+ integration = Class .forName (clazz ).asSubclass (IOreSpawnPlugin .class ).newInstance ();
66+ PluginData pd = new PluginData ( modId , resourceBase , integration );
67+ dataStore .add (pd );
68+ } catch (final Exception ex ) {
69+ OreSpawn .LOGGER .error ("Couldn't load integrations for " + modId , ex );
7370 }
7471 }
7572 }
@@ -81,11 +78,7 @@ public void register() {
8178 public void scanResources (PluginData pd ) {
8279 String base = String .format ("assets/%s/%s" , pd .modId , pd .resourcePath );
8380 URL resURL = getClass ().getClassLoader ().getResource (base );
84- if ( resURL == null ) {
85- // nothing to load!
86- return ;
87- }
88-
81+
8982 URI uri ;
9083 try {
9184 uri = resURL .toURI ();
@@ -106,14 +99,11 @@ public void scanResources(PluginData pd) {
10699 myPath = Paths .get (uri );
107100 }
108101
109- if ( !myPath .toFile ().exists () ) {
110- return ;
111- }
112-
113102 Stream <Path > walk = Files .walk (myPath , 1 );
114103 for (Iterator <Path > it = walk .iterator (); it .hasNext ();){
115104 Path p = it .next ();
116105 String name = p .getFileName ().toString ();
106+
117107 if ( "json" .equals (FilenameUtils .getExtension (name )) ) {
118108 InputStream reader = null ;
119109 Path target = Paths .get ("." ,"orespawn" ,"os3" ,String .format ("%s.json" , pd .modId ));
@@ -123,6 +113,7 @@ public void scanResources(PluginData pd) {
123113 walk .close ();
124114 return ;
125115 }
116+
126117 reader = Files .newInputStream (p );
127118 FileUtils .copyInputStreamToFile (reader , target .toFile ());
128119 IOUtils .closeQuietly (reader );
0 commit comments