mirror of
https://github.com/lucko/LuckPerms.git
synced 2025-09-03 03:12:46 +02:00
Properly cleanup JarInJarClassLoader when plugin disables
This commit is contained in:
@@ -33,6 +33,7 @@ import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
/**
|
||||
@@ -64,6 +65,20 @@ public class JarInJarClassLoader extends URLClassLoader {
|
||||
addURL(url);
|
||||
}
|
||||
|
||||
public void deleteJarResource() {
|
||||
URL[] urls = getURLs();
|
||||
if (urls.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Path path = Paths.get(urls[0].toURI());
|
||||
Files.deleteIfExists(path);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new plugin instance.
|
||||
*
|
||||
|
Reference in New Issue
Block a user