mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-19 05:31:32 +01:00
Fixed getResource not working post-reload, thanks to feildmaster
By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
75f99315f7
commit
67a69090f5
1 changed files with 11 additions and 2 deletions
|
@ -9,6 +9,8 @@ import com.avaje.ebeaninternal.server.ddl.DdlGenerator;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -148,8 +150,15 @@ public abstract class JavaPlugin implements Plugin {
|
||||||
if (filename == null) {
|
if (filename == null) {
|
||||||
throw new IllegalArgumentException("Filename cannot be 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue