summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate/src/com
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-10-26 19:54:38 +0200
committersnowleo <schneeleo@gmail.com>2011-10-26 19:54:38 +0200
commit36fa05f3a6245685d29e5f06f6b78c6528bfcebf (patch)
treee3334f50c892644fe85d73d22e1b624c9c228016 /EssentialsUpdate/src/com
parent5641b1173cafe59f97d3622ec58cace52640d3e3 (diff)
downloadEssentials-36fa05f3a6245685d29e5f06f6b78c6528bfcebf.tar
Essentials-36fa05f3a6245685d29e5f06f6b78c6528bfcebf.tar.gz
Essentials-36fa05f3a6245685d29e5f06f6b78c6528bfcebf.tar.lz
Essentials-36fa05f3a6245685d29e5f06f6b78c6528bfcebf.tar.xz
Essentials-36fa05f3a6245685d29e5f06f6b78c6528bfcebf.zip
The work process is done async to the server loop.
Diffstat (limited to 'EssentialsUpdate/src/com')
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
index 17f6502fb..4c55eafe4 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java
@@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
-public class StateMachine extends WorkListener
+public class StateMachine extends WorkListener implements Runnable
{
public enum MachineResult
{
@@ -92,18 +92,26 @@ public class StateMachine extends WorkListener
public void startWork()
{
iterator = states.values().iterator();
- callStateWork();
+ Bukkit.getScheduler().scheduleAsyncDelayedTask(getPlugin(), this);
}
- private void callStateWork()
+ @Override
+ public void run()
{
if (!iterator.hasNext())
{
- if (player.isOnline())
+ Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
- player.sendMessage("Installation done.");
- }
- finish();
+ @Override
+ public void run()
+ {
+ if (StateMachine.this.player.isOnline())
+ {
+ StateMachine.this.player.sendMessage("Installation done.");
+ }
+ finish();
+ }
+ });
return;
}
final AbstractState state = iterator.next();
@@ -139,7 +147,7 @@ public class StateMachine extends WorkListener
{
StateMachine.this.player.sendMessage(message);
}
- StateMachine.this.callStateWork();
+ Bukkit.getScheduler().scheduleAsyncDelayedTask(getPlugin(), StateMachine.this);
}
});
}