mirror of
https://github.com/essentials/Essentials.git
synced 2025-10-01 16:46:51 +02:00
Some cleanup, refactoring of EssentialsHelp class
This commit is contained in:
@@ -3,7 +3,6 @@ package com.earth2me.essentials.update;
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -22,7 +21,7 @@ public class UpdateCheck
|
||||
private final transient Plugin plugin;
|
||||
private transient boolean essentialsInstalled;
|
||||
|
||||
public UpdateCheck(Plugin plugin)
|
||||
public UpdateCheck(final Plugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
updateFile = new UpdateFile(plugin);
|
||||
@@ -31,21 +30,20 @@ public class UpdateCheck
|
||||
|
||||
private void checkForEssentials()
|
||||
{
|
||||
PluginManager pm = plugin.getServer().getPluginManager();
|
||||
Plugin essentials = pm.getPlugin("Essentials");
|
||||
if (essentials == null)
|
||||
final PluginManager pluginManager = plugin.getServer().getPluginManager();
|
||||
final Plugin essentials = pluginManager.getPlugin("Essentials");
|
||||
essentialsInstalled = essentials != null;
|
||||
if (essentialsInstalled)
|
||||
{
|
||||
currentVersion = new Version(essentials.getDescription().getVersion());
|
||||
}
|
||||
else
|
||||
{
|
||||
essentialsInstalled = false;
|
||||
if (new File(plugin.getDataFolder().getParentFile(), "Essentials.jar").exists())
|
||||
{
|
||||
Bukkit.getLogger().severe("Essentials.jar found, but not recognized by Bukkit. Broken download?");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
essentialsInstalled = true;
|
||||
currentVersion = new Version(essentials.getDescription().getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
public void scheduleUpdateTask()
|
||||
@@ -81,6 +79,7 @@ public class UpdateCheck
|
||||
return updateFile.getVersions().get(newVersion);
|
||||
}
|
||||
|
||||
|
||||
public enum CheckResult
|
||||
{
|
||||
NEW_ESS, NEW_ESS_BUKKIT, NEW_BUKKIT, OK, UNKNOWN
|
||||
|
Reference in New Issue
Block a user