summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-10-26 19:46:40 +0200
committersnowleo <schneeleo@gmail.com>2011-10-26 19:46:40 +0200
commit4c3eef85147a438873bf17fadf7c8b4e90588f6a (patch)
tree84526cf7eed1d7f8c8b8df559df4ac34fcbac28c /EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
parent0dc7b73337c5259fafc598852c27978ca007aba0 (diff)
downloadEssentials-4c3eef85147a438873bf17fadf7c8b4e90588f6a.tar
Essentials-4c3eef85147a438873bf17fadf7c8b4e90588f6a.tar.gz
Essentials-4c3eef85147a438873bf17fadf7c8b4e90588f6a.tar.lz
Essentials-4c3eef85147a438873bf17fadf7c8b4e90588f6a.tar.xz
Essentials-4c3eef85147a438873bf17fadf7c8b4e90588f6a.zip
Abort the installation wizard if a runtime exception happens
Diffstat (limited to 'EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java')
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java34
1 files changed, 23 insertions, 11 deletions
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
index 9a9c64134..17f6502fb 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
@@ -33,22 +33,33 @@ public class StateMachine extends WorkListener
public MachineResult askQuestion()
{
- while (current.guessAnswer())
+ try
{
- current = current.getNextState();
- if (current == null)
+ while (current.guessAnswer())
{
- result = MachineResult.DONE;
- break;
+
+ current = current.getNextState();
+ if (current == null)
+ {
+ result = MachineResult.DONE;
+ break;
+ }
+
}
- }
- if (current != null)
- {
- if (player.isOnline())
+ if (current != null)
{
- current.askQuestion(player);
+ if (player.isOnline())
+ {
+ current.askQuestion(player);
+ }
+ result = MachineResult.WAIT;
}
- result = MachineResult.WAIT;
+ }
+ catch (RuntimeException ex)
+ {
+ player.sendMessage(ex.getMessage());
+ finish();
+ result = MachineResult.ABORT;
}
return result;
}
@@ -135,6 +146,7 @@ public class StateMachine extends WorkListener
private void finish()
{
+ current = null;
iterator = null;
states.clear();
getPlugin().getServer().getPluginManager().callEvent(new InstallationFinishedEvent());