diff options
author | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-13 11:11:45 +0000 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-13 11:11:45 +0000 |
commit | 27beb951f09528ea329351654281d03552e9872a (patch) | |
tree | 16a3ce7f6846ad2b81f85d29d3aa02edbb4ce245 /src | |
parent | 58f30039c8affcdf9b9f1fdd439e6ca9a1737d61 (diff) | |
download | bukkit-27beb951f09528ea329351654281d03552e9872a.tar bukkit-27beb951f09528ea329351654281d03552e9872a.tar.gz bukkit-27beb951f09528ea329351654281d03552e9872a.tar.lz bukkit-27beb951f09528ea329351654281d03552e9872a.tar.xz bukkit-27beb951f09528ea329351654281d03552e9872a.zip |
Fixed getResource not working post-reload, thanks to feildmaster
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/plugin/java/JavaPlugin.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java index 53d9a5a9..78769eb6 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java @@ -9,6 +9,8 @@ import com.avaje.ebeaninternal.server.ddl.DdlGenerator; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; @@ -148,8 +150,15 @@ public abstract class JavaPlugin implements Plugin { if (filename == null) { throw new IllegalArgumentException("Filename cannot be null"); } - - return getClassLoader().getResourceAsStream(filename); + + try { + URL url = getClassLoader().getResource(filename); + URLConnection connection = url.openConnection(); + connection.setUseCaches(false); + return connection.getInputStream(); + } catch (IOException ex) { + return null; + } } /** |