private void removeDuplicateAttacks(int entityId) {
boolean attacked = false;
Vector<EntityAction> toKeep = new Vector<EntityAction>(/* game.actionsSize() */);
for (Enumeration<EntityAction> i = game.getActions(); i.hasMoreElements();) {
EntityAction action = i.nextElement();
if (action.getEntityId() != entityId) {
toKeep.addElement(action);
} else if (!attacked) {
toKeep.addElement(action);
if (!(action instanceof SearchlightAttackAction)) {
attacked = true;
}
} else {
System.err.println("server: removing duplicate phys attack for id#" + entityId);
System.err.println(" action was " + action.toString());
}
}
// reset actions and re-add valid elements
game.resetActions();