summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTaylor Kelly <tkelly910@gmail.com>2011-01-03 12:26:35 +0800
committerDinner Bone <dinnerbone@dinnerbone.com>2011-01-03 23:15:17 +0800
commitd9fc1dffea0f8f6c48f3aa139ebdea7ebacba764 (patch)
tree154dd8879284c29ddb87557a7c7985ea59868aff /src
parent596ad60575ab93bd0302c74cc09bd7a78bb5775d (diff)
downloadbukkit-d9fc1dffea0f8f6c48f3aa139ebdea7ebacba764.tar
bukkit-d9fc1dffea0f8f6c48f3aa139ebdea7ebacba764.tar.gz
bukkit-d9fc1dffea0f8f6c48f3aa139ebdea7ebacba764.tar.lz
bukkit-d9fc1dffea0f8f6c48f3aa139ebdea7ebacba764.tar.xz
bukkit-d9fc1dffea0f8f6c48f3aa139ebdea7ebacba764.zip
better visibility/javadoc
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/fillr/Checker.java12
-rw-r--r--src/main/java/org/bukkit/fillr/Downloader.java24
-rw-r--r--src/main/java/org/bukkit/fillr/Updater.java13
3 files changed, 19 insertions, 30 deletions
diff --git a/src/main/java/org/bukkit/fillr/Checker.java b/src/main/java/org/bukkit/fillr/Checker.java
index d105ad51..cfb2a5b2 100644
--- a/src/main/java/org/bukkit/fillr/Checker.java
+++ b/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/src/main/java/org/bukkit/fillr/Downloader.java b/src/main/java/org/bukkit/fillr/Downloader.java
index bd055911..7a73fe1e 100644
--- a/src/main/java/org/bukkit/fillr/Downloader.java
+++ b/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/src/main/java/org/bukkit/fillr/Updater.java b/src/main/java/org/bukkit/fillr/Updater.java
index befcc848..e2a081d8 100644
--- a/src/main/java/org/bukkit/fillr/Updater.java
+++ b/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() + " "