diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-08-18 15:51:55 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-08-18 15:51:55 +0100 |
commit | e42f7e4ffa35f5772abb7a467ab18058854c1583 (patch) | |
tree | fff3c45269df14007872ddb63023ad44982a7a9d /EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java | |
parent | 8a9353fd098fdc123adc9f014a5a52e9a829a22d (diff) | |
download | Essentials-e42f7e4ffa35f5772abb7a467ab18058854c1583.tar Essentials-e42f7e4ffa35f5772abb7a467ab18058854c1583.tar.gz Essentials-e42f7e4ffa35f5772abb7a467ab18058854c1583.tar.lz Essentials-e42f7e4ffa35f5772abb7a467ab18058854c1583.tar.xz Essentials-e42f7e4ffa35f5772abb7a467ab18058854c1583.zip |
Removing EssentialsUpdate from 2.9 branch.
Development may be continued in 3.x branch.
Diffstat (limited to 'EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java')
-rw-r--r-- | EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java b/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java deleted file mode 100644 index 778f5172f..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.earth2me.essentials.update.tasks; - -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.GetFile; -import com.earth2me.essentials.update.ModuleInfo; -import com.earth2me.essentials.update.VersionInfo; -import java.io.File; -import java.net.URL; -import java.util.logging.Level; -import org.bukkit.Bukkit; - - -public class InstallModule implements Runnable, Task -{ - protected final transient AbstractWorkListener listener; - private final transient String moduleName; - private final transient String fileName; - - public InstallModule(final AbstractWorkListener listener, final String moduleName) - { - this(listener, moduleName, moduleName + ".jar"); - } - - public InstallModule(final AbstractWorkListener listener, final String moduleName, final String fileName) - { - this.listener = listener; - this.moduleName = moduleName; - this.fileName = fileName; - } - - @Override - public void start() - { - Bukkit.getScheduler().scheduleAsyncDelayedTask(listener.getPlugin(), this); - } - - @Override - public void run() - { - final VersionInfo info = listener.getNewVersionInfo(); - final ModuleInfo module = info.getModules().get(moduleName); - if (module == null) - { - listener.onWorkAbort("Module " + moduleName + " not found in VersionInfo."); - return; - } - try - { - final URL downloadUrl = module.getUrl(); - final GetFile getFile = new GetFile(downloadUrl); - getFile.saveTo(new File(listener.getPlugin().getServer().getUpdateFolderFile(), fileName), module.getHash()); - listener.onWorkDone("Module " + moduleName + " downloaded."); - } - catch (Exception ex) - { - Bukkit.getLogger().log(Level.SEVERE, "Failed to download module " + moduleName + " to " + fileName, ex); - listener.onWorkAbort("An error occured, please check your server log."); - return; - } - } -} |