Updated Lib's Premium to remove one import and close the UrlClassLoader
This commit is contained in:
parent
8d389c2a29
commit
819487743c
@ -37,7 +37,7 @@ public class LibsDisguises extends JavaPlugin {
|
|||||||
saveResource("disguises.yml", false);
|
saveResource("disguises.yml", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
LibsPremium.check(instance);
|
LibsPremium.check(getDescription().getVersion());
|
||||||
|
|
||||||
PacketsManager.init(this);
|
PacketsManager.init(this);
|
||||||
DisguiseUtilities.init(this);
|
DisguiseUtilities.init(this);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.utilities;
|
package me.libraryaddict.disguise.utilities;
|
||||||
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -35,10 +33,10 @@ public class LibsPremium {
|
|||||||
return thisPluginIsPaidFor == null ? !"%%__USER__%%".contains("__USER__") : thisPluginIsPaidFor;
|
return thisPluginIsPaidFor == null ? !"%%__USER__%%".contains("__USER__") : thisPluginIsPaidFor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void check(LibsDisguises disguises) {
|
public static void check(String version) {
|
||||||
thisPluginIsPaidFor = isPremium();
|
thisPluginIsPaidFor = isPremium();
|
||||||
|
|
||||||
if (!isPremium() && disguises.getDescription().getVersion().contains("SNAPSHOT")) {
|
if (!isPremium() && version.contains("SNAPSHOT")) {
|
||||||
File[] files = new File("plugins/LibsDisguises/").listFiles();
|
File[] files = new File("plugins/LibsDisguises/").listFiles();
|
||||||
|
|
||||||
if (files == null)
|
if (files == null)
|
||||||
@ -51,8 +49,7 @@ public class LibsPremium {
|
|||||||
if (!file.getName().endsWith(".jar"))
|
if (!file.getName().endsWith(".jar"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
try {
|
try (URLClassLoader cl = new URLClassLoader(new URL[]{file.toURI().toURL()})) {
|
||||||
ClassLoader cl = new URLClassLoader(new URL[]{file.toURI().toURL()});
|
|
||||||
Class c = cl.loadClass(LibsPremium.class.getName());
|
Class c = cl.loadClass(LibsPremium.class.getName());
|
||||||
|
|
||||||
Method m = c.getMethod("isPremium");
|
Method m = c.getMethod("isPremium");
|
||||||
|
Loading…
Reference in New Issue
Block a user