Allow plugin to be used as an API on free resource page

This commit is contained in:
libraryaddict 2020-04-14 02:27:34 +12:00
parent 810a8f8e00
commit 6e112ea137
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
3 changed files with 13 additions and 5 deletions

View File

@ -111,7 +111,7 @@ public class LibsDisguises extends JavaPlugin {
registerCommand("libsdisguises", new LibsDisguisesCommand());
if (!DisguiseConfig.isDisableCommands()) {
if (!DisguiseConfig.isDisableCommands() && !LibsPremium.isAPIPlugin()) {
registerCommand("disguise", new DisguiseCommand());
registerCommand("undisguise", new UndisguiseCommand());
registerCommand("disguiseplayer", new DisguisePlayerCommand());
@ -132,7 +132,11 @@ public class LibsDisguises extends JavaPlugin {
registerCommand("grabskin", new GrabSkinCommand());
registerCommand("savedisguise", new SaveDisguiseCommand());
} else {
getLogger().info("Commands has been disabled, as per config");
if (LibsPremium.isAPIPlugin()) {
getLogger().info("Commands not enabled in API version of Lib's Disguises!");
} else {
getLogger().info("Commands has been disabled, as per config");
}
}
new MetricsInitalizer();

View File

@ -64,7 +64,11 @@ public class LibsPremium {
* @return true if userID does not contain __USER__
*/
private static Boolean isPremium(String userID) {
return !userID.contains("__USER__");
return !userID.contains("__USER__") && !getResourceID().equals("81");
}
public static Boolean isAPIPlugin() {
return !isPremium() && getResourceID().equals("81");
}
/**
@ -85,7 +89,7 @@ public class LibsPremium {
return false;
}
if (premiumVersion.startsWith("9.")){
if (premiumVersion.startsWith("9.")) {
return false;
}

View File

@ -20,7 +20,7 @@ public class PluginInformation {
this.userID = userID;
this.resourceID = resourceID;
this.downloadID = downloadID;
this.premium = premium;
this.premium = premium && !"81".equals(resourceID);
this.version = version;
this.buildNumber = buildNumber;
this.buildDate = buildDate;