summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate
diff options
context:
space:
mode:
authormd_5 <md_5@bigpond.com>2012-06-27 20:03:26 +1000
committermd_5 <md_5@bigpond.com>2012-06-27 20:03:26 +1000
commit7bef2d3817634a4c396e61930460126dde3606ba (patch)
treeaddbcf9b25a818a10afb9e9363ddd4ee9145b490 /EssentialsUpdate
parent3d96c9caaf19cc1e6849295067d2a3ac01f05351 (diff)
downloadEssentials-7bef2d3817634a4c396e61930460126dde3606ba.tar
Essentials-7bef2d3817634a4c396e61930460126dde3606ba.tar.gz
Essentials-7bef2d3817634a4c396e61930460126dde3606ba.tar.lz
Essentials-7bef2d3817634a4c396e61930460126dde3606ba.tar.xz
Essentials-7bef2d3817634a4c396e61930460126dde3606ba.zip
Cleanup signs, update and xmpp, more to come.
Diffstat (limited to 'EssentialsUpdate')
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/UpdateCheck.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java11
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java1
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/chat/IrcBot.java1
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java6
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChat.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsGeoIP.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsProtect.java2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsSpawn.java47
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java17
13 files changed, 27 insertions, 70 deletions
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java b/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java
index 6cad44e4d..489c2163d 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java
@@ -37,4 +37,4 @@ public class PastieUpload
throw new IOException("Failed to upload to pastie.org");
}
}
-} \ No newline at end of file
+}
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateCheck.java b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateCheck.java
index 98426ce58..3d0034166 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateCheck.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateCheck.java
@@ -188,7 +188,7 @@ public class UpdateCheck
private int getBukkitVersion()
{
final Matcher versionMatch = Pattern.compile("git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[\\.0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*").matcher(plugin.getServer().getVersion());
- if (versionMatch.matches())
+ if (versionMatch.matches())
{
return Integer.parseInt(versionMatch.group(1));
}
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java
index 3d465e2e8..0659f7dbb 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials.update;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigInteger;
import java.security.KeyFactory;
@@ -15,6 +16,7 @@ import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
+import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
@@ -25,7 +27,6 @@ public class UpdateFile
private final static String UPDATE_URL = "http://goo.gl/67jev";
private final static BigInteger PUBLIC_KEY = new BigInteger("5ha6a2d4qdy17ttkg8evh74sl5a87djojwenu12k1lvy8ui6003e6l06rntczpoh99mhc3txj8mqlxw111oyy9yl7s7qpyluyzix3j1odxrxx4u52gxvyu6qiteapczkzvi7rxgeqsozz7b19rdx73a7quo9ybwpz1cr82r7x5k0pg2a73pjjsv2j1awr13azo7klrcxp9y5xxwf5qv1s3tw4zqftli18u0ek5qkbzfbgk1v5n2f11pkwwk6p0mibrn26wnjbv11vyiqgu95o7busmt6vf5q7grpcenl637w83mbin56s3asj1131b2mscj9xep3cbj7la9tgsxl5bj87vzy8sk2d34kzwqdqgh9nry43nqqus12l1stmiv184r8r3jcy8w43e8h1u1mzklldb5eytkuhayqik8l3ns04hwt8sgacvw534be8sx26qrn5s1", 36);
private final transient File file;
- private transient YamlConfiguration updateConfig;
private final transient Plugin plugin;
private final transient TreeMap<Version, VersionInfo> versions = new TreeMap<Version, VersionInfo>();
@@ -185,16 +186,14 @@ public class UpdateFile
return false;
}
- private void readVersions() throws Exception
+ private void readVersions() throws FileNotFoundException, InvalidConfigurationException, IOException
{
- updateConfig = new YamlConfiguration();
+ final YamlConfiguration updateConfig = new YamlConfiguration();
updateConfig.load(file);
versions.clear();
for (String versionString : updateConfig.getKeys(false))
{
- final Version version = new Version(versionString);
- final VersionInfo info = new VersionInfo(updateConfig, versionString);
- versions.put(version, info);
+ versions.put(new Version(versionString), new VersionInfo(updateConfig, versionString));
}
}
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
index 9fa587f8f..3da76cc25 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
@@ -14,7 +14,7 @@ import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.Plugin;
-
+// TODO: This whole thing should make use of the conversations api
public class UpdateProcess implements Listener
{
private transient Player currentPlayer;
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java
index de2c6a830..5eb3c8082 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java
@@ -61,6 +61,5 @@ public class ConfigCommand extends AbstractFileCommand implements Command
player.sendMessage(ex.getMessage());
}
}
-
}
}
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/IrcBot.java b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/IrcBot.java
index 31e9384ee..c2cc209e6 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/IrcBot.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/chat/IrcBot.java
@@ -35,7 +35,6 @@ public class IrcBot extends PircBot
try
{
connect(SERVER, PORT);
- return;
}
catch (IOException ex)
{
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
index 2c85c39fd..9d3279439 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
@@ -39,7 +39,7 @@ public abstract class AbstractState
/**
* Check if we already know the answer, so the user does not have to answer the question.
- *
+ *
* @return true, if the answer could be guessed.
*/
public boolean guessAnswer()
@@ -49,12 +49,14 @@ public abstract class AbstractState
/**
* Ask the user the question.
- * @param sender
+ *
+ * @param sender
*/
public abstract void askQuestion(Player sender);
/**
* React on the answer and set internal variables
+ *
* @param answer
* @return true, if the answer could be recognized as a valid answer
*/
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChat.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChat.java
index 6aaed634a..7253f0d80 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChat.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChat.java
@@ -11,7 +11,7 @@ public class EssentialsChat extends AbstractYesNoState
{
public EssentialsChat(final StateMap states)
{
- super(states, EssentialsChatSettings.class, EssentialsSpawn.class);
+ super(states, EssentialsChatSettings.class);
}
@Override
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java
index 6666ff371..bb53bc86b 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java
@@ -7,7 +7,7 @@ public class EssentialsChatSettings extends AbstractYesNoState
{
public EssentialsChatSettings(final StateMap states)
{
- super(states, EssentialsSpawn.class);
+ super(states, null);
}
@Override
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsGeoIP.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsGeoIP.java
index a91a44787..6924a5445 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsGeoIP.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsGeoIP.java
@@ -44,4 +44,4 @@ public class EssentialsGeoIP extends AbstractYesNoState
}
listener.onWorkDone();
}
-} \ No newline at end of file
+}
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsProtect.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsProtect.java
index ca0337d30..925d28315 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsProtect.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsProtect.java
@@ -44,4 +44,4 @@ public class EssentialsProtect extends AbstractYesNoState
}
listener.onWorkDone();
}
-} \ No newline at end of file
+}
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsSpawn.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsSpawn.java
deleted file mode 100644
index 2a87638ba..000000000
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsSpawn.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.earth2me.essentials.update.states;
-
-import com.earth2me.essentials.update.AbstractWorkListener;
-import com.earth2me.essentials.update.tasks.InstallModule;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.Plugin;
-
-
-public class EssentialsSpawn extends AbstractYesNoState
-{
- public EssentialsSpawn(final StateMap states)
- {
- super(states, null);
- }
-
- @Override
- public boolean guessAnswer()
- {
- final Plugin plugin = Bukkit.getPluginManager().getPlugin("EssentialsSpawn");
- if (plugin != null)
- {
- setAnswer(true);
- return true;
- }
- return false;
- }
-
- @Override
- public void askQuestion(final Player sender)
- {
- sender.sendMessage("Do you want to install EssentialsSpawn? (yes/no)");
- sender.sendMessage("EssentialsSpawn lets you control player spawning");
- sender.sendMessage("It allows you to set different places where players spawn on death, new players join and allows players to return to spawn.");
- }
-
- @Override
- public void doWork(final AbstractWorkListener listener)
- {
- if (getAnswer())
- {
- new InstallModule(listener, "EssentialsSpawn").start();
- return;
- }
- listener.onWorkDone();
- }
-} \ No newline at end of file
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
index 194d7e98e..4c3fd8f0a 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
@@ -6,11 +6,16 @@ import org.bukkit.event.HandlerList;
public class InstallationFinishedEvent extends Event
{
- private static final HandlerList handlers = new HandlerList();
+ private static final HandlerList handlers = new HandlerList();
- @Override
- public HandlerList getHandlers()
- {
- return handlers;
- }
+ @Override
+ public HandlerList getHandlers()
+ {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList()
+ {
+ return handlers;
+ }
}