View Javadoc

1   package nl.tudelft.goal.ut2004.visualizer.gui.action;
2   
3   import java.awt.event.ActionEvent;
4   import java.awt.event.ActionListener;
5   
6   import nl.tudelft.goal.ut2004.visualizer.controller.ServerController;
7   import cz.cuni.amis.pogamut.unreal.communication.worldview.map.IUnrealWaypoint;
8   import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Respawn;
9   import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player;
10  import cz.cuni.amis.pogamut.ut2004.server.IUT2004Server;
11  
12  public class RespawnHereAction implements ActionListener {
13  	private final Player player;
14  	private final IUnrealWaypoint navpoint;
15  
16  	public RespawnHereAction(Player player, IUnrealWaypoint navPoint) {
17  		this.player = player;
18  		this.navpoint = navPoint;
19  	}
20  
21  	@Override
22  	public void actionPerformed(ActionEvent e) {
23  		ServerController controller = ServerController.getInstance();
24  		IUT2004Server server = controller.getServer();
25  		assert server != null;
26  
27  		Respawn respawn = new Respawn(player.getId(), navpoint.getLocation(),null);
28  		server.getAct().act(respawn);
29  	}
30  }