View Javadoc

1   package nl.tudelft.goal.ut2004.visualizer.gui.action;
2   
3   import java.awt.event.ActionEvent;
4   import javax.swing.AbstractAction;
5   
6   import nl.tudelft.goal.ut2004.visualizer.controller.ServerController;
7   
8   
9   import cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer;
10  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Respawn;
11  import cz.cuni.amis.pogamut.ut2004.server.IUT2004Server;
12  
13  public class RespawnRandomAction extends AbstractAction {
14  	private final IPlayer player;
15  
16  	public RespawnRandomAction(IPlayer player) {
17  		this.player = player;
18  	
19  		this.putValue(NAME, "Respawn");
20  
21  	}
22  
23  	@Override
24  	public void actionPerformed(ActionEvent e) {
25  		ServerController controller = ServerController.getInstance();
26  		IUT2004Server server = controller.getServer();
27  		assert server != null;
28  
29  		Respawn respawn = new Respawn(player.getId(), null, null);
30  		server.getAct().act(respawn);
31  
32  	}
33  
34  }