From aad7001cbd21e7e2baf890a251bf87e824d2b028 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 14 Nov 2019 00:38:58 +1300 Subject: [PATCH] Add small note to config yml & corrected a check --- .../me/libraryaddict/disguise/LibsDisguises.java | 8 +++----- .../disguise/utilities/LibsPremium.java | 8 +++++++- .../utilities/plugin/PluginInformation.java | 13 +++++++++++++ src/main/resources/config.yml | 1 + 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java index d5484152..9b760e16 100644 --- a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java +++ b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java @@ -56,9 +56,8 @@ public class LibsDisguises extends JavaPlugin { LibsPremium.check(getDescription().getVersion(), getFile()); if (!LibsPremium.isPremium()) { - getLogger() - .info("You are running the free version, commands limited to non-players (Console, Command " + - "Blocks)"); + getLogger().info("You are running the free version, commands limited to non-players (Console, Command " + + "Blocks)"); } if (!ReflectionManager.getMinecraftVersion().startsWith("1.14.4")) { @@ -242,8 +241,7 @@ public class LibsDisguises extends JavaPlugin { // Invalidate invalid distribution if (LibsPremium.isPremium() && LibsPremium.getPaidInformation() != null && - (!LibsPremium.getPaidInformation().isLegit() || - LibsPremium.getPaidInformation().getDownloadID().equals("-1895736039"))) { + !LibsPremium.getPaidInformation().isLegit()) { throw new IllegalStateException( "Error while checking pi rate on startup! Please re-download the jar from SpigotMC before " + "reporting this error!"); diff --git a/src/main/java/me/libraryaddict/disguise/utilities/LibsPremium.java b/src/main/java/me/libraryaddict/disguise/utilities/LibsPremium.java index 526cf3f8..ded30cd6 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/LibsPremium.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/LibsPremium.java @@ -11,6 +11,8 @@ import java.io.File; import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; +import java.util.Date; +import java.util.concurrent.TimeUnit; /** * Created by libraryaddict on 2/06/2017. @@ -194,7 +196,11 @@ public class LibsPremium { if (plugin.isPremium()) { if (!isValidVersion(version, plugin.getVersion()) || plugin.getUserID() == null || - plugin.getDownloadID() == null) { + plugin.getDownloadID() == null || plugin.getUserID().equals("666666") || + plugin.getParsedBuildDate().before(getPluginInformation().getParsedBuildDate()) || + plugin.getParsedBuildDate().after(new Date( + getPluginInformation().getParsedBuildDate().getTime() + + TimeUnit.DAYS.toMillis(365 * 2)))) { DisguiseUtilities.getLogger().warning( "You have an old Lib's Disguises jar (" + file.getName() + " " + fileInfo + ") in the LibsDisguises folder! For security purposes, please replace this with a" + diff --git a/src/main/java/me/libraryaddict/disguise/utilities/plugin/PluginInformation.java b/src/main/java/me/libraryaddict/disguise/utilities/plugin/PluginInformation.java index 8eaddafa..cfa1b39e 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/plugin/PluginInformation.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/plugin/PluginInformation.java @@ -2,6 +2,9 @@ package me.libraryaddict.disguise.utilities.plugin; import me.libraryaddict.disguise.utilities.LibsPremium; +import java.text.SimpleDateFormat; +import java.util.Date; + /** * Created by libraryaddict on 20/06/2019. */ @@ -53,6 +56,16 @@ public class PluginInformation { return buildDate; } + public Date getParsedBuildDate() { + try { + return new SimpleDateFormat("dd/MM/yyyy HH:mm").parse(getBuildDate()); + } + catch (Exception ex) { + } + + return null; + } + public boolean isLegit() { return getUserID().matches("[0-9]+") && getResourceID().equals("32453") && getDownloadID().matches("-?[0-9]+"); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e3411b3f..54c3ab6b 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -16,6 +16,7 @@ Permissions: # Disables commands with the exception of /libsdisguises. Useful if you don't want the plugin to be used by anything # but a plugin +# Useful if you didn't purchase the plugin. DisableCommands: false # The disguise plugin stores all GameProfiles inside a folder called "GameProfiles" as a local cache