1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-13 18:14:38 +02:00

Reload after installation

This commit is contained in:
snowleo
2011-10-26 22:23:30 +02:00
parent 0be5233b89
commit 7ef9b23633

View File

@@ -24,7 +24,7 @@ public class StateMachine extends WorkListener implements Runnable
super(plugin, updateCheck.getNewVersionInfo()); super(plugin, updateCheck.getNewVersionInfo());
this.player = player; this.player = player;
states.clear(); states.clear();
UpdateOrInstallation state = new UpdateOrInstallation(states, updateCheck); final UpdateOrInstallation state = new UpdateOrInstallation(states, updateCheck);
current = states.put(UpdateOrInstallation.class, state); current = states.put(UpdateOrInstallation.class, state);
} }
@@ -102,9 +102,10 @@ public class StateMachine extends WorkListener implements Runnable
{ {
if (StateMachine.this.player.isOnline()) if (StateMachine.this.player.isOnline())
{ {
StateMachine.this.player.sendMessage("Installation done."); StateMachine.this.player.sendMessage("Installation done. Reloading server.");
} }
finish(); finish();
Bukkit.getServer().reload();
} }
}); });
return; return;
@@ -155,19 +156,16 @@ public class StateMachine extends WorkListener implements Runnable
getPlugin().getServer().getPluginManager().callEvent(new InstallationFinishedEvent()); getPlugin().getServer().getPluginManager().callEvent(new InstallationFinishedEvent());
} }
public void resumeInstallation(Player player) public void resumeInstallation(final Player player)
{ {
this.player = player; this.player = player;
if (result == MachineResult.WAIT) if (result == MachineResult.WAIT)
{ {
if (current != null) if (current == null)
{
current.askQuestion(player);
}
else
{ {
throw new RuntimeException("State is WAIT, but current state is null!"); throw new RuntimeException("State is WAIT, but current state is null!");
} }
current.askQuestion(player);
} }
if (result == MachineResult.DONE && iterator != null) if (result == MachineResult.DONE && iterator != null)
{ {
@@ -175,7 +173,7 @@ public class StateMachine extends WorkListener implements Runnable
} }
if (result == MachineResult.ABORT) if (result == MachineResult.ABORT)
{ {
throw new RuntimeException("Player should not be able to resume a aborted installation."); throw new RuntimeException("Player should not be able to resume an aborted installation.");
} }
if (result == MachineResult.NONE) if (result == MachineResult.NONE)
{ {