This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
BWMirror-Generator/bwapi/Force.java
2014-08-05 10:43:14 +02:00

55 lines
1.3 KiB
Java

package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
/** The Force class is used to get information about each force in the match, such as the name of the force
* and the set of players in the force. */
public class Force {
/** Returns a unique ID for the force. */
public int getID() {
return getID_native(pointer);
}
/** Returns the name of the force. */
public String getName() {
return getName_native(pointer);
}
/** Returns the set of players in the force. */
public List<Player> getPlayers() {
return getPlayers_native(pointer);
}
private static Map<Long, Force> instances = new HashMap<Long, Force>();
private Force(long pointer) {
this.pointer = pointer;
}
private static Force get(long pointer) {
Force instance = instances.get(pointer);
if (instance == null ) {
instance = new Force(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native int getID_native(long pointer);
private native String getName_native(long pointer);
private native List<Player> getPlayers_native(long pointer);
}