Clean up file accesser
This commit is contained in:
		| @@ -144,6 +144,11 @@ public class LibsDisguises extends JavaPlugin { | |||||||
|         new MetricsInitalizer(); |         new MetricsInitalizer(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public File getFile() { | ||||||
|  |         return super.getFile(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void onDisable() { |     public void onDisable() { | ||||||
|         DisguiseUtilities.saveDisguises(); |         DisguiseUtilities.saveDisguises(); | ||||||
|   | |||||||
| @@ -940,9 +940,8 @@ public class DisguiseUtilities { | |||||||
|  |  | ||||||
|         cachedNames.addAll(Arrays.asList(profileCache.list())); |         cachedNames.addAll(Arrays.asList(profileCache.list())); | ||||||
|  |  | ||||||
|         invalidFile = new File( |         invalidFile = LibsDisguises.getInstance().getFile().getName().toLowerCase() | ||||||
|                 LibsDisguises.getInstance().getClass().getProtectionDomain().getCodeSource().getLocation().getFile()) |                 .matches(".*((crack)|(null)|(leak)).*"); | ||||||
|                 .getName().toLowerCase().matches(".*((crack)|(null)|(leak)).*"); |  | ||||||
|  |  | ||||||
|         for (String key : savedDisguises.list()) { |         for (String key : savedDisguises.list()) { | ||||||
|             try { |             try { | ||||||
|   | |||||||
| @@ -64,8 +64,8 @@ public class LibsPremium { | |||||||
|      * @param userID |      * @param userID | ||||||
|      * @return true if userID does not contain __USER__ |      * @return true if userID does not contain __USER__ | ||||||
|      */ |      */ | ||||||
|     private static Boolean isPremium(String userID) { |     private static Boolean isPremium(String resourceID, String userID) { | ||||||
|         return !userID.contains("__USER__") && !getResourceID().equals("81"); |         return !userID.contains("__USER__") && !resourceID.equals("81"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static Boolean isAPIPlugin() { |     public static Boolean isAPIPlugin() { | ||||||
| @@ -76,7 +76,7 @@ public class LibsPremium { | |||||||
|      * Returns true if this plugin is premium |      * Returns true if this plugin is premium | ||||||
|      */ |      */ | ||||||
|     public static Boolean isPremium() { |     public static Boolean isPremium() { | ||||||
|         return thisPluginIsPaidFor == null ? isPremium(getUserID()) : thisPluginIsPaidFor; |         return thisPluginIsPaidFor == null ? isPremium(getResourceID(), getUserID()) : thisPluginIsPaidFor; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -142,7 +142,7 @@ public class LibsPremium { | |||||||
|                 userId = (String) c.getMethod("getUserID").invoke(null); |                 userId = (String) c.getMethod("getUserID").invoke(null); | ||||||
|                 resourceId = (String) c.getMethod("getResourceID").invoke(null); |                 resourceId = (String) c.getMethod("getResourceID").invoke(null); | ||||||
|                 downloadId = (String) c.getMethod("getDownloadID").invoke(null); |                 downloadId = (String) c.getMethod("getDownloadID").invoke(null); | ||||||
|                 premium = isPremium(userId); |                 premium = isPremium(resourceId, userId); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             String pluginBuildDate = "??/??/????"; |             String pluginBuildDate = "??/??/????"; | ||||||
| @@ -306,7 +306,7 @@ public class LibsPremium { | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             pluginInformation = new PluginInformation(getUserID(), getResourceID(), getDownloadID(), |             pluginInformation = new PluginInformation(getUserID(), getResourceID(), getDownloadID(), | ||||||
|                     isPremium(getUserID()), version, buildNo, pluginBuildDate); |                     isPremium(getResourceID(), getUserID()), version, buildNo, pluginBuildDate); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (!isPremium() || !LibsDisguises.getInstance().isReleaseBuild()) { |         if (!isPremium() || !LibsDisguises.getInstance().isReleaseBuild()) { | ||||||
| @@ -351,9 +351,7 @@ public class LibsPremium { | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (!foundBetter) { |             if (!foundBetter) { | ||||||
|                 File f = new File( |                 File f = LibsDisguises.getInstance().getFile(); | ||||||
|                         LibsDisguises.getInstance().getClass().getProtectionDomain().getCodeSource().getLocation() |  | ||||||
|                                 .getFile()); |  | ||||||
|  |  | ||||||
|                 FileUtil.copy(f, new File(LibsDisguises.getInstance().getDataFolder(), f.getName())); |                 FileUtil.copy(f, new File(LibsDisguises.getInstance().getDataFolder(), f.getName())); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user