From dd088c5ee430b0b9276062d81f48badd2af03da4 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 29 May 2022 15:48:38 -0400 Subject: [PATCH] Add note regarding resources [ci skip] --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 4bc912995..501371b58 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,10 @@ jagex's rules](https://secure.runescape.com/m=news/another-message-about-unoffic __If it is difficult for us to ensure the plugin isn't against the rules we will not merge it__. +## Plugin resources +Resources may be included with plugins, which are non-code and are bundled and distributed with the plugin, such as images and sounds. You may do this by placing them in `src/main/resources`. Plugins on the pluginhub are distributed in .jar form and the jars placed into the classpath. The plugin is not unpacked on disk, and you can not assume that it is. This means that using https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getResource-java.lang.String- will return a jar-URL when the plugin is deployed to the pluginhub, but in your IDE will be a file-URL. This almost certainly makes it behave differently from how you expect it to, and isn't what you want. +Instead, prefer using https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getResourceAsStream-java.lang.String-. + ## Third party dependencies We require any dependencies that are not a transitive dependency of runelite-client to be have their cryptographic hash verified during the build to prevent [supply chain attacks](https://en.wikipedia.org/wiki/Supply_chain_attack) and ensure build reproducability.