Add version logging for premium check
This commit is contained in:
parent
815b6f4c2f
commit
68a53a8760
@ -1,6 +1,10 @@
|
||||
package me.libraryaddict.disguise.utilities;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
@ -36,17 +40,30 @@ public class LibsPremium {
|
||||
|
||||
Method m = c.getMethod("isPremium");
|
||||
thisPluginIsPaidFor = (Boolean) m.invoke(null);
|
||||
String pluginVersion;
|
||||
|
||||
try (InputStream stream = cl.getResourceAsStream("plugin.yml")) {
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
config.loadFromString(IOUtils.toString(stream, "UTF-8"));
|
||||
|
||||
pluginVersion = config.getString("version");
|
||||
}
|
||||
|
||||
if (isPremium()) {
|
||||
DisguiseUtilities.getLogger().info("Found a premium Lib's Disguises jar, premium enabled!");
|
||||
// Found a premium Lib's Disguises jar (v5.2.6), premium enabled!
|
||||
DisguiseUtilities.getLogger()
|
||||
.info("Found a premium Lib's Disguises jar (v" + pluginVersion + "), premium enabled!");
|
||||
|
||||
break;
|
||||
} else {
|
||||
// You have a non-premium Lib's Disguises jar (LibsDisguises.jar v5.2.6) in the folder!
|
||||
DisguiseUtilities.getLogger().warning(
|
||||
"You have a non-premium Lib's Disguises jar (" + file.getName() + ") in the folder!");
|
||||
"You have a non-premium Lib's Disguises jar (" + file.getName() + " v" + pluginVersion +
|
||||
") in the folder!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
// Don't print off errors
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user