blob: 98dbeb2ef8fa42118a4e260f3dc29541a850cddc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
package com.earth2me.essentials.update;
import com.earth2me.essentials.update.UpdateCheck.CheckResult;
import java.util.logging.Level;
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().log(Level.SEVERE, "Could not create data folder: {0}", getDataFolder().getPath());
}
essentialsHelp = new EssentialsHelp(this);
essentialsHelp.registerEvents();
final UpdateCheck updateCheck = new UpdateCheck(this);
updateCheck.checkForUpdates();
updateProcess = new UpdateProcess(this, updateCheck);
updateProcess.registerEvents();
Bukkit.getLogger().log(Level.INFO, "EssentialsUpdate {0} loaded.", getDescription().getVersion());
if (updateCheck.isEssentialsInstalled())
{
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;
}
}
|