if (inHex.getOwner().equals(entering.getOwner())) {
if (inHex.getOwner().equals(entering.getOwner()) && !inHex.equals(entering)) {
    public static Entity stackingViolation(Game game, int enteringId, Coords coords) {        Entity entering = game.getEntity(enteringId);                // is the entering entity a mech?        if (entering instanceof Mech) {            // then any other mech in the hex is a violation            for (Enumeration i = game.getEntities(coords); i.hasMoreElements();) {                final Entity inHex = (Entity)i.nextElement();                if (inHex instanceof Mech) {                    return inHex;                }            }        }                // otherwise, if there are two present entities controlled by this        // player, returns a random one of the two.        // somewhat arbitrary, but how else should we resolve it?        Entity firstEntity = null;        for (Enumeration i = game.getEntities(coords); i.hasMoreElements();) {            final Entity inHex = (Entity)i.nextElement();            if (inHex.getOwner().equals(entering.getOwner())) {                if (firstEntity == null) {                    firstEntity = inHex;                } else {                    return d6() > 3 ? firstEntity : inHex;                }            }        }                // okay, all clear        return null;    }