1 package cz.cuni.amis.pogamut.ut2004.server; 2 3 import java.util.Collection; 4 import java.util.List; 5 import java.util.concurrent.Future; 6 7 import cz.cuni.amis.pogamut.unreal.server.IUnrealServer; 8 import cz.cuni.amis.pogamut.ut2004.bot.IUT2004Bot; 9 import cz.cuni.amis.pogamut.unreal.bot.impl.NativeUnrealBotAdapter; 10 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.MapList; 11 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Mutator; 12 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player; 13 import cz.cuni.amis.pogamut.ut2004.communication.worldview.map.UT2004Map; 14 import cz.cuni.amis.pogamut.unreal.server.exception.MapChangeException; 15 import cz.cuni.amis.utils.collections.ObservableCollection; 16 import cz.cuni.amis.utils.flag.Flag; 17 18 // TODO: [Ruda] specify the UT2004 server interface 19 public interface IUT2004Server extends IUnrealServer<IUT2004Bot> { 20 21 /** 22 * Sets the address of the server to different location - does not automatically reconnect, 23 * use {@link IUT2004Server#stop()} and {@link IUT2004Server#start()}. 24 * @param address 25 */ 26 public void setAddress(String host, int port); 27 28 /** 29 * @return List of all maps available on the UT server 30 */ 31 public Collection<MapList> getAvailableMaps(); 32 33 // GameInfo doesn't exist anymore, JSimlo changed it into something else 34 // public GameInfo getGameInfo(); 35 36 /** 37 * The flag raises events even when the game speed was changed by another 38 * UTServer instance or directly in game. 39 * @return Speed of the game. 40 */ 41 public Flag<Double> getGameSpeedFlag(); 42 43 /** 44 * @return Name of the current map. 45 */ 46 public String getMapName(); 47 48 /** 49 * Method that initiates map-change. It returns future that describes the result. 50 * <p><p> 51 * Note that the object must restart itself in order to reconnect to the new server. 52 * 53 * @param map 54 */ 55 public Future<Boolean> setGameMap(String map) throws MapChangeException; 56 57 /** 58 * Returns list of all players connected to the game server. The difference 59 * compared to the getAgents() method is that this method can return even the 60 * native bots, human players etc. 61 * <p><p> 62 * Custom-bots (created by Pogamut platform) can be recognized. They have non-null+non-empty {@link Player#getJmx()} field. 63 * 64 * @return List of all players on the server. 65 */ 66 public ObservableCollection<Player> getPlayers(); 67 68 69 /** 70 * Returns list of all non pogamut players connected to the game server. Collection 71 * contains NativeBotAdapter classes, this means that you can deal with the 72 * players like with Pogamut agents. 73 * @ 74 * @return List of all players on the server. 75 */ 76 public ObservableCollection<? extends NativeUnrealBotAdapter> getNativeAgents(); 77 78 /** 79 * Reeturns list of all mutators available on the server. Mutators can be 80 * used to modify the game (eg. disable weapons, change game speed). 81 * @return List of all mutators available on the server. 82 */ 83 public List<Mutator> getMutators(); 84 85 /** 86 * Connects a UT native bot to the current map. 87 * @param botName 88 */ 89 public void connectNativeBot(String botName, String botType, int team); 90 91 /** 92 * Get current map from the server 93 * @return Map of current level. 94 */ 95 public UT2004Map getMap(); 96 97 }