Fix auto updater
This commit is contained in:
		| @@ -195,8 +195,6 @@ public enum DisguiseType { | |||||||
|  |  | ||||||
|     TURTLE, |     TURTLE, | ||||||
|  |  | ||||||
|     ZOMBIE_HORSE, |  | ||||||
|  |  | ||||||
|     UNKNOWN, |     UNKNOWN, | ||||||
|  |  | ||||||
|     VEX, |     VEX, | ||||||
| @@ -219,6 +217,8 @@ public enum DisguiseType { | |||||||
|  |  | ||||||
|     ZOMBIE, |     ZOMBIE, | ||||||
|  |  | ||||||
|  |     ZOMBIE_HORSE, | ||||||
|  |  | ||||||
|     ZOMBIE_VILLAGER; |     ZOMBIE_VILLAGER; | ||||||
|  |  | ||||||
|     public static DisguiseType getType(Entity entity) { |     public static DisguiseType getType(Entity entity) { | ||||||
|   | |||||||
| @@ -83,10 +83,12 @@ public class UpdateChecker { | |||||||
|  |  | ||||||
|         File dest = new File(Bukkit.getUpdateFolderFile(), "LibsDisguises.jar"); |         File dest = new File(Bukkit.getUpdateFolderFile(), "LibsDisguises.jar"); | ||||||
|  |  | ||||||
|         if (!dest.exists()) { |         if (dest.exists()) { | ||||||
|             dest.mkdirs(); |             dest.delete(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         dest.getParentFile().mkdirs(); | ||||||
|  |  | ||||||
|         try { |         try { | ||||||
|             // We're connecting to spigot's API |             // We're connecting to spigot's API | ||||||
|             URL url = new URL(urlString); |             URL url = new URL(urlString); | ||||||
| @@ -106,6 +108,7 @@ public class UpdateChecker { | |||||||
|             dest.delete(); |             dest.delete(); | ||||||
|             DisguiseUtilities.getLogger().warning("Failed to download snapshot build."); |             DisguiseUtilities.getLogger().warning("Failed to download snapshot build."); | ||||||
|             lastDownload = 0; |             lastDownload = 0; | ||||||
|  |             ex.printStackTrace(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return false; |         return false; | ||||||
|   | |||||||
| @@ -182,9 +182,17 @@ public class DisguiseListener implements Listener { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (updateMessage == LibsMsg.UPDATE_SUCCESS || updateMessage == LibsMsg.UPDATE_FAILED) { |         if (updateMessage == LibsMsg.UPDATE_SUCCESS || updateMessage == LibsMsg.UPDATE_FAILED) { | ||||||
|             player.sendMessage(updateMessage.get()); |             if (player instanceof Player) { | ||||||
|  |                 player.sendMessage(updateMessage.get()); | ||||||
|  |             } else { | ||||||
|  |                 DisguiseUtilities.getLogger().info(updateMessage.get()); | ||||||
|  |             } | ||||||
|         } else { |         } else { | ||||||
|             player.sendMessage(updateMessage.get(currentVersion, latestVersion)); |             if (player instanceof Player) { | ||||||
|  |                 player.sendMessage(updateMessage.get(currentVersion, latestVersion)); | ||||||
|  |             } else { | ||||||
|  |                 DisguiseUtilities.getLogger().info(updateMessage.get(currentVersion, latestVersion)); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user