1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-10-01 08:36:48 +02:00

The state machine now handles both manual updating and installation.

This commit is contained in:
snowleo
2011-10-26 22:14:24 +02:00
parent da01d35e2b
commit 652ff80deb
9 changed files with 260 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
package com.earth2me.essentials.update.states;
import com.earth2me.essentials.update.UpdateCheck;
import com.earth2me.essentials.update.WorkListener;
import com.earth2me.essentials.update.VersionInfo;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -19,16 +19,13 @@ public class StateMachine extends WorkListener implements Runnable
private transient Player player;
private transient MachineResult result = MachineResult.NONE;
public StateMachine(final Plugin plugin, final Player player, final VersionInfo newVersionInfo)
public StateMachine(final Plugin plugin, final Player player, final UpdateCheck updateCheck)
{
super(plugin, newVersionInfo);
super(plugin, updateCheck.getNewVersionInfo());
this.player = player;
states.clear();
states.add(new EssentialsChat(states));
states.add(new EssentialsSpawn(states));
states.add(new EssentialsProtect(states));
states.add(new EssentialsGeoIP(states));
current = states.values().iterator().next();
UpdateOrInstallation state = new UpdateOrInstallation(states, updateCheck);
current = states.put(UpdateOrInstallation.class, state);
}
public MachineResult askQuestion()