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