diff options
author | snowleo <schneeleo@gmail.com> | 2011-10-22 11:55:01 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-10-22 11:55:01 +0200 |
commit | 11e8240c5cbadca9cf9d0a69c97e99220f808e69 (patch) | |
tree | 6912ca173e596e91757788825e1ae7c555a07c8d /EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java | |
parent | 4aecc034c26d6d9c71024f90183e25e431217b7b (diff) | |
parent | aa922c5b67dc6d9fc5ef865edb9269397a687e13 (diff) | |
download | Essentials-11e8240c5cbadca9cf9d0a69c97e99220f808e69.tar Essentials-11e8240c5cbadca9cf9d0a69c97e99220f808e69.tar.gz Essentials-11e8240c5cbadca9cf9d0a69c97e99220f808e69.tar.lz Essentials-11e8240c5cbadca9cf9d0a69c97e99220f808e69.tar.xz Essentials-11e8240c5cbadca9cf9d0a69c97e99220f808e69.zip |
Merge branch 'refs/heads/master' into releasestable-2.6.4
Conflicts:
EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
Diffstat (limited to 'EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java')
-rw-r--r-- | EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java new file mode 100644 index 000000000..d4ee6c0fc --- /dev/null +++ b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java @@ -0,0 +1,66 @@ +package com.earth2me.essentials.update; + +import com.earth2me.essentials.update.UpdateCheck.CheckResult; +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; + + +public class EssentialsUpdate extends JavaPlugin +{ + private transient EssentialsHelp essentialsHelp; + private transient UpdateProcess updateProcess; + + @Override + public void onEnable() + { + if (!getDataFolder().exists() && !getDataFolder().mkdirs() ) { + Bukkit.getLogger().severe("Could not create data folder:"+getDataFolder().getPath()); + } + essentialsHelp = new EssentialsHelp(this); + essentialsHelp.registerEvents(); + + final UpdateCheck updateCheck = new UpdateCheck(this); + updateProcess = new UpdateProcess(this, updateCheck); + updateProcess.registerEvents(); + + Bukkit.getLogger().info("EssentialsUpdate " + getDescription().getVersion() + " loaded."); + + if (updateCheck.isEssentialsInstalled()) + { + updateCheck.checkForUpdates(); + final Version myVersion = new Version(getDescription().getVersion()); + if (updateCheck.getResult() == CheckResult.NEW_ESS && myVersion.equals(updateCheck.getNewVersion())) + { + Bukkit.getLogger().info("Versions of EssentialsUpdate and Essentials do not match. Starting automatic update."); + updateProcess.doAutomaticUpdate(); + } + updateCheck.scheduleUpdateTask(); + } + else + { + Bukkit.getLogger().info("Essentials is ready for installation. Join the game and follow the instructions."); + } + } + + @Override + public void onDisable() + { + essentialsHelp.onDisable(); + } + + @Override + public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) + { + if (command.getName().equalsIgnoreCase("essentialsupdate")) + { + updateProcess.onCommand(sender); + } + if (command.getName().equalsIgnoreCase("essentialshelp")) + { + essentialsHelp.onCommand(sender); + } + return true; + } +} |