summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate/src
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
commit3f876b04c6a767fbe4f6367ff2f0a07f1936b2d6 (patch)
treea8f9123b1564ba98f6d1a9ba65c4a07f271a94b3 /EssentialsUpdate/src
parent4c3eef85147a438873bf17fadf7c8b4e90588f6a (diff)
downloadEssentials-3f876b04c6a767fbe4f6367ff2f0a07f1936b2d6.tar
Essentials-3f876b04c6a767fbe4f6367ff2f0a07f1936b2d6.tar.gz
Essentials-3f876b04c6a767fbe4f6367ff2f0a07f1936b2d6.tar.lz
Essentials-3f876b04c6a767fbe4f6367ff2f0a07f1936b2d6.tar.xz
Essentials-3f876b04c6a767fbe4f6367ff2f0a07f1936b2d6.zip
The work process is done async to the server loop.
Diffstat (limited to 'EssentialsUpdate/src')
-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);
}
});
}