diff options
author | Taylor Kelly <tkelly910@gmail.com> | 2011-01-03 16:25:10 +0800 |
---|---|---|
committer | Dinner Bone <dinnerbone@dinnerbone.com> | 2011-01-03 23:15:18 +0800 |
commit | 4c5a66f2a65414cc00821c1df55fc9c0c67722ac (patch) | |
tree | 1352eeb7f87e1eb29194dc1bcbc60b1e9276fcb9 /src/main/java | |
parent | 91239288839120f59c4599ad3c665ad0f587b13d (diff) | |
download | bukkit-4c5a66f2a65414cc00821c1df55fc9c0c67722ac.tar bukkit-4c5a66f2a65414cc00821c1df55fc9c0c67722ac.tar.gz bukkit-4c5a66f2a65414cc00821c1df55fc9c0c67722ac.tar.lz bukkit-4c5a66f2a65414cc00821c1df55fc9c0c67722ac.tar.xz bukkit-4c5a66f2a65414cc00821c1df55fc9c0c67722ac.zip |
hot damn. get <name> added
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/fillr/Getter.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/fillr/Getter.java b/src/main/java/org/bukkit/fillr/Getter.java new file mode 100644 index 00000000..d71483b9 --- /dev/null +++ b/src/main/java/org/bukkit/fillr/Getter.java @@ -0,0 +1,46 @@ +package org.bukkit.fillr; + +import java.io.File; + +import org.bukkit.*; +import org.bukkit.plugin.InvalidPluginException; + +public class Getter { + private Server server; + private static String directory = Fillr.directory; + + public Getter(Server server) { + this.server = server; + } + + public void get(String string, Player player) { + FillReader reader = new FillReader(string); + player.sendMessage("Downloading " + reader.getName() + " " + + reader.getCurrVersion()); + try { + Downloader.downloadJar(reader.getFile()); + if (reader.getNotes() != null && !reader.getNotes().equals("")) { + player.sendMessage("Notes: " + reader.getNotes()); + } + player.sendMessage("Finished Download!"); + enablePlugin(reader); + player.sendMessage("Loading " + reader.getName()); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + private 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 (InvalidPluginException e) { + e.printStackTrace(); + } + } + + +} |