Pass closable around instead of closing it straight away.

- Ensures ServerUtils can reload itself :)
This commit is contained in:
Frank van der Heijden 2020-06-27 11:38:34 +02:00
parent 75545ac156
commit c2049503a7
No known key found for this signature in database
GPG key ID: 26DA56488D314D11
5 changed files with 92 additions and 29 deletions

View file

@ -130,7 +130,11 @@ public class ServerUtils extends JavaPlugin implements CommandExecutor {
return commandManager;
}
private File[] getJars() {
/**
* Retrieves all files with a jar extension in the plugins/ folder.
* @return An array of jar files.
*/
public File[] getJars() {
File parent = getDataFolder().getParentFile();
if (parent == null) return new File[0];
return parent.listFiles(f -> f.getName().endsWith(".jar"));