File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
src/main/java/net/wurstclient Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 1818import java .util .function .BiConsumer ;
1919
2020import com .google .common .collect .Lists ;
21+ import com .google .gson .JsonParseException ;
2122
2223import net .minecraft .client .Minecraft ;
2324import net .minecraft .client .resources .language .ClientLanguage ;
@@ -187,15 +188,25 @@ private void loadTranslations(ResourceManager manager,
187188 ResourceLocation langId =
188189 ResourceLocation .fromNamespaceAndPath ("wurst" , langFilePath );
189190
191+ // IMPORTANT: Exceptions thrown by Language.loadFromJson() must
192+ // be caught to prevent mod detection vulnerabilities using
193+ // intentionally corrupted resource packs.
190194 for (Resource resource : manager .getResourceStack (langId ))
191195 try (InputStream stream = resource .open ())
192196 {
193197 Language .loadFromJson (stream , entryConsumer );
194198
195- }catch (IOException e )
199+ }catch (IOException | JsonParseException e )
196200 {
197- System .out .println ("Failed to load translations for "
198- + langCode + " from pack " + resource .sourcePackId ());
201+ System .out .println (
202+ "Failed to load Wurst translations for " + langCode );
203+ e .printStackTrace ();
204+
205+ }catch (Exception e )
206+ {
207+ System .out .println (
208+ "Unexpected exception while loading Wurst translations for "
209+ + langCode );
199210 e .printStackTrace ();
200211 }
201212 }
You can’t perform that action at this time.
0 commit comments