Whitespace + general cleanup

This commit is contained in:
Erik Broes
2011-05-14 23:22:54 +02:00
parent 4e0d676b2c
commit c4d444ce98
216 changed files with 1649 additions and 1637 deletions

View File

@@ -24,17 +24,19 @@ public class Updater {
void updateAll(CommandSender sender) {
File folder = new File(DIRECTORY);
File[] files = folder.listFiles(new PluginFilter());
if (files.length == 0) {
sender.sendMessage("No plugins to update.");
} else {
sender.sendMessage("Updating "
+ files.length + " plugins:");
sender.sendMessage("Updating " + files.length + " plugins:");
for (File file : files) {
PluginDescriptionFile pdfFile = Checker.getPDF(file);
if (pdfFile == null) {
continue;
}
FillReader reader = Checker.needsUpdate(pdfFile);
if (reader != null) {
update(reader, sender);
}
@@ -51,11 +53,14 @@ public class Updater {
* The player to send info to
*/
void update(String string, CommandSender player) {
//TODO so much .jars
// TODO so much .jars
File file = new File(DIRECTORY, string + ".jar");
if (file.exists()) {
PluginDescriptionFile pdfFile = Checker.getPDF(file);
FillReader reader = Checker.needsUpdate(pdfFile);
if (reader != null) {
update(reader, player);
} else {
@@ -76,8 +81,7 @@ public class Updater {
private void update(FillReader update, CommandSender sender) {
disablePlugin(update);
sender.sendMessage("Disabling " + update.getName() + " for update");
sender.sendMessage("Downloading " + update.getName() + " "
+ update.getCurrVersion());
sender.sendMessage("Downloading " + update.getName() + " " + update.getCurrVersion());
try {
Downloader.downloadJar(update.getFile());
if (update.getNotes() != null && !update.getNotes().equals("")) {
@@ -93,8 +97,9 @@ public class Updater {
void enablePlugin(FillReader update) {
final String name = update.getName();
//TODO again with the implicit jar support...
File plugin = new File(DIRECTORY, name + ".jar");
try {
server.getPluginManager().loadPlugin(plugin);
} catch (UnknownDependencyException ex) {
@@ -109,6 +114,7 @@ public class Updater {
private void disablePlugin(FillReader update) {
String name = update.getName();
Plugin plugin = server.getPluginManager().getPlugin(name);
server.getPluginManager().disablePlugin(plugin);
}
}