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 8 9 import cz.cuni.amis.pogamut.unreal.communication.worldview.map.IUnrealWaypoint; 10 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.SpawnActor; 11 import cz.cuni.amis.pogamut.ut2004.server.IUT2004Server; 12 13 public class SpawnItemAction implements ActionListener { 14 15 private final IUnrealWaypoint navPoint; 16 private final String item; 17 18 public SpawnItemAction(IUnrealWaypoint navPoint, String item) { 19 this.navPoint = navPoint; 20 this.item = item; 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 SpawnActor spawnActor = new SpawnActor(navPoint.getLocation(), null, 30 item); 31 server.getAct().act(spawnActor); 32 } 33 34 }