summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-10-26 22:27:43 +0200
committersnowleo <schneeleo@gmail.com>2011-10-26 22:27:43 +0200
commit7622c5c5108f406d3fbb285de0d2446fdc3127dd (patch)
treec0631cc25995dbcaa2e87dd0e4c53f546e0aad1f
parent76f8cb96cabcf524b4babbaed24fd7dd557375cb (diff)
downloadEssentials-7622c5c5108f406d3fbb285de0d2446fdc3127dd.tar
Essentials-7622c5c5108f406d3fbb285de0d2446fdc3127dd.tar.gz
Essentials-7622c5c5108f406d3fbb285de0d2446fdc3127dd.tar.lz
Essentials-7622c5c5108f406d3fbb285de0d2446fdc3127dd.tar.xz
Essentials-7622c5c5108f406d3fbb285de0d2446fdc3127dd.zip
Abort update text
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java18
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/Changelog.java4
2 files changed, 12 insertions, 10 deletions
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
index 6d2613a40..d0ebd7b4c 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
@@ -8,12 +8,12 @@ public abstract class AbstractState
{
private transient boolean abortion = false;
private final transient StateMap stateMap;
-
+
public AbstractState(final StateMap stateMap)
{
this.stateMap = stateMap;
}
-
+
public <T extends AbstractState> T getState(final Class<? extends T> stateClass)
{
if (!stateMap.containsKey(stateClass))
@@ -35,7 +35,7 @@ public abstract class AbstractState
}
return (T)stateMap.get(stateClass);
}
-
+
public abstract AbstractState getNextState();
/**
@@ -60,13 +60,15 @@ public abstract class AbstractState
* @return true, if the answer could be recognized as a valid answer
*/
public abstract boolean reactOnAnswer(String answer);
-
+
public final AbstractState reactOnAnswer(final Player sender, final String answer)
{
final String trimmedAnswer = answer.trim();
if (trimmedAnswer.equalsIgnoreCase("quit")
|| trimmedAnswer.equalsIgnoreCase("bye")
- || trimmedAnswer.equalsIgnoreCase("abort"))
+ || trimmedAnswer.equalsIgnoreCase("abort")
+ || trimmedAnswer.equalsIgnoreCase("cancel")
+ || trimmedAnswer.equalsIgnoreCase("exit"))
{
abort();
return null;
@@ -88,7 +90,7 @@ public abstract class AbstractState
{
sender.sendMessage(ex.toString());
return this;
- }
+ }
}
/**
@@ -98,12 +100,12 @@ public abstract class AbstractState
{
listener.onWorkDone();
}
-
+
public boolean isAbortion()
{
return abortion;
}
-
+
protected void abort()
{
abortion = true;
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/Changelog.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/Changelog.java
index 36ae93c4d..10a4f33c5 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/Changelog.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/Changelog.java
@@ -61,11 +61,11 @@ public class Changelog extends AbstractState
}
if (pages > 1)
{
- sender.sendMessage("Select a page by typing the numbers 1 to " + pages + " to view all changes and then type confirm to update Essentials.");
+ sender.sendMessage("Select a page by typing the numbers 1 to " + pages + " to view all changes and then type confirm or abort.");
}
else
{
- sender.sendMessage("Type confirm to update Essentials.");
+ sender.sendMessage("Type confirm to update Essentials or abort to cancel the update.");
}
}