diff --git a/paper-api/src/main/java/org/bukkit/fillr/Checker.java b/paper-api/src/main/java/org/bukkit/fillr/Checker.java index d105ad5179..cfb2a5b2d7 100644 --- a/paper-api/src/main/java/org/bukkit/fillr/Checker.java +++ b/paper-api/src/main/java/org/bukkit/fillr/Checker.java @@ -9,12 +9,12 @@ public class Checker { private static String directory = Fillr.directory; /** - * Checks all the .updatr files in Updatr/ for updates + * Checks all the plugins in plugins/ for updates * * @param player * The player to send info to */ - public void check(Player player) { + void check(Player player) { File folder = new File(directory); File[] files = folder.listFiles(new PluginFilter()); if (files.length == 0) { @@ -31,14 +31,14 @@ public class Checker { } /** - * Checks for an update for a given .updatr file + * Checks for an update for a given plugin * * @param file * The plugin file to check for an update * @param player * The player to send info to */ - public void checkForUpdate(File file, Player player) { + private void checkForUpdate(File file, Player player) { PluginDescriptionFile pdfFile = Checker.getPDF(file); FillReader reader = needsUpdate(pdfFile); if (reader != null) { @@ -58,7 +58,7 @@ public class Checker { * The .yml file to check * @return The FillReader for the online repo info on the plugin */ - public static FillReader needsUpdate(PluginDescriptionFile file) { + static FillReader needsUpdate(PluginDescriptionFile file) { FillReader reader = new FillReader(file.getName()); String version = file.getVersion(); String currVersion = reader.getCurrVersion(); @@ -79,7 +79,7 @@ public class Checker { * The plugin (jar) file * @return The PluginDescriptionFile representing the .yml */ - public static PluginDescriptionFile getPDF(File file) { + static PluginDescriptionFile getPDF(File file) { // TODO supports only jar files for now. how will yml's be stored in // different languages? if (file.getName().endsWith(".jar")) { diff --git a/paper-api/src/main/java/org/bukkit/fillr/Downloader.java b/paper-api/src/main/java/org/bukkit/fillr/Downloader.java index bd055911c9..7a73fe1ed7 100644 --- a/paper-api/src/main/java/org/bukkit/fillr/Downloader.java +++ b/paper-api/src/main/java/org/bukkit/fillr/Downloader.java @@ -19,7 +19,7 @@ public class Downloader { * @param url * The url to download from */ - public static void downloadJar(String url) throws Exception { + static void downloadJar(String url) throws Exception { int index = url.lastIndexOf('/'); String name = url.substring(index + 1); @@ -37,14 +37,14 @@ public class Downloader { } /** - * Downloads the file for a given plugin (if it's updatr file exists); + * Downloads the file for a given plugin * * @param name * The name of the plugin to download * @param player * The player to send info to */ - public void downloadFile(String name, Player player) throws Exception { + void downloadFile(String name, Player player) throws Exception { File file = new File(directory, name + ".jar"); if (file.exists()) { player.sendMessage("Downloading " + name + "'s file"); @@ -58,7 +58,7 @@ public class Downloader { } /** - * Downloads the file to the Updatr/downloads directory + * Downloads the file to the plugin/downloads directory * * @param u * The url of the file to download @@ -130,7 +130,7 @@ public class Downloader { * OutputStream * @throws IOException */ - public static final void copyInputStream(InputStream in, OutputStream out) + private static final void copyInputStream(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[1024]; int len; @@ -142,18 +142,6 @@ public class Downloader { out.close(); } - /** - * Downloads the new updatr file - * - * @param url - * The url pointing to the updatr file - * @param name - * The name of the plugin - */ - public static void downloadUpdatr(String url, String name) throws Exception { - // try { - download(new URL(url), name + ".updatr", Fillr.directory); - } /** * Moves the file to the backup folder. @@ -161,7 +149,7 @@ public class Downloader { * @param file * The file to backup */ - public static void backupFile(File file) { + private static void backupFile(File file) { if (file.exists()) { System.out.println("Backing up old file: " + file.getName()); if (!new File(backup).exists()) diff --git a/paper-api/src/main/java/org/bukkit/fillr/Updater.java b/paper-api/src/main/java/org/bukkit/fillr/Updater.java index befcc84892..e2a081d861 100644 --- a/paper-api/src/main/java/org/bukkit/fillr/Updater.java +++ b/paper-api/src/main/java/org/bukkit/fillr/Updater.java @@ -12,17 +12,17 @@ public class Updater { public static String directory = Fillr.directory; private final Server server; - public Updater(Server server) { + Updater(Server server) { this.server = server; } /** - * Checks and updates the plugins with updatr files + * Checks and updates the plugins * * @param player * The player to send info to */ - public void updateAll(Player player) { + void updateAll(Player player) { File folder = new File(directory); File[] files = folder.listFiles(new PluginFilter()); if (files.length == 0) { @@ -48,7 +48,7 @@ public class Updater { * @param player * The player to send info to */ - public void update(String string, Player player) { + void update(String string, Player player) { //TODO so much .jars File file = new File(directory, string + ".jar"); if (file.exists()) { @@ -68,9 +68,10 @@ public class Updater { * Downloads the plugin specified by the URLReader * * @param update - * The URLReader representing the online .updatr file + * The FillReader with all the plugin info + * @param player The player to send info to */ - public void update(FillReader update, Player player) { + private void update(FillReader update, Player player) { disablePlugin(update); player.sendMessage("Disabling " + update.getName() + " for update"); player.sendMessage("Downloading " + update.getName() + " "